diff --git a/readme.md b/readme.md index c6842cc..850abe9 100644 --- a/readme.md +++ b/readme.md @@ -15,43 +15,39 @@ The codebase is still small enough to understand, but large enough to hurt your ## features - UEFI bootloader -- higher-half x86-64 kernel -- real SMP: hardware AP startup, per-CPU state, scheduler-owned idle threads, reschedule IPIs, and TLB shootdowns +- real SMP - physical memory manager - virtual memory manager with kernel pool and user heap -- W^X-style user page protections - single address-space design with user/supervisor page permissions -- HAL for screen, keyboard, mouse, timer, PCI, APIC, HPET, AHCI, and IDE -- preemptive priority scheduler accounting for ticks, context switches, idle selections, demotions, and aging promotions +- real, separate HAL +- preemptive priority scheduler - processes and threads - process termination state tracking and exit signaling - object handles with per-handle rights metadata - events, semaphores, mutexes, queues, and alertable waits -- IRQL model: `PASSIVE_LEVEL`, `APC_LEVEL`, `DISPATCH_LEVEL`, and device IRQLs -- interrupt-exit scheduling instead of context-switching inside hard IRQ handlers +- IRQL model +- interrupt-exit scheduling - DPC queue for interrupt bottom halves - kernel APCs - user APCs through a real trap-frame return dispatcher - async file I/O with completion events, APC callbacks, IOSBs, and cancellation - VFS with IRPs - centralized `IoCompleteRequest()` -- `DRIVER_OBJECT` / `DEVICE_OBJECT` driver model - `IoCallDriver()` dispatch path - AHCI driver, interrupt-driven - IDE driver, PIO/DMA -- FAT32 filesystem driver with VFAT +- FAT32 filesystem driver with VFAT LFN - USB with bus, xHCI, mass storage and HID - drive-number paths such as `0:/apps/shell.exe` -- lwIP network stack as a runtime driver (`lwip.sys`) -- RTL8139 and RTL816x ethernet drivers -- native BSD-style socket syscalls: `SysSocket`, `SysBind`, `SysConnect`, `SysSend`, `SysRecv`, `SysPoll`, `SysResolveHost`, and friends +- modular networking via lwIP +- RTL8139 and RTL816x drivers +- BSD-style socket syscalls: `SysSocket`, `SysBind`, `SysConnect`, `SysSend`, `SysRecv`, `SysPoll`, `SysResolveHost`, and friends - length-tracked string-view syscall ABI with request structs for path/name/text arguments - printf/debug formatting support for bounded string views via `%v` - INI-based configuration - PE import resolution and dynamic `.sys` driver loading - partial Win32 personality - partial (stub/microsoft-level) POSIX personality -- self-tests for APCs, async disk I/O, async file I/O, trap frames, and cancellation - fully GDPR-compliant ## architecture notes @@ -199,6 +195,8 @@ NT-Lite now has a TCP/IP stack via lwIP running as a runtime driver. The kernel - `SysResolveHost` for DNS - `SysSetSocketOption` / `SysGetSocketOption` +Host byte order. Cry some more. + Test apps ship with the build: `httpget.exe`, `tcpserve.exe`, `udp.exe`, `resolve.exe`, and `ping.exe`. Port forwarding is enabled by default in `runa.bat` — host port 8080 maps to guest port 8080. @@ -207,14 +205,14 @@ Port forwarding is enabled by default in `runa.bat` — host port 8080 maps to g ```text "apps/shell.exe" -> current working directory -"0:/apps/shell.exe" -> volume 0, native path +"0:/apps/shell.exe" -> volume 0, native path. works everywhere. "2:/data/config.ini" -> volume 2, native path -"C:\apps\doom.exe" -> volume 0, win32.dll translated path, mapping is simple c->0, d->1, etc. +"C:\apps\doom.exe" -> volume 0, win32.dll translated path, mapping is simple c->0, d->1, etc. works only for win32 calls. "/apps/video.exe" -> volume 0, posix.dll translated path, mapping is simple: root is volume 0, then directories as volumes, so -"/1/apps/video.exe" -> volume 1 +"/1/apps/video.exe" -> volume 1. works only for posix calls. ``` -Volumes `0`-`7` are available. A volume only works if a filesystem is registered on it (duh). +Volumes `0`-`7` are available. A volume only works if a filesystem is registered on it. The Win32 personality translates drive letters to volume numbers, while the POSIX personality maps volumes onto a tree. Path parsing is length-aware internally. Embedded NUL bytes are rejected for text paths and names. @@ -239,10 +237,15 @@ boot.ini drivers/ drivers.ini ahci.sys + ata.sys fat32.sys - ide.sys lwip.sys + pci.sys + ps2.sys + rtl816x.sys rtl8139.sys + usb.sys + vmwaresvga.sys system/ colonel.exe hal.dll @@ -275,9 +278,6 @@ todo ## faq -Q: Why? -A: Reasons. - Q: Is it secure? A: Don't connect to the internet with it. @@ -294,7 +294,7 @@ 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: Not a chance. WE DO - in fact - BREAK USERSPACE. +A: WE DO - in fact - BREAK USERSPACE. Q: Can you read and write files? A: As far as I'm aware. @@ -309,14 +309,14 @@ Q: Does it really have SMP? A: Watch out. It bites. Q: Is the Win32 layer real? -A: Depends how you frame it. Some apps will run, most will not. +A: Depends how you frame it. Real apps won't run but specifically prepared ones will. Q: Are processes isolated? A: No. But IPC is free. Is this how a serious modern OS should isolate processes? No. -Are we a serious OS? No. Is it very convenient while building? Absolutely. Do I care? Nope. +Are we a serious OS? No. Is it very convenient? Absolutely. Q: How often does it crash? -A: Like Windows 11. +A: It doesn't if you don't touch it. Q: Can it recover from a crash? A: Works on my machine. @@ -330,14 +330,17 @@ A: It shouldn't. Q: Why is the path syntax so weird? A: It makes sense to me. +Q: Why both Win32 and POSIX? +A: NT could do it, why can't I? + Q: Why are the logs so verbose? -A: How else do I debug it? +A: Sure, try to debug without them. Q: What should I read first? A: This document. Q: How do I contribute? -A: maksw@maksw.pl +A: `maksw@maksw.pl` Q: Where's the source? A: Right here.