KernelNomad
119 posts

KernelNomad
@KernelNomad_
Systems nerd. Hacking @zymtrace. Building an OS kernel in Rust and userspace in Zig currently.






This will piss you off but it's true


issue comes in tag opencode opens a PR with a video verifying fix




My kernel now supports lazy allocation and page fault handling 🎉 Here is how it works: 1. A userspace program requests, say, 10 × 4 KiB pages (40 KiB). 2. Instead of allocating physical memory immediately, the kernel records that this virtual address range is valid and remembers its permissions.. 3. When the program first accesses one of those pages, the CPU raises a page-fault exception. 4. The kernel verifies that the access is valid, allocates a physical page, updates the page table, and resumes execution. In the attached image, my Zig BrkAllocator reserves 29 pages, but the test program only touches one of them. As a result, the kernel handles exactly one page fault and allocates only a single physical page.



















