# ๐ŸŒŸ opencoreC: High-Performance x86_64 Microkernel OS
[ **English** | [ะ ัƒััะบะธะน](README_RU.md) ] [![Architecture](https://img.shields.io/badge/Architecture-x86__64%20(Long%20Mode)-007acc?style=for-the-badge&logo=cpu)]() [![Kernel](https://img.shields.io/badge/Kernel-Rust%20%23!%5Bno__std%5D-dea584?style=for-the-badge&logo=rust)]() [![User Space](https://img.shields.io/badge/User%20Space-C%2B%2B20%20%26%20C11-00599c?style=for-the-badge&logo=c%2B%2B)]() [![GUI](https://img.shields.io/badge/GUI-LVGL%20v8.3%20Windows%2FKDE-4ba3e3?style=for-the-badge)]() [![SMP](https://img.shields.io/badge/Multi--Core-SMP%204%20Cores-brightgreen?style=for-the-badge)]() [![Network](https://img.shields.io/badge/Network-RTL8139%20PCI%20DMA-orange?style=for-the-badge)]() [![Bootloader](https://img.shields.io/badge/Boot-Limine%20BIOS%20%2B%20UEFI-success?style=for-the-badge)]() [![License](https://img.shields.io/badge/License-MIT%20%2F%20Apache--2.0-yellow?style=for-the-badge)]()

A state-of-the-art, capability-based microkernel operating system written in Rust and modern C++20.
Built from scratch for x86_64 long mode, featuring SMP multi-core affinity, an LVGL-powered desktop compositor, hardware ACPI power management, hardware random generation, and fault-tolerant process signal isolation.

```text โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ— โ— โ— root@opencoreC: ~ (osh) โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ โ”‚ โ”‚ ___ root@opencoreC โ”‚ โ”‚ / \ ----------------- โ”‚ โ”‚ | (o) | ___ OS: opencoreC Microkernel x86_64 โ”‚ โ”‚ | | / \ Kernel: v0.1.0-release (Rust #![no_std]) โ”‚ โ”‚ \ ___ / | (o) | Uptime: 42 mins, 12 secs โ”‚ โ”‚ \___/ Shell: osh (opencore shell 1.0) โ”‚ โ”‚ [=== opencoreC ===] Display: 1280x800 @ 60Hz 32bpp (Linear FB) โ”‚ โ”‚ x86_64 SMP DE / WM: LVGL v8.3 Windows/KDE Compositor โ”‚ โ”‚ Ring 3 Userspace CPU: QEMU Virtual CPU (4 Cores SMP) โ”‚ โ”‚ Fast-Path IPC Cap Memory: 38 MiB / 509 MiB (7%) โ”‚ โ”‚ Network: Realtek RTL8139 (10.0.2.15) โ”‚ โ”‚ ACPI: S5 Poweroff, Reset, MADT 4 Cores โ”‚ โ”‚ Security: Ring 3 Signal Fault Isolation (SIGSEGV) โ”‚ โ”‚ Entropy: Hardware RNG (RDRAND / TSC) โ”‚ โ”‚ โ”‚ โ”‚ โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆ โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€(root@opencoreC)-[~] โ”‚ โ”‚ โ””โ”€# fastfetch โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ ``` --- ## ๐Ÿš€ Key Highlights & Subsystems ### โšก 1. SMP Multi-Core & Core Affinity Optimization * **Application Processor Startup:** Secondary cores (Core 1, 2, 3) are booted via the Limine SMP protocol with dedicated TSS descriptors (`PER_CPU_TSS`), GDT, IDT, SSE/AVX registers, and fast-path syscall MSRs (`IA32_LSTAR`, `IA32_STAR`, `IA32_FMASK`). * **Fast Non-Locking CPU ID:** Uses CPU MSR `0xC0000103` (`IA32_TSC_AUX`) to retrieve the current physical core index in a single assembly instruction (`rdmsr`). * **Dedicated Core Affinity:** - **Core 0:** Microkernel Core, Hardware Timer PIT (100 Hz), Hardware IRQs (Mouse, Keyboard, RTL8139 NIC). - **Core 1:** Dedicated to **`gui_server`** โ€” 60 FPS graphics rendering without lag or priority inversions. - **Core 2:** Dedicated to **`sh`** (Interactive shell and command execution). - **Core 3:** Dedicated to background servers (`init_server`, `uart_driver`, `procmgr`). ### ๐ŸชŸ 2. LVGL v8.3 Windows/KDE Desktop GUI * **Hardware PS/2 Mouse Tracking:** Smooth double-buffered cursor rendering at 1280x800 resolution directly over Limine linear framebuffer (`0x80000000`). * **Zero-Lag Window Dragging:** High-performance dirty-region raster bands (`BUF_HEIGHT = 80`) and optimized composition. * **Windows 11 / KDE Plasma Aesthetic:** - Glassmorphic Taskbar with Start Menu button, running task chips, and live CMOS digital clock. - Interactive Start Menu with quick application launcher and system power controls. - **Task Manager / Resource Monitor:** Real-time multi-core CPU utilization meters across all 4 cores and physical memory progress bar. - **Linux-style Graphical Terminal:** Dark-mode terminal with blinking cursor and full command interpreter. - **About System & Network Diagnostics Center:** Real-time RTL8139 MAC, IP, and packet counters. ### ๐ŸŒ 3. Realtek RTL8139 PCI Fast Ethernet Network * **PCI Bus Mastering:** Auto-probes PCI bus `0:2:0`, enables Bus Master DMA. * **Zero-Copy Physical DMA:** Configured with physical transmit and receive ring buffers (`0x90000000`). * **Network Stack:** Full ARP request/reply, IPv4 packet parsing, and ICMP Echo transmission (`ping 10.0.2.2`). ### ๐Ÿ›ก๏ธ 4. Process Signals & Fault Isolation (Ring 3) * **Kernel Stability:** Ring 3 crashes no longer trigger Kernel Panics: - Vector 14 (`#PF` Page Fault) $\rightarrow$ `SIGSEGV` (11) - Vector 13 (`#GP` General Protection) $\rightarrow$ `SIGSEGV` (11) - Vector 6 (`#UD` Invalid Opcode) $\rightarrow$ `SIGILL` (4) - Vector 0 (`#DE` Divide by Zero) $\rightarrow$ `SIGFPE` (8) * Faulting threads are cleanly isolated, logged with crash diagnostics (`RIP`, `ErrCode`, `CR2`), and terminated. The microkernel, GUI desktop, and sibling tasks remain fully active. Test with `crash_test`. ### ๐Ÿ”‹ 5. Hardware ACPI Subsystem * **Table Discovery:** Scans BIOS memory (`0xE0000..0xFFFFF`) for `RSDP` with checksum verification. * **Tables Parsed:** `RSDT`, `FADT` (`PM1a_CNT`), `MADT` (LAPIC CPU Core Discovery), `HPET`, `MCFG`. * **Power Management:** Native hardware ACPI S5 Sleep/Poweroff and 8042/ACPI hardware reset. ### ๐ŸŽฒ 6. Hardware Random Number Generator (RNG) * **Entropy Sources:** Checks CPUID for hardware `RDRAND` (Leaf 1, ECX 30) and `RDSEED` (Leaf 7, EBX 18). * **PRNG Fallback:** Xorshift64* stirred with CPU cycle counter (`rdtsc`) and CMOS RTC. * **Syscall & Tool:** Syscall 22 (`SYS_GETRANDOM`) and user command `random` / `rng` generating UUID v4 identifiers. ### ๐Ÿ’ป 7. Interactive Terminal Shell (`osh`) * **Stylized Powerline Prompt:** `โ”Œโ”€โ”€(root@opencoreC)-[~]\nโ””โ”€# ` * **Built-in `fastfetch`:** Integrated system information tool with custom ASCII logo and ANSI palette. * **Log Isolation:** Daemon logs (`gui_server`, `procmgr`, `init_server`) are routed to `dmesg`, leaving the interactive terminal pristine. --- ## ๐Ÿ›๏ธ Architecture Overview The system strictly enforces **Principle of Least Privilege (PoLP)**: only memory translation and fast-path IPC primitives reside in Ring 0, while everything else executes in isolated Ring 3 address spaces. ### ๐ŸŒ Multi-Core Topology & Subsystem Isolation ```text โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ HARDWARE LAYER (x86_64 Long Mode) โ”‚ โ”‚ โ”‚ โ”‚ [CPU 0: Bootstrap] [CPU 1: AP 1] [CPU 2: AP 2] [CPU 3: AP 3] โ”‚ โ”‚ โ”œโ”€โ”€ PIT 8254 Timer โ””โ”€โ”€ Linear Framebuffer โ””โ”€โ”€ PS/2 Input Buffer โ”œโ”€โ”€ PCI RTL8139 โ”‚ โ”‚ โ”œโ”€โ”€ Local APIC/IOAPIC (1280x800@32bpp) (Keyboard + Mouse) โ””โ”€โ”€ 16550 UART โ”‚ โ”‚ โ””โ”€โ”€ ACPI PM / RNG โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ Interrupts & MSRs โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ RING 0: RUST MICROKERNEL (#![no_std]) โ”‚ โ”‚ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ Memory Subsystem โ”‚ โ”‚ Multi-Core Scheduler โ”‚ โ”‚ Fast-Path Rendezvous IPC โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ 4-Level PML4 VMMโ”‚ โ”‚ โ”œโ”€โ”€ Core Affinity โ”‚ โ”‚ โ”œโ”€โ”€ Register Fast-Path (32B) โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Bitmap PFA โ”‚ โ”‚ โ””โ”€โ”€ Quantum Switch โ”‚ โ”‚ โ””โ”€โ”€ Capability Token Access โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ”‚ Signal Interceptor โ”‚ โ”‚ Hardware ACPI Driver โ”‚ โ”‚ Hardware Entropy Generator โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ SIGSEGV / SIGILLโ”‚ โ”‚ โ”œโ”€โ”€ RSDP / MADT / S5โ”‚ โ”‚ โ”œโ”€โ”€ RDRAND / RDSEED โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Thread Recovery โ”‚ โ”‚ โ””โ”€โ”€ 8042 Power Resetโ”‚ โ”‚ โ””โ”€โ”€ High-Entropy PRNG Stirring โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ Isolated Page Tables (CR3) โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ RING 3: USERSPACE ECOSYSTEM โ”‚ โ”‚ โ”‚ โ”‚ [Core 1 Dedicated] [Core 2 Dedicated] [Core 3 Dedicated] [Core 3 Service] โ”‚ โ”‚ gui_server sh init_server / procmgr uart_driver โ”‚ โ”‚ โ”œโ”€โ”€ LVGL Compositor โ”œโ”€โ”€ osh Interactive โ”œโ”€โ”€ System Lifecycle โ””โ”€โ”€ 16550 Serial โ”‚ โ”‚ โ”œโ”€โ”€ Windows/KDE Shell โ”œโ”€โ”€ Fastfetch Engine โ”œโ”€โ”€ Process Spawner Rendezvous โ”‚ โ”‚ โ””โ”€โ”€ HW Mouse Cursor โ””โ”€โ”€ Command Suite โ””โ”€โ”€ Cap Table Registry Listen Loop โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ### โšก Detailed Component Communication ```mermaid sequenceDiagram autonumber actor User as PS/2 Mouse & Keyboard participant IRQ as HW Interrupts (Core 0) participant Kernel as Rust Microkernel (Ring 0) participant GUI as gui_server (Core 1) participant Shell as sh Terminal (Core 2) participant Net as RTL8139 NIC (Core 3) User->>IRQ: Mouse Move / Keypress Event IRQ->>Kernel: Hardware Interrupt Vector 33 / 44 Kernel->>GUI: Syscall 21: SYS_MOUSE_GET (x, y, buttons) GUI->>GUI: Direct Framebuffer Raster Blit (60 FPS) User->>Shell: Keypress: "ping 10.0.2.2" Shell->>Kernel: Syscall 1: SYS_IPC_CALL (RTL8139 Endpoint) Kernel->>Net: Synchronous Rendezvous IPC (Op: TX_PACKET) Net->>Kernel: Syscall 20: SYS_DMA_ALLOC (Physical Ring Buffer) Net-->>User: ICMP Echo Reply Packet Received! ``` --- ## ๐Ÿ“ Repository Structure ```text opencoreC/ โ”œโ”€โ”€ boot/ โ”‚ โ””โ”€โ”€ limine/ # Limine bootloader binaries & installer โ”œโ”€โ”€ build/ # Output directory for ELF binaries & disk image โ”œโ”€โ”€ config/ โ”‚ โ”œโ”€โ”€ linker.ld # Higher-half kernel linker script (0xffffffff80000000) โ”‚ โ””โ”€โ”€ user.ld # Userspace Ring 3 ELF linker script (0x400000) โ”œโ”€โ”€ hal/ # Hardware Abstraction Layer (PCI, 16550 UART) โ”œโ”€โ”€ include/ โ”‚ โ””โ”€โ”€ abi/ โ”‚ โ”œโ”€โ”€ ipc.h # Fast-Path IPC register layout & protocols โ”‚ โ”œโ”€โ”€ syscalls.h # System call numbers, structures, and POSIX signals โ”‚ โ””โ”€โ”€ types.h # ABI primitive types โ”œโ”€โ”€ kernel/ # Microkernel crate (Rust #![no_std]) โ”‚ โ”œโ”€โ”€ Cargo.toml โ”‚ โ”œโ”€โ”€ asm/ โ”‚ โ”‚ โ”œโ”€โ”€ context.S # Preemptive context switcher (switch_to) โ”‚ โ”‚ โ””โ”€โ”€ syscall_entry.S # Fast syscall/sysretq entry trampoline โ”‚ โ””โ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ main.rs # Kernel entry point & subsystem orchestrator โ”‚ โ”œโ”€โ”€ arch/ # GDT, TSS, IDT, SMP, ACPI, Syscalls โ”‚ โ”‚ โ”œโ”€โ”€ acpi.rs # RSDP, RSDT, FADT, MADT parser & poweroff โ”‚ โ”‚ โ”œโ”€โ”€ gdt.rs # Per-CPU GDT & TSS selectors โ”‚ โ”‚ โ”œโ”€โ”€ idt.rs # IDT vectors & Ring 3 signal fault handler โ”‚ โ”‚ โ”œโ”€โ”€ smp.rs # SMP multi-core AP boot & TSC_AUX per-CPU query โ”‚ โ”‚ โ””โ”€โ”€ syscall.rs # Fast-path syscall dispatcher โ”‚ โ”œโ”€โ”€ drivers/ # Microkernel drivers โ”‚ โ”‚ โ”œโ”€โ”€ dmesg.rs # Circular kernel log ring buffer โ”‚ โ”‚ โ”œโ”€โ”€ keyboard.rs # PS/2 keyboard driver โ”‚ โ”‚ โ”œโ”€โ”€ mouse.rs # PS/2 mouse driver with screen clamping โ”‚ โ”‚ โ”œโ”€โ”€ rng.rs # Hardware RNG (RDRAND / RDSEED / PRNG) โ”‚ โ”‚ โ”œโ”€โ”€ serial.rs # 16550 UART serial logger โ”‚ โ”‚ โ””โ”€โ”€ timer.rs # PIT 8254 timer (100 Hz preemptive ticks) โ”‚ โ”œโ”€โ”€ ipc/ # Capability-based synchronous rendezvous IPC โ”‚ โ”œโ”€โ”€ mm/ # Physical Frame Allocator & 4-Level Paging โ”‚ โ””โ”€โ”€ sched/ # Preemptive Multi-Core Scheduler & Threads โ”œโ”€โ”€ lib/ โ”‚ โ”œโ”€โ”€ libc/ # Minimal freestanding C library (string, stdlib, stdio) โ”‚ โ”œโ”€โ”€ libipc_cpp/ # C++20 RAII IPC endpoints & message wrappers โ”‚ โ””โ”€โ”€ lvgl/ # LVGL v8.3 embedded graphics library โ”œโ”€โ”€ servers/ # Ring 3 User-space processes โ”‚ โ”œโ”€โ”€ gui_server/ # Windows/KDE Desktop Compositor (LVGL v8.3) โ”‚ โ”œโ”€โ”€ init_server/ # System root server โ”‚ โ”œโ”€โ”€ procmgr/ # Process & server manager daemon โ”‚ โ”œโ”€โ”€ sh/ # Interactive UNIX shell (Powerline prompt & fastfetch) โ”‚ โ””โ”€โ”€ uart_driver/ # 16550 COM1 serial driver server โ”œโ”€โ”€ limine.conf # Limine bootloader configuration โ”œโ”€โ”€ Makefile # Unified build system โ””โ”€โ”€ README.md # Documentation & project manual ``` --- ## ๐Ÿ› ๏ธ Build & Run Guide ### Prerequisites (Ubuntu/Debian) ```bash sudo apt-get update sudo apt-get install -y build-essential gcc g++ qemu-system-x86 nasm mtools xorriso curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup target add x86_64-unknown-none ``` ### Quick Commands | Target | Description | | :--- | :--- | | `make all` | Compiles the Rust microkernel, freestanding libc, drivers, and Ring 3 servers. | | `make image` | Builds a bootable 64 MiB hybrid FAT32 disk image (`build/opencoreC.img`) with Limine BIOS + UEFI. | | `make gui` | **Launches QEMU in GUI mode** with the LVGL Desktop Compositor, hardware mouse, and terminal. | | `make run` | **Launches QEMU in serial console mode** with `fastfetch` and the Powerline shell prompt. | | `make clean` | Cleans all compiled binaries, intermediate objects, and disk images. | --- ## โŒจ๏ธ Shell Command Reference (`osh`) Available in both the **Serial Console (`make run`)** and the **GUI Terminal Window (`make gui`)**: | Command | Description | | :--- | :--- | | `fastfetch` / `neofetch` | Displays the system summary, ASCII logo, and ANSI color palette. | | `smp` / `cpu` | Displays online physical cores, current executing CPU, and per-core scheduler ticks. | | `acpi` | Displays ACPI RSDP status, MADT discovered cores, and FADT power management ports. | | `random` / `rng` | Generates 16 bytes of entropy via hardware RNG and formats as a UUID v4. | | `crash_test` | Triggers a Ring 3 null-pointer fault to verify kernel `SIGSEGV` signal handling. | | `ps` | Lists active threads, states (`READY`, `RUNNING`, `BLOCKED`), RIP, and CPU ticks. | | `top` | Dynamic multi-core process and CPU load monitor. | | `mem` / `free` | Displays Physical Frame Allocator (PFA) RAM usage (Total, Used, Free). | | `ifconfig` / `ip` | Displays Realtek RTL8139 PCI Fast Ethernet MAC, IP, and status. | | `ping ` | Transmits real ICMP Echo Ping packets over RTL8139 PCI DMA. | | `dmesg` | Displays the circular kernel and background daemon log ring buffer. | | `date` | Queries CMOS Real-Time Clock date and time. | | `uptime` | Displays system uptime and PIT timer clock ticks. | | `uname -a` | Prints operating system name, kernel version, and architecture. | | `whoami` | Prints the active user identity (`root`). | | `kill ` | Sends a termination request to stop a specific thread by PID. | | `calc ` | Freestanding arithmetic calculator (`+`, `-`, `*`). | | `ls` / `dir` | Lists files in the in-memory RAM disk. | | `cat ` | Reads and displays text file contents. | | `touch ` | Creates a new file in RAM disk. | | `clear` | Clears the terminal screen. | | `reboot` | Reboots the machine via ACPI / 8042 reset. | | `poweroff` / `exit` | Powers off the computer via hardware ACPI S5 shutdown. | --- ## ๐Ÿ“œ License Distributed under the **MIT / Apache-2.0** dual license. See `LICENSE` for details.