diff --git a/src/aclic.adoc b/src/aclic.adoc index 8cd8b51..7e1bda0 100644 --- a/src/aclic.adoc +++ b/src/aclic.adoc @@ -1044,9 +1044,9 @@ Once the instruction retires, or the interrupts are disabled, no late preemption === Stack layout -To ease debugging, a stack layout is recommended for the saved context. - -NOTE: This stack layout is not mandated to allow e.g. shadow register sets +Trap handlers may need to access stacked context. +E.g. an ECALL handler needs to increment the epc value by 4 to avoid re-executing the ECALL instruction. +To simplify access to the stacked context, the stack layout is defined as follows. [source] ---- @@ -1056,23 +1056,23 @@ NOTE: This stack layout is not mandated to allow e.g. shadow register sets stack pointer adjustment: 32 -24: x15 -20: x14 -16: x13 -12: x12 -8: x11 -4: x10 +-24: x15 +-20: x14 +-16: x13 +-12: x12 + -8: x11 + -4: x10 ** XLEN = 64: stack pointer adjustment: 48 -48: x15 -40: x14 -32: x13 -24: x12 -16: x11 -8: x10 +-48: x15 +-40: x14 +-32: x13 +-24: x12 +-16: x11 + -8: x10 * Smnip/Ssnip present: @@ -1082,15 +1082,15 @@ start of stackframe remains same. In addition: stack pointer adjustment: 32 -32: xpistatus (XLEN) -28: xpepc (XLEN) +-32: xpistatus (XLEN) +-28: xpepc (XLEN) -** XLEN = 32 +** XLEN = 64 stack pointer adjustment: 64 -60: xpistatus (XLEN) -56: xpepc (XLEN) +-64: xpistatus (XLEN) +-56: xpepc (XLEN) ---- === Fault handling