Project 01 · OPERATING SYSTEM
Ridge OS
A 64-bit operating system for x86: bootloader, memory manager, scheduler, filesystem and compositor, written from the Intel manuals up.
The challenge
Build a desktop operating system that boots on real hardware, with nothing underneath it but the firmware.
The approach
Ridge started as 512 bytes of assembly and grew one subsystem at a time. Each layer was brought up in QEMU, tested against the manuals, then moved to physical machines. There is no libc in the kernel; memory, strings and formatting are all implemented in-tree.
The layers
Every subsystem, with the code it took and the time it took to write.
01
Bootloader & long mode
3,410 lines3 weeks
02
Paging & physical memory
12,880 lines7 weeks
03
Preemptive scheduler
8,204 lines5 weeks
04
Filesystem & drivers
61,950 lines5 months
05
Compositor & font rasterizer
97,858 lines6 months
From the source
Mapping a page through four levels of tables
ridge-os/kernel/mm/page.c
// map a 4 KiB page into the current address space
void page_map(u64 virt, u64 phys, u32 flags) {
u64 *pml4 = (u64 *)phys_to_virt(cr3_read());
u64 *pdpt = walk(pml4, PML4_IDX(virt), flags);
u64 *pd = walk(pdpt, PDPT_IDX(virt), flags);
u64 *pt = walk(pd, PD_IDX(virt), flags);
pt[PT_IDX(virt)] = (phys & PAGE_MASK) | flags | PTE_P;
/* no libc in the kernel: everything is in-tree */
invlpg(virt);
}
Mar 2025
First boot: a single character printed from real mode
Jun 2025
Long mode, paging and a working heap
Nov 2025
Preemptive multitasking with two user processes
Sep 2026
Boots to a graphical desktop on a physical laptop