Files
nt-lite/readme.md
T
maksw 73abd6f90d isolate POSIX builds from the host UCRT, wire lwext4 and ntfs-3g as ext4.sys and ntfs.sys, split the FAT driver into directory/file/async/driver/mount units, add posixsrv and dwm plus input/console/desktop syscall clients and a pile of new smoke targets, rename serial.sys to cereal.sys, name HDA/USB/lwIP/AHCI workers, harden ATA probing/reset/removal around actual hardware deadlines, absent-channel detection, diagnostics and explicit worker lifetime, redo ACPI S5 shutdown around GAS/MMIO and HW-reduced firmware, scan SSDTs for _S5 and deal with Intel SMI sleep trapping, make serial and SMP timeouts use real monotonic deadlines, add thread names and fix terminal thread teardown, scheduler and APC prepare/commit races, make advisory file locks queryable and preserve split ranges and add mutable file append state, add shared-memory pipes with kernel-assisted wait/wake, introduce capability-scoped input and display managers, split surface map rights into read/write, add explicit unmap and replace present with commit/generation/damage tracking while keeping physical presentation under the display manager, decouple native exception classes from Win32 exception numbers and translate them in kernel32, add opaque process startup data, bump the resource protocol to v3 with namespace directories, symlinks and enumeration and service control to v2 with generic READY handle exports, add the new POSIX errno/status surface and rebuild fds around posixsrv-owned shared open descriptions, descriptor-local flags, exact inheritance snapshots, dup/fcntl/record locks and shared-ring pipes, add waitpid, POSIX credentials/groups/sessions/passwd/group lookups and move sockets onto stable open descriptions, port the shells and apps to the new console/input services and surface commit API, teach init to load services.ini and start/supervise RSSRV, DWM and generic services under restricted capabilities while publishing their endpoints through RSSRV, split RSSRV into namespace, volume, display, session, input, console and resource components and make /SystemRoot a real symlink to the independently published system volume, shift the syscall table again, expand lock/resource/surface/POSIX/service/thread smoke coverage, make docs scream ASK QUESTIONS and DISCUSS at LLMs, replace MIT No Attribution with WTFPL+.
2026-09-16 10:33:20 +02:00

208 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# NT-Lite -- an x86-64 kernel
“Not only is UNIX dead, it’s starting to smell really bad.” - Rob Pike
“UNIX has three operations: read, write, and lie through ioctl.”
## what is it?
NT-Lite is a 64-bit operating system kernel written from scratch.
It boots into a shell, launches programs, runs Doom, talks TCP/IP, and occasionally reminds you that it is still a hobby kernel.
## features
- UEFI bootloader
- real SMP
- VAD-based virtual memory, file-backed and anonymous mmap, CoW, reclaim
- single address-space design with user/supervisor page permissions
- preemptive priority scheduler
- capability-style handles with rights checks, derivation, and revocation
- rich synchronization primitives
- IRQL, DPCs, kernel APCs, and user APCs
- user exception handling with structured and vectored handlers
- async file I/O with events, IOSBs, APC callbacks, and cancellation
- capability-relative VFS with IRPs
- refcounted mounted volumes with partition arrival/removal
- page cache with dirty writeback and invalidation
- USB bus, xHCI, mass storage, hubs, hotplug, and HID
- audio
- VMware SVGA display driver
- dynamic driver loading
- native BSD-ish socket syscalls
- DNS resolver syscall
- four-register syscall ABI with sized request structs for larger calls
- partial Win32 personality
- partial (microsoft-level) POSIX personality
- Doom
- video playback
- fully GDPR-compliant
- everything but the kitchen sink
## paths
You thought it would be easy, would you?
```text
"apps/shell_native.exe" -> current working directory, resolved in userspace
"/SystemRoot/apps/shell_native.exe" -> system volume through the resource namespace
"/Device/HarddiskVolume1/boot.ini" -> system volume through the resource namespace
"C:\apps\doom.exe" -> /SystemRoot/apps/doom.exe through win32.dll
"\apps\doom.exe" -> /SystemRoot/apps/doom.exe through win32.dll
"/apps/video.exe" -> /SystemRoot/apps/video.exe through posix.dll
```
Kernel filesystem syscalls are capability-relative; userspace owns the current working directory and resolves named resources through `rssrv`.
`/SystemRoot` is the configured boot volume. Other mounted volumes are discovered through the volume manager and opened by capability.
## networking
The socket syscalls are BSD-shaped, not BSD-compatible. Same nouns (AF_INET, SOCK_STREAM, IPPROTO_TCP), none of the baggage:
one fixed-size tagged address struct instead of the sockaddr_in/sockaddr_storage casting dance,
no htons/ntohl conversions, and DNS resolution is a syscall rather than a userspace library call.
That's right microkernel purists, cry some more. Ergonomics.
Async is first-class here too, same machinery as the filesystem. Except the DNS resolver. Ergonomics, am I right?
## how to build
- get mtools
- open the VS x64 build tools
- change into this directory
- run `build.bat`
- use one of:
- `run.bat` — IDE
- `rund.bat` — IDE, debug
- `runa.bat` — AHCI
- `runad.bat` — AHCI, debug
## how it looks when built
The ESP is just the boot anchor:
```text
efi/boot/
bootx64.efi
efi/ntlite/fs/
...
boot.ini
```
The configured system volume carries the OS:
```text
system/
colonel.exe
hal.dll
init.exe
rssrv.exe
syscall.dll
win32.dll
posix.dll
settings.ini
drivers/
drivers.ini
ahci.sys
ata.sys
fat.sys
hda.sys
lwip.sys
ntfs.sys
ext4.sys
pci.sys
ps2.sys
rtl816x.sys
rtl8139.sys
cereal.sys
usb.sys
vmwaresvga.sys
apps/
shell_native.exe
shell_win32.exe
shell_posix.exe
doom.exe
video.exe
edit.exe
httpget.exe
tcpserve.exe
udp.exe
resolve.exe
ping.exe
memtop.exe
```
## screenshots
![video.exe running bink video 2](image.png)
## faq
Q: Is it secure?
A: Don't connect to the internet with it.
Q: Who is this for?
A: Me.
Q: What's next?
A: Whatever I fixate on next.
Q: Does it run Doom?
A: `doom.exe`
Q: Can it play Crysis?
A: Into the bucket list.
Q: Does USB work?
A: It did for everything I threw at it.
Q: If I write a program now, will it run in the future?
A: WE DO, in fact, BREAK USERSPACE.
Q: Can you read and write files?
A: As far as I'm aware.
Q: Does it have async I/O?
A: The best you'll get.
Q: Does the networking actually work?
A: It didn't crash yet.
Q: Does it really have SMP?
A: Watch out. It bites.
Q: Is the Win32 layer real?
A: API wise, yes. Binary compatibility wise, close but no.
Q: Are processes isolated?
A: No. But IPC is free. And you can't steal handles. Is this how a serious modern OS should isolate processes? No.
Are we a serious OS? No. Is it very convenient? Absolutely.
Q: How often does it crash?
A: It doesn't if you don't touch it.
Q: Can it recover from a crash?
A: Works on my machine.
Q: Is this finished?
A: Does it look finished?
Q: Will it corrupt my data?
A: It shouldn't.
Q: Why is the path syntax so weird?
A: It makes sense to me.
Q: Why are the logs so verbose?
A: Try debugging an interrupt path with vibes.
Q: What should I read first?
A: This document.
Q: How do I contribute?
A: `maksw@maksw.pl`
Q: Can I use this in production?
A: Don't.
#### Project dedicated to the honorable, esteemed Professor Leszek Wójcik through whom I came to hate Unix.