▗▄▖ ▗▄▖
█▀█ ▗▛▀▜
▟██▖ ▟█▙ █▟█▌▐▌ ▐▌▐▙
▘▄▟▌▐▙▄▟▌ █▘ ▐▌ ▐▌ ▜█▙
▗█▀▜▌▐▛▀▀▘ █ ▐▌ ▐▌ ▜▌
▐▙▄█▌▝█▄▄▌ █ █▄█ ▐▄▄▟▘
▀▀▝▘ ▝▀▀ ▀ ▝▀▘ ▀▀▘
A minimal operating system for the Risc-V architecture written in Zig. It can handle simple processes multitasking, memory management with a 2 level page table and provides a simple shell which can spawn processes.
- kernel.zig is the main entrypoint for the kernel. It defines a panic handler, some assembly required for the bootloader, and definitions for processes. Processes can spawned after
the
proc.initializecall in themainfunction. Most importantly, it prints the welcome banner. - riscv.zig contains the actual Risc-V instructions for syscalls and other architecture specific routines.
- memory.zig defines an alloc implementation and a 2 level page that that utilizes Risc-V's virtual memory facilities.
- proc.zig defines routines for creating processes and mapping memory to them, as well as multitasking.
- shell.zig and common.zig define various routines to input and output text from the operating system.
You will need qemu with the risc-v plugins installed. The Zig build script should handle building the kernel, linking (including linker scripts) and lauching the VM:
zig build run