RISC-V Design ยท All levels

Privilege Levels, Execution Modes, and Delegation Boundaries: Mechanism

Mechanism for Privilege Levels, Execution Modes, and Delegation Boundaries.

Mechanism to understand

Mechanism for Privilege Levels, Execution Modes, and Delegation Boundaries is anchored on Privilege-transition latency and number of unauthorized accesses blocked by PMP/page-permission checks per billion instructions.. Convert observations into mechanism-backed decisions with explicit ownership.

RISC-V privileged architecture separates software responsibilities across machine mode (M), supervisor mode (S), and user mode (U), with optional hypervisor virtualization layering for host and guest control. M-mode owns platform bring-up and root control, while S-mode runs the operating system and U-mode executes applications under constrained permissions. Security and correctness hinge on explicit delegation and filtering: machine-level registers such as medeleg/mideleg can route selected traps to S-mode, while PMP and page-table permissions ensure each mode only touches approved address regions. Robust implementations also define deterministic rules for mode transitions during interrupts, exceptions, and system calls so return paths cannot leak privilege or corrupt architectural state.

  • Name first failing path and trigger condition.

  • Prove path loss with one measurable artifact.

  • Assign owner who can deliver smallest reversible fix.

Pipeline mechanism sketch

diagram
RISC-V PIPELINE DIAGRAM - Privilege Levels, Execution Modes, and Delegation Boundaries

PC -> IF -> ID -> EX -> MEM -> WB
      |     |      |      |      |
  i-cache decode  ALU/BR  LSU    regfile write
              \   |
               +-> branch resolve + redirect

Hot paths:
  - branch + load-use dependencies in ID/EX
  - memory latency stretching MEM stage
  - writeback arbitration for integer/vector units

Focus: keep control hazards predictable

Decode intent map

diagram
DECODE CONTROL MAP - Privilege Levels, Execution Modes, and Delegation Boundaries

opcode/funct3/funct7      controls asserted
-----------------------   ---------------------------------------
LUI / AUIPC               rd_write, imm_select(U), alu_add_pc
JAL / JALR                rd_write, pc_redirect, link_write
BRANCH                    cmp_enable, branch_type, pc_redirect
LOAD                      mem_read, rd_write, wb_sel(memory)
STORE                     mem_write, store_size, addr_calc
OP-IMM                    alu_enable, imm_select(I), rd_write
OP                        alu_enable, src2_reg, rd_write
SYSTEM / CSR              csr_readwrite, trap_check, privilege_gate
VECTOR (V extension)      vdecode, lane_mask, vtype_update