Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions src/aclic.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
----
Expand All @@ -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:

Expand All @@ -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
Expand Down