2.4 Code: xv6 organization

File Description
Boot entry.S Very first boot instructions.
main.c Control initialization of other modules.
start.c Early machine-mode boot code.
Processes exec.c exec() system call.
proc.c Processes and scheduling.
swtch.S Thread switching.
sysproc.c Process-related system calls.
Traps kernelvec.S Handle traps from kernel code.
trampoline.S Handle traps from user code.
trap.c C code to handle and return from traps and interrupts.
syscall.c Dispatch system calls to handling function.
Memory vm.c Manage page tables and address spaces.
kalloc.c Physical page allocator.
Devices console.c Connect to the user keyboard and screen.
plic.c RISC-V interrupt controller.
printf.c Formatted output to the console.
uart.c Serial-port console device driver.
virtio_disk.c Disk device driver.
FS bio.c Disk block cache for the file system.
file.c File descriptor support.
fs.c File system.
log.c File system logging and crash recovery.
sysfile.c File-related system calls.
pipe.c Pipes.
Misc sleeplock.c Locks that yield the CPU.
spinlock.c Locks that don’t yield the CPU.
string.c C string and byte-array library.
Figure 2.2: Xv6 kernel source files.

The xv6 kernel source is in the kernel/ sub-directory. Figure 2.2 lists the files, divided into the major areas of kernel responsibility: starting the system (booting), creating and controlling processes, handling traps (interrupts and system calls), allocating memory and configuring virtual addresses, controlling devices, and managing the file-system.