Five EmbedDev logo Five EmbedDev

An Embedded RISC-V Blog
RISC-V External Debug Support

A virtual register is one that doesn’t exist directly in the hardware, but that the debugger exposes as if it does. Debug software should implement them, but hardware can skip this section. Virtual registers exist to give users access to functionality that’s not part of standard debuggers without requiring them to carefully modify debug registers while the debugger is also accessing those same registers.

Address Name Page
virtual Privilege Level (priv)

Privilege Level (priv, at virtual)

[virtPriv] Users can read this register to inspect the privilege level that the hart was running in when the hart halted. Users can write this register to change the privilege level that the hart will run in when it resumes.

This register contains from , but in a place that the user is expected to access. The user should not access directly, because doing so might interfere with the debugger.

Encoding Privilege Level
0 User/Application
1 Supervisor
3 Machine

image

Field Description Access Reset
[virtPrivPrv] |prv| Contains the privilege level the hart was operating in when Debug Mode was entered. The encoding is described in Table [tab:privlevel], and matches the privilege level encoding from the Privileged Spec. A user can write this value to change the hart’s privilege level when exiting Debug Mode. R/W 0