Neptune kernel
Find a file
2025-06-26 13:28:08 +02:00
kern kalloc.[ch] from xv6, memory.[ch] containing memory probing algorithm and constants 2025-06-26 13:27:35 +02:00
lib Use new API 'read_tp()' in proc.c mycpu() 2025-06-26 13:28:08 +02:00
.clang-format Clang format alignment 2025-06-26 05:55:59 +02:00
.clangd clangd: .clangd file that seems to make clangd behave 2025-06-26 04:04:34 +02:00
.gitignore Minimal viable kernel 2025-06-26 02:43:43 +02:00
config.h Move some config options from start into config.h 2025-06-26 05:56:41 +02:00
entry.S Removing debug prints from entry routine. After stacks are set up correctly, this is better handled in C. 2025-06-26 04:25:37 +02:00
kernel.ld Symbol rename in linker.ld: end -> kernel_end 2025-06-26 12:04:11 +02:00
Makefile kalloc.[ch] from xv6, memory.[ch] containing memory probing algorithm and constants 2025-06-26 13:27:35 +02:00
README.md README: Mention xv6, notes on terminology from xv6 book 2025-06-26 10:28:31 +02:00
riscv.h Fix nasty bug related to spinlock panic when lock is already held, because the tread pointer was never set on a per-hart basis. 2025-06-26 06:24:01 +02:00
start.c Rename struct: spinlock -> Spinlock 2025-06-26 12:02:41 +02:00
types.h New type in types.h: size_t (u64) 2025-06-26 12:04:40 +02:00

Neptune Kernel

Inspired by xv6

For a quick reference on RISC-V assembly:

Toolchains:


A word on terminology: Although the official x86 term is exception, xv6 uses the term trap, largely because it was the term used by the PDP11/40 and therefore is the conventional Unix term.

Register Name Privilege Level Description
mstatus Machine Status Register Machine Holds global interrupt enable, previous privilege mode, etc.
mtvec Machine Trap-Vector Base Machine Holds the base address of the trap handler (exception/interrupt entry).
mepc Machine Exception PC Machine Stores the program counter at the time of the last trap.
mcause Machine Cause Register Machine Indicates the cause of the last trap (interrupt or exception).
satp Supervisor Address Translation and Protection Supervisor Controls page table base address and mode (e.g., Sv39, Sv48).
sstatus Supervisor Status Register Supervisor Like mstatus, but accessible from supervisor mode.
stvec Supervisor Trap-Vector Base Supervisor Like mtvec, but for supervisor mode traps.
sepc Supervisor Exception PC Supervisor Like mepc, but for supervisor mode.
scause Supervisor Cause Register Supervisor Like mcause, but for supervisor mode traps.
sscratch Supervisor Scratch Supervisor Can be used to store temporary state across traps in supervisor mode.
mscratch Machine Scratch Machine Like sscratch, but in machine mode.
mcycle Machine Cycle Counter Machine Counts the number of cycles executed.
mtime Machine Timer Register Machine (via memory-mapped) Used for timing and scheduling (not a CSR, but a memory-mapped register).
mip Machine Interrupt Pending Machine Indicates pending interrupts.
mie Machine Interrupt Enable Machine Controls which interrupts are enabled.