Operating System Development

Zig is popular for OS dev: freestanding targets, inline asm, packed structs for descriptors, no hidden runtime, easy cross-compilation, and built-in linker script support.

Topics: boot (Limine/Multiboot2/UEFI via std.os.uefi), GDT/IDT setup, paging, interrupts, a physical/virtual memory allocator (implement std.mem.Allocator), serial/VGA output with a custom std.Io.Writer, a scheduler, syscalls.

Learn from: zig-bare-bones, Pluto, ZigOS, kernel-zig, the OSDev wiki, and the UEFI examples in std.os.uefi.

const GdtEntry = packed struct(u64) {
    limit_low: u16, base_low: u24, access: u8,
    limit_high: u4, flags: u4, base_high: u8,
};