Appendix A — Glossary

Winter Semester 2026/2027

Author
Affiliation

Stavros Kousidis

ICCT

Short definitions of terms that the chapters use precisely. Each entry names the lecture where the term first matters. Terms that are easily confused point to each other with see also.

Architectural state
State that the ISA defines and that every implementation must provide, as opposed to details of the microarchitecture. The x registers, the CSRs and the pc are all architectural state. The pc differs from the others in one respect: it is not addressable. No instruction names it as an operand or stores it to memory; it changes only through control transfers and the trap rule. See also: program counter, live pc. (Lecture 5)
Automatic storage duration
The lifetime of an ordinary local variable, declared inside a function without static. The object exists only while that call is active and lives in the call’s stack frame; every call, including a recursive one, gets its own copy. When the call returns, or when its stack frame is reused, the object is gone. Example: struct process p; inside main() in Exercise 2 lies in main()’s stack frame at the top of the OS stack. See also: static storage duration. (Lecture 4)
Bootstrap function
The internal function through which a process is entered for the first time: process_start(). It calls the process’s entry function and, if that returns, process_exit(0). The initial saved state of a new process points to it, as ra in the CP1 context and as pc in the trap frame. (Lecture 3)
Caller and callee
In a function call, the caller is the function that makes the call, the callee the function being called. The calling convention splits the work of preserving registers between them. See also: calling convention, caller-saved and callee-saved register. (Lecture 3; named explicitly in Lecture 5)
Caller-saved and callee-saved register
A callee-saved register is one whose value a called function must preserve for its caller: sp and s0–s11. A caller-saved register may be destroyed by a call, so the caller keeps any value it still needs elsewhere: t0–t6 and a0–a7, and ra, which every call overwrites. The split is why CP1’s context_switch() could save only ra, sp and s0–s11. See also: calling convention. (Lecture 3)
Calling convention
The software agreement, defined in the RISC-V ABI, that lets separately compiled functions cooperate about how registers are used: arguments in a0–a7, the return value in a0, the return address in ra, and which registers are caller-saved or callee-saved. The compiler guarantees it for the code it generates; hand-written assembly must keep it itself, and the hardware knows nothing of it. A trap is not a call, so the convention gives no guarantee at a trap. (Lecture 3)
CLINT (core-local interruptor)
The timer device of QEMU’s virt machine, a part of the platform, not of the CPU. It holds the memory-mapped registers mtime and mtimecmp and requests a machine timer interrupt from the CPU while mtime >= mtimecmp. Newer RISC-V documents call it ACLINT. See also: mtime and mtimecmp, platform. (Lecture 6)
Context
The saved CPU register state needed to continue the same execution. The CP1 struct context holds ra, sp and s0–s11, which suffices at a call boundary. From Lecture 5 the trap frame is the context, complete for our model. See also: trap frame, context switch. (Lecture 3)
Context switch
In CP1: save the current execution’s context, restore another saved context, and continue the restored execution. context_switch() did both halves in one function called by the running code; from Lecture 5 the trap path saves and the return path restores. (Lecture 3)
Continuation address
A saved value saying where an execution continues when it is restored. It is never the live pc itself. In CP1 it is ra in the context; in the trap frame it is the field pc. After an interrupt it equals the trap pc; after an ecall it is the trap pc + 4. See also: live pc, trap pc. (Lecture 4)
Control and status register (CSR)
A CPU register outside the general-purpose registers x0–x31, reachable only through the CSR instructions of the Zicsr extension, not through loads and stores. Our trap mechanism uses five: mtvec (where traps enter: a base address and a mode field), mepc (the trap pc), mcause (the reason, with the interrupt bit in bit 63), mstatus (among others MIE, MPIE, MPP), and mscratch (no meaning for the hardware; our OS keeps the current frame’s address there). Lecture 6 adds mie (one enable bit per interrupt source, among them MTIE for the machine timer) and mip (the pending bits, among them MTIP). The prefix m means machine mode. (Lecture 5; Lecture 6)
Cooperative and non-cooperative entry
An entry into the OS is cooperative if the running execution itself decides to make it, as with process_yield() in CP1 or ecall in Lecture 5. It is non-cooperative if the OS is entered without the execution’s intention, as with an illegal instruction or, from Lecture 6, a timer interrupt. This axis is separate from synchronous versus asynchronous: an illegal instruction is synchronous but not cooperative. See also: synchronous and asynchronous trap, preemption. (Lecture 3; Lecture 5)
Cross-compilation
Building code on one architecture for another. A cross compiler runs on the development host, an x86-64 or ARM machine, and produces RV64 code for the target. (Lecture 1)
Development host
The machine on which the development tools run: in BVS1 the Ubuntu bvs1 VM. See also: physical host, target. (Lecture 1)
ELF (Executable and Linkable Format)
The binary file format we use for both object files and the final executable. An ELF file contains sections, a symbol table and the entry address. (Lecture 1)
Exception
A synchronous trap: caused by the instruction being executed, at the same instruction every time the program runs with the same input. The trap pc is that instruction. Examples: ecall (mcause 11 from machine mode), illegal instruction (mcause 2). Not an interrupt. See also: interrupt, trap. (Lecture 5)
Execution
A running sequence of instructions together with the CPU and memory state it needs to continue. Two executions take turns when one stops and another continues; a process is an execution that the OS manages. In CP1 main() was an execution too, suspended while the process ran; from Lecture 5 nothing of the OS remains suspended between traps. See also: process. (Lecture 2)
Exit
The process finishes, records a result, and returns control to the operating system; it must never continue. From Lecture 5 process_exit() makes the system call exit. See also: yield. (Lecture 2; Lecture 3)
Idle process
The process the OS runs when no other process is READY. In the reference implementation it is a loop around wfi (wait for interrupt); after the last process has exited, the OS returns into its frame. (Lecture 5)
Immediate
A value small enough to be encoded inside an instruction, for example in li or addi. Larger values may need several instructions. (Lecture 4)
Instruction Set Architecture (ISA)
The contract between software and a processor: the instructions, registers and behaviour that every implementation provides and that software may rely on. The trap rule and the CSRs belong to it. See also: microarchitecture, platform. (Lecture 1)
Interrupt
An asynchronous trap: caused by an event independent of the current instruction and taken between two instructions, so the place varies from run to run. The trap pc is the instruction that was about to execute and has not executed yet; there is no +4. Interrupts are taken only when enabled; on a trap the CPU disables them while the OS saves the process’s state. Not an exception: an ecall is not an interrupt. See also: exception, pending, timer interrupt, trap. (Lecture 4; as a kind of trap in Lecture 5)
Label
A name in assembly source, written as name:, that names the position of the next instruction or data item. Labels exist only in source code. The assembler turns a named label such as _start: or trap_entry: into a symbol; a local label such as 1: in start.S is used only within its file and does not appear in the symbol table. trap_entry: in trap.S names the first instruction of the trap path. Not to be confused with an output label, the constant text that a program prints before a value, such as "process: result: ". See also: symbol. (Lecture 2)
Lifecycle state
Says whether an execution may run: READY, RUNNING or FINISHED. The context says how it continues. (Lecture 3)
Linker
The tool that combines object files, resolves references between them by symbol name, and places their sections at final addresses in target memory. (Lecture 1; Lecture 2)
Linker script
The file that tells the linker where the sections go in target memory and defines symbols such as _stack_top. Ours is linker.ld; students read it but do not write one. (Lecture 2)
Live pc
The current execution position of the CPU: the pc as architectural state. Software never stores it directly; the CPU copies it into mepc on a trap, and mret sets it from mepc. See also: trap pc, continuation address. (Lecture 4; named in Lecture 5)
Machine mode
The most privileged RISC-V privilege mode (M-mode). Our whole system, OS and processes alike, runs in it, which is why our CSRs carry the prefix m and ecall produces mcause 11. See also: privilege mode. (Lecture 5)
Memory-mapped register
A device register that has an address in the same address space as RAM, so that an ordinary load or store to that address reads or writes the device instead of memory. In C it is reached through a volatile pointer, so that the compiler performs every access as written. Examples: the UART’s transmit and status registers at 0x10000000 and 0x10000005, mtime and mtimecmp. The platform decides which address leads to RAM and which to a device; on QEMU virt, RAM starts at 0x80000000. CSRs are not memory-mapped: they have no address. See also: control and status register. (Lecture 6)
Microarchitecture
How a particular processor implements the ISA internally, for example its pipeline or caches. Software written for the ISA does not depend on it. See also: ISA. (Lecture 1)
mtime and mtimecmp
The two 64-bit memory-mapped registers of the CLINT. mtime (at 0x0200bff8 on QEMU virt) is the current time; the device counts it up from 0 at machine start at 10 MHz, one count every 100 ns, and it never stops. mtimecmp (for hart 0 at 0x02004000) holds a point in time, not a duration: while mtime >= mtimecmp, a timer interrupt is pending. timer_arm(delta) writes mtime + delta into mtimecmp. See also: CLINT, pending, time slice. (Lecture 6)
Object file
A target-specific intermediate file produced by the compiler or assembler, in ELF, that still needs to be linked with others into an executable. (Lecture 1)
Operating system
Software that helps turn hardware into a usable computer system by providing abstractions, resource management, coordination, protection, and services for programs and users. Two views: the OS as resource manager and the OS as abstract machine. (Lecture 1)
OS stack
The stack on which the OS’s own code runs: the region that the linker script reserves below _stack_top. _start selects it, and main() has run on it since Lecture 2. From Lecture 5 the trap path switches to it explicitly with la sp, _stack_top, so every handler run starts at its top; anything that must outlive one handler run must not live there. See also: process stack. (Lecture 4)
Pending
An interrupt is pending when its source has requested it and the request has not been withdrawn; it is enabled when the CPU’s enable bits allow it, and taken when the CPU applies the trap rule. The machine timer interrupt is pending in mip.MTIP while mtime >= mtimecmp; it stays pending until the OS writes a larger mtimecmp, and taking it does not clear it. It is taken only if mie.MTIE and mstatus.MIE are also set. See also: interrupt, mtime and mtimecmp. (Lecture 6)
Physical host
The real computer that provides the CPU, memory and devices, and on which the development VM runs. See also: development host, target. (Lecture 1)
Platform
The machine around the CPU: memory map and devices such as the UART and, in Lecture 6, the timer. QEMU’s virt machine is our platform. A platform device raises an interrupt; the CPU’s trap rule reacts to it. See also: ISA. (Lecture 5)
Polling
Asking a device again and again whether it is ready, in a loop, until it is. uart_putc() polls the UART’s line status register before each character. See also: memory-mapped register, UART. (Lecture 6)
Preemption
The OS takes control without the running process’s cooperation, made possible by a timer interrupt. Interrupt handling and the scheduling decision that may follow are related but distinct steps. In our system from Lecture 6, the timer interrupt enters the OS every time slice; with one process, the scheduling decision returns the same frame. See also: cooperative and non-cooperative entry, time slice. (Lecture 4; Lecture 6)
Privilege mode
A CPU mode that determines which instructions, CSRs and memory are available. RISC-V defines machine, supervisor and user mode; a real OS runs processes in a less privileged mode, so that they cannot change OS state. Privilege is outside our model: everything runs in machine mode. See also: machine mode. (Lecture 5)
Process
An execution that the operating system can manage. In our system it combines an entry function, owned stack storage, a saved context (from Lecture 5 the trap frame), a lifecycle state and an exit status. See also: execution. (Lecture 2; Lecture 3)
Process stack
The stack of one process: owned stack storage, in our system the array stack inside struct process, which sp selects while the process runs. “Process stack” names the role of the memory, not an ELF section: the array lies wherever the process object lies. See also: OS stack. (Lecture 3; Lecture 4)
Program counter (pc)
Identifies the instruction to execute. It is CPU state, not memory, and not one of the general-purpose registers x0–x31. See also: architectural state, live pc. (Lecture 4)
Pseudoinstruction
Assembler notation that is not itself an instruction but is translated into one or more real instructions. Examples: li, mv, j, ret (jalr x0, 0(ra)), and the CSR forms csrr, csrw and csrs, which become csrrs or csrrw. (Lecture 5)
QEMU
An emulator and virtualizer. It runs as an ordinary program in the development VM and emulates the RV64 target machine; we start it without firmware (-bios none). (Lecture 1)
Resume
Continue a paused execution where it stopped, as opposed to starting it again from its entry function. From the CPU’s point of view, resuming and starting a process are the same operation: a return into a saved frame. (Lecture 3)
Return path
The second half of the provided trap.S, from the label os_start to mret: it makes mscratch point to the frame it restores, writes the frame’s pc into mepc, loads the registers and executes mret. It has two ways in: after every trap, by falling through from call trap_handler, and once from os_run() for the first start. See also: trap path. (Lecture 5)
Return-address register
ra (x1): a call stores the location to which execution returns, and ret jumps there. It is the continuation of a call. (Lecture 3)
RV64
The 64-bit form of RISC-V, the ISA of our target. We build for rv64imac_zicsr: the base integer instructions, multiplication and division, atomics and compressed instructions, plus the CSR instructions. (Lecture 1)
Section
A named part of an object file or executable that groups content of one kind; the linker places sections in memory according to the linker script. .text holds instructions, .rodata constant data, .data initialised data, and .bss zero-initialised data, which takes no space in the file. (Lecture 2)
Stack
Runtime memory for the data of active function calls: saved call information, saved registers, local variables. Function instructions remain in .text. A stack grows toward lower addresses. See also: stack frame, OS stack, process stack. (Lecture 2; Lecture 3)
Stack frame
The call data of one active call on a stack, for example its saved ra, saved registers and local variables. Not a trap frame. See also: trap frame. (Lecture 4)
Stack pointer (sp)
Register x2; selects the current position in the stack in use. Which stack is in use is decided by the value in sp: a trap does not change it. (Lecture 2; Lecture 4)
Static storage duration
The lifetime of global variables and of variables declared static, also inside a function. The object exists exactly once, for the whole run, independent of any stack frame and of which functions are active; it is initialised once, before the program runs. Its section depends on the initial value: .bss for no initialiser or zero, .data for a non-zero initialiser, .rodata for const data. static inside a function changes only where and how long the object lives; the name stays visible only inside that function. Example: static struct process p; in main() lies in .bss and survives every trap. See also: automatic storage duration. (Lecture 4; static p in Lecture 5)
Symbol
An entry in the symbol table of an object file or an ELF file: a name with a value, usually an address, plus a type and a visibility. nm -n lists the symbols of a program sorted by address. Symbols come from labels in assembly, from C functions and from C variables with static storage, for which the compiler emits labels, or from assignments in the linker script. Example: trap_entry comes from a label, main from a C function, _stack_top from linker.ld. The linker resolves references between separately translated parts by symbol name, and fixes the final address of every symbol when it places the sections. See also: label. (Lecture 2; nm -n in Lecture 4)
Synchronous and asynchronous trap
A synchronous trap is caused by the instruction being executed and is reproducible: an exception. An asynchronous trap is caused by an event outside the instruction stream and is taken between two instructions, wherever the program happens to be: an interrupt. See also: exception, interrupt, cooperative and non-cooperative entry. (Lecture 5)
System call
A request to the OS made with ecall. In our convention a7 selects the service, a0 and a1 carry arguments, and the OS may return a result in a0: exit is 0, yield is 1. The system call is the request, not the C function that makes it: process_yield() makes the system call yield. (Lecture 5)
Target
The machine for which we build the program: an RV64 machine, emulated by QEMU. See also: development host, physical host. (Lecture 1)
Tick
One timer interrupt of the OS, as in the Exercise 5 library’s lines os: tick N at <pc> in process 1. Not one count of mtime: that is why timer_arm() takes a delta and the time slice is called TIME_SLICE, both in mtime counts. See also: time slice, timer interrupt. (Lecture 6)
Time slice
How long the OS lets a process run until the next timer interrupt; other books call it a quantum. In our system 10 ms, TIME_SLICE = TIMER_HZ / 100 = 100,000 mtime counts. See also: tick, preemption. (Lecture 6)
Timer interrupt
An interrupt raised by the platform’s timer when a programmed time is reached (mcause 7 with the interrupt bit set). It lets the OS regain control without a voluntary yield. In our system the CLINT requests it when mtime reaches mtimecmp; the trap pc is the instruction not yet executed, and the handler re-arms the timer before it returns a frame. See also: pending, tick. (Lecture 4; implemented in Lecture 6)
Toolchain
The set of cooperating build tools: compiler, assembler and linker, here for the RV64 target. (Lecture 1)
Trap
A transfer of control to an OS-defined handler that the CPU performs itself. On a trap the CPU records where (mepc) and why (mcause), turns interrupts off (MPIE <- MIE, MIE <- 0) and jumps to mtvec. The umbrella term for exceptions and interrupts. See also: exception, interrupt, return path. (Lecture 5)
Trap frame
The complete saved integer context of an execution that trapped, as our teaching model requires it: struct trap_frame, with the 31 writable integer registers in regs[1]–regs[31] and the continuation address in pc. It is the field frame of struct process, not on any stack; the name comes from systems that push it onto a stack. See also: stack frame, context. (Lecture 5)
Trap handler
The OS code that runs after a trap. In the course it is the C function trap_handler(), which the trap path calls with the frame of the process that trapped and which returns the frame to restore: the same one to resume, another one to schedule. In lifetime diagrams, “handler” labels the whole OS run between a trap and a return. See also: trap path, return path. (Lecture 5)
Trap path
The first half of the provided trap.S, from the label trap_entry to call trap_handler: it saves all registers and the trap pc into the frame that mscratch points to, switches to the OS stack and calls trap_handler(). The CPU jumps to it via mtvec; nobody calls it. See also: return path. (Lecture 5)
Trap pc
Course term, not a RISC-V name: the pc value that the CPU records in mepc on trap entry. For an exception it is the causing instruction, for an ecall the ecall itself; for an interrupt it is the next instruction, not yet executed. See also: live pc, continuation address. (Lecture 5)
UART
The serial device of our platform through which all output of the course is printed; on QEMU virt its registers start at 0x10000000. uart_putc() polls its line status register and stores each character into its transmit register, with ordinary loads and stores. See also: memory-mapped register, polling, platform. (Lecture 6)
Yield
The running process voluntarily returns control to the operating system while remaining able to resume later. From Lecture 5 process_yield() makes the system call yield. See also: exit. (Lecture 2; Lecture 3)