NT-Lite -- an x86-64 kernel
Boots. Runs processes. Mimics Windows to some extent.
what is it?
A 64-bit operating system kernel written from scratch. UEFI bootloader, physical and virtual memory managers, preemptive scheduler, HAL, VFS, PE loader, partial Win32 layer. It boots into a shell. ~20k lines of C and assembly.
features
- UEFI bootloader
- physical memory manager
- virtual memory manager with kernel pool
- HAL (screen, keyboard, mouse, timer, disk, PCI, APIC)
- preemptive scheduler with priority levels
- processes and threads
- VFS with IRPs
- drive-letter paths (
0:\apps\shell.exe) - INI-based boot and driver configuration
- PE import resolution and dynamic driver loading
- Win32 personality (partial)
- POSIX personality (partial)
how 2 build
- open env variables
- set
NTLITE_DRIVEas your thumbdrive (ex.G:) - set
NTLITE_NTPATHas your thumbdrive (ex.\\.\PhysicalDrive7) - open vs x64 build tools
- cd into this directory
build.batrun.bat(ide)/rund.bat(ide, debug)/runa.bat(ahci)/runad.bat(ahci, debug)- enjoy
how it looks when built
I have some strong opinions on OS design.
efi/boot/
bootx64.efi
boot.ini
hal.dll
colonel.exe
drivers/
drivers.ini
ide.sys
ahci.sys
fat32.sys
syscall.dll
win32.dll
posix.dll
shell.exe
video.exe
driver model
drivers are PE32+ .sys files with an entry point preferably named DriverEntry accepting a constant pointer to HAL_API.
drivers to be loaded have their path stored in drivers.ini, split into essential for boot (loaded by bootloader) and not required for boot (loaded by kernel).
a disk driver fills in a DISK_DRIVER vtable and calls IoRegisterDisk(index, &driver).
a filesystem driver fills in an IO_FILESYSTEM vtable and calls IoRegisterFilesystem(index, &fs, &vol).
currently shipping: AHCI (interrupts), IDE (PIO/DMA) and FAT32.
how it boots
- UEFI loads
boot.ini, readsdrivers.ini - bootloader maps kernel, HAL, and boot drivers into the upper half
- direct physical window at
0xFFFF880000000000 - jumps to
KernelMain - PMM, VMM, GDT, IDT, HAL, IRQs, scheduler
- loads runtime drivers from disk
- launches
shell.exe
paths
"apps\shell.exe" -> drive 0
"0:\apps\shell.exe" -> drive 0
"2:\data\config.ini" -> drive 2
Drives 0-7. A drive only works if a filesystem registered on it.
screenshots
faq
Q: Why?
A: Why not?
Q: Does it run Doom?
A: Not yet.
Q: Is the Win32 layer real?
A: Real enough to load binaries that expect it. Not real enough to run Notepad.
Q: Is the scheduler preemptive?
A: As much as it will ever be.
Q: Will it corrupt my data?
A: I hope not.
Q: Is this finished?
A: Not in the slightest.
Q: Can I use this in production?
A: Don't.
