Repository navigation
SharpMetal v1.0.0 — Freestanding C# Bare-Metal Microkernel
SharpMetal v1.0.0: 12-Layer Bare-Metal x86-64 Microkernel in Freestanding C#
Initial production release of SharpMetal, an seL4-inspired microkernel operating system written in freestanding C# (.NET 9 Native AOT) for modern x86-64 hardware with zero dependencies on CoreCLR, glibc, or external bootloaders.
Architectural Highlights
- Freestanding Native AOT: Zero CoreCLR/Mono runtime dependencies; executes directly on bare metal using a custom
MiniCoreLibwith unmanaged entry points and zero GC statics. - seL4-Style Capability Model & CDT: Guarded CSpace tables with a zero-alloc Capability Derivation Tree (CDT) enforcing recursive capability revocation, synchronous PTE cleardown, and TLB shootdown (
invlpg). - Synchronous IPC & Timeslice Donation: Fast-path register-based rendezvous IPC with timeslice donation, 64-bit atomic notifications, and unified dual-wait reactors (
sys_recv_any). - Interrupt-Driven Ring 3 Drivers: Isolated userland drivers for NVMe DMA block storage and modern VirtIO-Net driven via explicit PCI MSI/MSI-X vectors (
0x30and0x31) instead of polling. - Dynamic ZeroAlloc Arena: Chunk-linked
NativeArenaexpansion (ArenaChunk) inUserland.Runtime.ZeroAllocmapped at high DMA aperture0x0000_7000_0000_0000ULto prevent driver starvation. - Persistent Filesystem & VFS: Complete FAT32 cluster chain parser with
System.IO.Filestreaming abstractions over shared DMA memory. - AVX2 Accelerated Compositor: 256-bit SIMD software compositor blitting to UEFI GOP linear video memory using Write-Combining cache attributes and dirty-region clipping.
- Fault-Tolerant Supervisor: Watchdog-based crash interception, capability revocation, and automated PCIe Function-Level Reset (FLR) driver reincarnation.
- Interactive Graphic Terminal Shell: Micro-GC userland shell with command history ring buffering, PSF2 font rendering, hardware benchmarking tools, and ACPI shutdown support.
Verification & CI
- Automated streaming test harness validated under headless QEMU with OVMF firmware, asserting sequential milestones across all 12 layers (CSpace, PCI ECAM, NVMe canary write/read, VirtIO TX ring, FAT32 VFS, and Shell) with clean exit code
0.
Quick Start (Booting under QEMU)
# 1. Download pre-built disk image from release assets
curl -LO https://github.com/sadik00789/SharpMetal/releases/download/v1.0.0/disk.img
# 2. Create backing image for NVMe benchmark storage
qemu-img create -f raw nvme.img 64M
# 3. Launch QEMU with UEFI firmware, NVMe, and VirtIO-Net
qemu-system-x86_64 -machine q35 -cpu max -m 1G \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive file=disk.img,format=raw \
-drive file=nvme.img,format=raw,if=none,id=nvm \
-device nvme,serial=nvme01,drive=nvm \
-netdev user,id=net0 -device virtio-net-pci,netdev=net0