Skip to content

Commit

Permalink
Define the RV32-only hedelegh CSR
Browse files Browse the repository at this point in the history
  • Loading branch information
aswaterman committed Sep 5, 2023
1 parent 8f7d13d commit 98acd21
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
12 changes: 9 additions & 3 deletions src/hypervisor.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,11 @@ same endianness as HS-mode.

==== Hypervisor Trap Delegation Registers (`hedeleg` and `hideleg`)

Registers `hedeleg` and `hideleg` are HSXLEN-bit read/write registers,
formatted as shown in <<hedelegreg>> and
<<hidelegreg>> respectively. By default, all traps at
Register `hedeleg` is a 64-bit read/write register, formatted as shown in
<<hedelegreg>>.
Register `hideleg` is an HSXLEN-bit read/write register, formatted as shown in
<<hidelegreg>>.
By default, all traps at
any privilege level are handled in M-mode, though M-mode usually uses
the `medeleg` and `mideleg` CSRs to delegate some traps to HS-mode. The
`hedeleg` and `hideleg` CSRs allow these traps to be further delegated
Expand Down Expand Up @@ -303,6 +305,10 @@ Requiring that certain bits of `hedeleg` be writable reduces some of the
burden on a hypervisor to handle variations of implementation.
====

When XLEN=32, `hedelegh` is a 32-bit read/write register
that aliases bits 63:32 of `hedeleg`.
Register `hedelegh` does not exist when XLEN=64.

An interrupt that has been delegated to HS-mode (using `mideleg`) is
further delegated to VS-mode if the corresponding `hideleg` bit is set.
Among bits 15:0 of `hideleg`, bits 10, 6, and 2 (corresponding to the
Expand Down
6 changes: 3 additions & 3 deletions src/images/bytefield/hedelegreg.edn
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
(def right-margin 30)
(def boxes-per-row 32)

(draw-box "HSXLEN-1" {:span 16 :text-anchor "start" :borders{}})
(draw-box "63" {:span 16 :text-anchor "start" :borders{}})
(draw-box "0" {:span 16 :text-anchor "end" :borders{}})

(draw-box "Synchronous Exceptions" {:span 18 :text-anchor "end" :borders{:top :border-unrelated :bottom :border-unrelated :left :border-unrelated}})
(draw-box (text "(WARL)" { :font-weight "bold" :font-size 24}) {:span 14 :text-anchor "start" :borders{:top :border-unrelated :bottom :border-unrelated :right :border-unrelated}})

(draw-box "HSXLEN" {:span 32 :borders {}})
----
(draw-box "64" {:span 32 :borders {}})
----
10 changes: 7 additions & 3 deletions src/priv-csrs.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -438,25 +438,29 @@ Supervisor interrupt pending.
`0x603` +
`0x604` +
`0x606` +
`0x607`
`0x607` +
`0x612`
|HRW +
HRW +
HRW +
HRW +
HRW +
HRW +
HRW
|`hstatus` +
`hedeleg` +
`hideleg` +
`hie` +
`hcounteren` +
`hgeie`
`hgeie` +
`hedelegh`
|Hypervisor status register. +
Hypervisor exception delegation register. +
Hypervisor interrupt delegation register. +
Hypervisor interrupt-enable register. +
Hypervisor counter enable. +
Hypervisor guest external interrupt-enable register.
Hypervisor guest external interrupt-enable register. +
Additional hypervisor exception delegation register, RV32 only.

4+^|Hypervisor Trap Handling

Expand Down
2 changes: 1 addition & 1 deletion src/priv-preface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ version 1.12:

* Defined the `misa`.V field to reflect that the V extension has been
implemented.
* Defined the RV32-only `medelegh` CSR.
* Defined the RV32-only `medelegh` and `hedelegh` CSRs.
* Clarified semantics of explicit accesses to CSRs wider than XLEN bits.
* Clarified that MXLEN&#8805;SXLEN, and added the constraint that
SXLEN&#8805;UXLEN.
Expand Down

0 comments on commit 98acd21

Please sign in to comment.