CSharpMicrokernel is an experimental microkernel operating system written primarily in C# (NativeAOT), supported by a minimal assembly + C bootstrap layer ("BootShim"). It is designed to run on bare-metal x86_64 hardware with no runtime dependencies, showcasing how modern managed languages can drive systems-level development.
The project explores the fusion of managed language ergonomics with low-level OS engineering. By leveraging .NET NativeAOT, we achieve: - Zero runtime dependencies on the target --- no libc, no CoreCLR, no operating system. - Bare-metal execution: runs directly on hardware or emulators. - Microkernel architecture: only essential primitives in kernel space (scheduling, IPC, memory management), while services (console, FS, drivers) live in isolated modules.
This is not just a proof of concept --- it is a platform to experiment with modern language design in OS construction.
βββββββββββββββββ
β BootShim β Assembly + C
β (boot.s) β CPU bring-up, GDT/IDT, paging, stack
βββββββββ¬ββββββββ
β
βββββββββΌβββββββββ
β Kernel C β kmain.c, VGA, IDT, Keyboard, PIT
βββββββββ¬βββββββββ
β
βββββββββΌβββββββββ
β ManagedCore β C# (NativeAOT)
β Entry.cs β Scheduler, IPC, Shell, FS
ββββββββββββββββββ
- BootShim: Responsible for entering 64-bit long mode, building page tables, and handing off to C.
- C Layer: Initializes interrupts (IDT/PIC), timers, and hardware drivers. Bridges unmanaged world to managed world.
- ManagedCore (C#): Provides the microkernel's heart --- scheduler, interprocess communication (IPC), shell, and higher-level services.
- β Multiboot2-compliant boot via GRUB\
- β 64-bit long mode bring-up (assembly)\
- β VGA text console output (C + C#)\
- β IDT setup + PIC remap\
- β PS/2 keyboard driver (IRQ1) feeding into C# shell\
- β
Interactive shell in C# with commands (
help,cls,echo)
- PIT timer + uptime counter\
- Cooperative β preemptive scheduler\
- Virtual memory manager with per-process address spaces\
- IPC (send/recv/reply) channels\
- Virtual File System (VFS) with RAMFS backend\
- Disk drivers + FAT32 filesystem\
- Networking (e1000 NIC driver + TCP/IP stack)\
- User-mode processes and isolation
-
Windows 10/11 with Visual Studio 2022
- Workloads: Desktop Development with C++, .NET desktop development
-
WSL2 (Ubuntu 22.04) (recommended) with:
sudo apt update sudo apt install build-essential clang lld nasm make grub-pc-bin xorriso qemu-system-x86 dotnet-sdk-8.0
# In WSL or Linux
make allmake runThis will launch QEMU and boot the kernel ISO.
CSharpMicrokernel/
ββ BootShim/ # Assembly + C bootstrap
β ββ boot/ # Assembly files (boot.s, gdt64.s, longmode.s)
β ββ kernel/ # C files (kmain.c, vga.c, idt.c, keyboard.c)
β ββ fs/ # Future: filesystem support
β ββ drivers/ # Future: hardware drivers
β ββ grub/ # grub.cfg
β ββ linker.ld # Linker script
β ββ Makefile
β
ββ ManagedCore/ # C# NativeAOT kernel logic
β ββ Kernel.csproj
β ββ Entry.cs
β ββ Vga.cs
β ββ Keyboard.cs
β ββ Shell.cs
β ββ rd.xml
β
ββ build/ # Generated build outputs
ββ README.md