How nnbx2k1/xv6-riscv works
xv6 is a teaching Unix-like operating system for multiprocessor RISC-V. Its principal workflow is a user program making system calls, which the kernel dispatches to process, memory, file, or device services; results return to the program. The tree also shows a command shell, filesystem utilities, and user-space tests. The excerpts and index establish the major modules, but provide little call-site detail, so most runtime links are dashed and unverified rather than asserted as direct calls.
Main entry points: syscall.c System call dispatch · exec.c Program loading · fs.c Filesystem · bio.c Block cache
Components 21
User environment
- User program
user/user.h - Command shell
user/sh.c - User library
user/ulib.c - User tests
user/usertests.c
Kernel services
- System call dispatch
kernel/syscall.c - File syscalls
kernel/sysfile.c - Program loading
kernel/exec.c - Process scheduler
kernel/proc.c - Virtual memory
kernel/vm.c - Trap handling
kernel/trap.c - Kernel interfaces
kernel/defs.h
Storage and devices
- File objects
kernel/file.c - Filesystem
kernel/fs.c - Block cache
kernel/bio.c - Filesystem journal
kernel/log.c - Virtio disk
kernel/virtio_disk.c - Console I/O
kernel/console.c
RISC-V platform
- Kernel startup
kernel/main.c - RISC-V control
kernel/riscv.h - Interrupt controller
kernel/plic.c
Other components
- User
Connections 18
- User → Command shell: starts commands
README - Command shell → User library: uses library
- User program → System call dispatch: requests services
- User tests → System call dispatch: exercises calls
- System call dispatch → File syscalls: dispatches file calls
- System call dispatch → Process scheduler: dispatches process calls
- System call dispatch → Program loading: dispatches exec
- File syscalls → File objects: uses file objects
kernel/sysfile.c - File objects → Filesystem: accesses files
- Filesystem → Block cache: reads blocks
kernel/fs.c - Filesystem journal → Block cache: journals blocks
kernel/log.c - Block cache → Virtio disk: transfers blocks
kernel/virtio_disk.c - Program loading → Filesystem: loads executable
kernel/exec.c - Program loading → Virtual memory: builds address space
kernel/exec.c - Process scheduler → Virtual memory: manages address spaces
kernel/proc.c - Trap handling → System call dispatch: handles user traps
- Console I/O → Interrupt controller: receives interrupts
- Kernel startup → RISC-V control: configures platform
kernel/main.c