Shenzhen, 2024

2024.09.02

寄存器

大部分 pc 的寄存器都是暴露给汇编访问的,但是 RISC-V 的寄存器是隐藏的。只能通过特殊的方式来访问。

HART

HART = HARdware Thread

Privileged Level

根据不同的场景,最少需要实现 Machine 级别。

LevelEncodingNameAbbreviation
000User/ApplicationU
101SupervisorS
210Reserved
311MachineM

在不同的级别下,有一套独立的寄存器。 Control and Status Registers(CSR)

内存管理与保护

  1. 物理内存保护(PMP), 允许 M 模式指定 U 模式可访问的内存地址。 支持 R/W/X, 以及 Lock
  2. 虚拟内存, 需要支持 S Level

Exception, Interrupt

  • ”an unusual condition occurring at run time associated with an instruction in the current RISC-V hart"
  • "an external asynchronous event unexpected transfer of control”

需要按照规范实现对应的处理