
Use OpenSBI and SBI Calls From a RISC-V Kernel
Call the RISC-V SBI from supervisor mode: probe extensions, print through DBCN, set timers, start harts and shut down, with the ecall rules and errors.
Everything you need to level up your coding skills.

Call the RISC-V SBI from supervisor mode: probe extensions, print through DBCN, set timers, start harts and shut down, with the ecall rules and errors.

Build the smallest RISC-V kernel that boots on QEMU virt: a linker script at 0x80200000, an entry stub, a C main printing through the UART, and a GDB check.

A tour of the RISC-V supervisor CSRs a kernel touches: sstatus, sie, stvec, scause, sepc, stval, satp and sscratch, with instructions and exact bits.

Drive the NS16550A UART at 0x10000000 on QEMU's RISC-V virt machine with volatile MMIO in C: initialize it, send and poll bytes, then add receive interrupts.

Learn what machine, supervisor and user mode each control on RISC-V, how traps are delegated between them, and how firmware drops into S mode with mret.

Write a bitmap physical memory manager in C: place the bitmap in usable RAM, mark reserved and kernel frames, allocate and free 4 KiB frames, and allocate runs.

Program the 8253 PIT for a periodic tick, then calibrate the local APIC timer against it and run a 1000 Hz tick, with a tick counter and a sleep function.

Write a PS/2 keyboard driver for a hobby kernel: the 8042 ports, scancode set 1, make and break codes, the 0xE0 prefix, shift and caps lock, and a ring buffer.

Remap the two 8259 PICs away from the CPU exception vectors, mask and unmask IRQ lines, send the end-of-interrupt and detect spurious IRQ 7 and IRQ 15.

Build your own x86 GDT in C: descriptor layout, kernel and user segments, a TSS slot, lgdt and segment register reloads, and the 64-bit changes.

Segmentation and paging both translate x86 addresses. See what each does, why 64-bit mode keeps only FS and GS bases, and which to use for protection.

Compare Linux system calls on x86-64, ARM64 and RISC-V: the trap instruction, number register, argument registers and the same hello program in each.
We send one email when a new post is published. No spam.