How darkwood-byte/os works
This is a small RISC-V test OS kernel. Boot initializes memory and traps, creates an idle process, enables virtual memory, registers embedded user images, and starts init. User processes enter the kernel through traps and syscalls for process control, app lookup, console I/O, and shared socket access. Process creation loads images into user mappings; scheduling switches process contexts and address spaces. The memory excerpt is partial, so the graph shows only its evidenced allocator and mapping responsibilities; several syscall destinations are supported by the trap source, though their internals were not sampled.
Main entry points: trap_k.c Syscall dispatch · pcb_k.c Process management · main.c Kernel startup · program_k.c Scheduler and switch
Components 12
Boot and Apps
- Kernel startup
main.c - App catalog
app.c
Process Control
- Process management
pcb_k.c - Scheduler and switch
program_k.c
Memory and Mapping
- Allocator and mappings
memory.c
Trap and Kernel Services
- Trap entry
trap_k.c - Syscall dispatch
trap_k.c - Shared sockets
sockets.c - Kernel console
print_k.c - String utilities
str.c
Other components
- User programs
- Supervisor interface
SBI.c
Connections 19
- Kernel startup → Allocator and mappings: initializes memory
- Kernel startup → Trap entry: registers handler
- Kernel startup → Process management: creates idle process
- Kernel startup → Scheduler and switch: activates address space
- Kernel startup → App catalog: registers and starts
- App catalog → Process management: spawns image
- User programs → Trap entry: invokes syscalls
- Trap entry → Syscall dispatch: dispatches trap
- Syscall dispatch → Process management: kills process
- Syscall dispatch → Scheduler and switch: yields process
- Syscall dispatch → App catalog: starts and looks up apps
- Syscall dispatch → Shared sockets: reads and writes
- Syscall dispatch → Kernel console: handles console I/O
- Syscall dispatch → String utilities: compares app names
- Process management → Allocator and mappings: allocates and maps pages
- Process management → Allocator and mappings: frees process pages
- Scheduler and switch → Process management: selects process
- Scheduler and switch → Scheduler and switch: switches context and TLB
- Kernel console → Supervisor interface: uses platform interface