Article Archive / All Posts

Technical Articles Archive

Explore structured guides on computer architecture, operating systems, systems programming, Python data science, Rust and quantitative finance.

Diagram of a C kernel calling into a no_std Rust static library through the extern C FFI boundary to allocate memory
Intermediate
38 min

Bringing in Rust: A no_std Allocator Under the Kernel

Carve the C heap allocator out of PurgatoryOS and replace it with a no_std Rust implementation wired in via extern C FFI. Set up aarch64-unknown-none-softfloat, build-std core + alloc, the GlobalAlloc trait, a spin-locked free list, and a Makefile that links libpurgatory_rs.a into the existing kernel.elf — without rewriting a single line of C above the allocator.

Diagram of EL0 user task executing svc to cross the privilege boundary into the EL1 kernel, with registers x8 and x0-x7 labeled
Intermediate
38 min

System Calls: Drawing the Line Between User and Kernel

Drop your AArch64 tasks into EL0, trap into EL1 with the svc instruction, decode ESR_EL1 EC=0x15, dispatch through a syscall table, and return cleanly with eret. Four real syscalls — write, exit, getpid, yield — and the hardware-enforced privilege boundary that makes them possible.

Diagram of two tasks with PCBs and separate stacks, connected by a context_switch arrow showing register save and restore
Intermediate
22 min

Processes & Context Switching: Teaching the Kernel to Multitask

Build a round-robin task scheduler from scratch for your AArch64 bare-metal kernel. Implement the PCB, understand why only callee-saved registers need saving, write the context_switch assembly, and watch two tasks interleave on the UART — the moment your kernel becomes an actual operating system.

Diagram of a kernel heap showing a bump pointer advancing through memory and a free-list of allocated and freed blocks
Intermediate
25 min

A Heap Allocator: Teaching the Kernel to Manage Its Own Memory

Write a bump allocator and then a free-list allocator from scratch in C for your AArch64 bare-metal kernel. Learn block headers, first-fit search, coalescing, alignment, and why Rust's no_std offers a safer alternative. Visualize every allocation interactively.

Diagram showing an exception vector table with 16 entries branching to handlers for Sync, IRQ, FIQ, and SError
Intermediate
29 min

Exceptions & Interrupts: Teaching Your Kernel to Listen

Build an AArch64 exception vector table from scratch, set up the GICv2 Generic Interrupt Controller on QEMU, and write a working ARM Generic Timer interrupt handler. Your kernel finally responds to the hardware.

Diagram showing a virtual address being walked through four levels of AArch64 page tables to reach a physical address
Intermediate
31 min

Virtual Memory & the MMU: Teaching the CPU to Lie

Master the AArch64 MMU on bare metal ARM. A deep dive into page table structures, translation levels (L0-L3), and configuring SCTLR_EL1, TCR_EL1, and MAIR_EL1 for kernel memory protection.

Terminal showing 'Hello, Kernel!' output from a bare-metal ARM kernel over UART
Intermediate
15 min

Hello, UART: Your First Kernel Output via the PL011 on QEMU

Learn how to write a bare-metal C driver for the PL011 UART on AArch64. Master Memory-Mapped I/O (MMIO), the volatile keyword in C, and building a kprint function for QEMU virt without a standard library.

Diagram of ARM exception levels stacked from EL3 at the top to EL0 at the bottom
Intermediate
20 min

The ARM Boot Process: From Reset Vector to kernel_main

Learn how to write an ARM64 bootloader stub in assembly. We cover AArch64 exception levels (EL2 to EL1), zeroing BSS, stack setup, and jumping to a C kernel_main on bare metal.

Terminal window showing a cross-compiler build pipeline for ARM
Beginner
15 min

Toolchain & Environment Setup: Your First ARM Binary

Step-by-step guide to installing an AArch64 cross-compiler (GCC) and QEMU on macOS and Linux. Write a bare-metal linker script and Makefile to boot your first ARM64 program.

Abstract illustration of silicon wafers connecting to a terminal shell prompt
Beginner
11 min

Why Build an OS? The Case for Going All the Way Down

Stop treating the OS as a black box. Discover why building an AArch64 kernel from scratch on ARM is the ultimate systems programming challenge for 2026. From silicon to shell, we go all the way down.

Visualizing Itô's Lemma and Stochastic Differential Equations
Intermediate
14 min

Itô's Lemma Explained: Stochastic Calculus for Finance

Why does classical calculus fail for random variables? Learn the intuition behind Itô's Lemma, its formal derivation, and how to solve Geometric Brownian Motion (GBM) in Python.