rvos is a bare-metal operating system kernel written in C and Assembly for the RISC-V architecture.
It serves as an educational project for exploring low-level system programming, memory management, and kernel architecture.
- Target: RISC-V
- Tested on QEMU virt machine
- Assembly startup file (
start.S) - Initializes stack pointer
- Handles multi-core (Hart) parking
- Custom kalloc heap allocator
- Stack Safety
- Kernel stack placed in
.bss - Ensures writable memory and known bounds for GC
- Kernel stack placed in
- Direct Memory Mapping
- Running in Machine Mode
- Identity mapping: PA = VA
| Directory | Description |
|---|---|
kernel/ |
Core kernel code (allocator, scheduler, main entry). |
startup/ |
Assembly boot code (start.S), hardware init. |
include/ |
Header files & hardware definitions. |
lib/ |
Utility functions (string ops, misc libs). |
test/ |
Kernel-level test code. |
kernel.ld |
Linker script defining memory layout. |
- Toolchain:
riscv64-unknown-elf-gcc(or riscv32 equivalent) - Emulator: QEMU (
qemu-system-riscv64/qemu-system-riscv32) - Build Tool: GNU Make
make run
make debug
The memory layout begins at 0x80000000, defined in kernel.ld:
.text– Kernel code (read-only, executable).data– Initialized global variables.bss– Uninitialized globals & kernel stack- Heap – Starts after
.bss, grows upward toMEMORY_END
This project is open source.