Skip to content

Instantly share code, notes, and snippets.

@karaketir16
Created February 23, 2025 14:18
Show Gist options
  • Save karaketir16/6f7ddbc25be2bc2bd4379b3bb42c8051 to your computer and use it in GitHub Desktop.
Save karaketir16/6f7ddbc25be2bc2bd4379b3bb42c8051 to your computer and use it in GitHub Desktop.

The machine level has the highest privileges and is the only mandatory privilege level for a RISC-V hardware platform. Code run in machine-mode (M-mode) is usually inherently trusted, as it has low-level access to the machine implementation. M-mode can be used to manage secure execution environments on RISC-V. User-mode (U-mode) and supervisor-mode (S-mode) are intended for conventional application and operating system usage respectively.

The lock feature of the optional PMP facility can provide some limited protection even with only M-mode implemented.

The SYSTEM major opcode is used to encode all privileged instructions in the RISC-V ISA. These can be divided into two main classes: those that atomically read-modify-write control and status registers (CSRs), which are defined in the Zicsr extension, and all other privileged instructions. The privileged architecture requires the Zicsr extension; which other privileged instructions are required depends on the privileged-architecture feature set.

#TODO 0x180 SRW satp Supervisor address translation and protection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment