Skip to content

Commit

Permalink
AR: Clarify mcontext/hcontext.
Browse files Browse the repository at this point in the history
It was a bit confusing before. Hopefully now it's more clear how they
relate, and why you might want each one.
  • Loading branch information
timsifive committed Sep 20, 2023
1 parent f546ddf commit 1ff5d6e
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions xml/hwbp_registers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,13 @@
</register>

<register name="Hypervisor Context" short="hcontext" address="0x6a8">
This optional register is only accessible in S/HS-mode, M-mode and
Debug Mode.
This optional register may only be implemented if the H extension is
implemented. If it is implemented, \RcsrMcontext must also be implemented.

Accessibility of this CSR is controlled by \Rmstateenzero[57]
in the Smstateen extension.
This register is only accessible in S/HS-Mode, M-mode and Debug Mode.

If the H extension is not implemented then this register is not
implemented, though the underlying state may be accessible via
the optional \RcsrMcontext alias.
if Smstateen is implemented, then accessibility of this CSR in S/HS-Mode
is controlled by \Rmstateenzero[57].

<field name="hcontext" bits="XLEN-1:0" access="WARL" reset="0">
Hypervisor mode software can write a context number to this register,
Expand Down Expand Up @@ -262,8 +260,22 @@
</register>

<register name="Machine Context" short="mcontext" address="0x7a8">
This optional register is an alias for \RcsrHcontext and is only
accessible in M-mode and Debug mode.
This register must be implemented if \RcsrHcontext is implemented, and
is optional otherwise. It is only accessible in M-mode and Debug mode.

This register provides access to the \FcsrHcontextHcontext field, even
if the \RcsrHcontext register is not implemented.

\begin{commentary}
\FcsrHcontextHcontext is primarily useful to set triggers on
hypervisor systems that only fire when a given VM is executing. It
is also useful in systems where M-Mode implements something like a
hypervisor directly.
\end{commentary}

<field name="mcontext" bits="XLEN-1:0" access="WARL" reset="0">
This field is an alias for \FcsrHcontextHcontext.
</field>
</register>

<register name="Machine Supervisor Context" short="mscontext" address="0x7aa">
Expand Down

0 comments on commit 1ff5d6e

Please sign in to comment.