[rtems commit] cpukit/aarch64: Add explanation of exception flow

Joel Sherrill joel at rtems.org
Thu Dec 10 17:38:00 UTC 2020


Module:    rtems
Branch:    master
Commit:    d188e6e88233bd91da5f9985a89cf791cb4fd117
Changeset: http://git.rtems.org/rtems/commit/?id=d188e6e88233bd91da5f9985a89cf791cb4fd117

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Tue Dec  8 09:11:34 2020 -0600

cpukit/aarch64: Add explanation of exception flow

---

 cpukit/score/cpu/aarch64/aarch64-exception-default.S   | 17 ++++++++++++++++-
 cpukit/score/cpu/aarch64/aarch64-exception-interrupt.S |  4 ++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/cpukit/score/cpu/aarch64/aarch64-exception-default.S b/cpukit/score/cpu/aarch64/aarch64-exception-default.S
index 81aa825..970ccf7 100644
--- a/cpukit/score/cpu/aarch64/aarch64-exception-default.S
+++ b/cpukit/score/cpu/aarch64/aarch64-exception-default.S
@@ -54,7 +54,22 @@
 
 /*
  * This is the exception vector table and the pointers to the default
- * exceptions handlers.
+ * exceptions handlers. Each vector in the table has space for up to 32
+ * instructions. The space of the last two instructions in each vector is used
+ * for the exception handler pointer.
+ *
+ * The operation of all exceptions is as follows:
+ * * An exception occurs
+ * * A vector is chosen based on the exception type and machine state
+ * * Execution begins at the chosen vector
+ * * X0 and LR are pushed onto the current stack
+ * * An unconditional branch and link is taken to the next instruction to get
+ *   the PC
+ * * The exception handler pointer (EHP) is retrieved from the current vector using
+ *   the PC
+ * * Branch and link to the EHP
+ * * X0 and LR are popped from the current stack after returning from the EHP
+ * * The exception returns to the previous execution state
  */
 
 /*
diff --git a/cpukit/score/cpu/aarch64/aarch64-exception-interrupt.S b/cpukit/score/cpu/aarch64/aarch64-exception-interrupt.S
index f534a52..cb0954a 100644
--- a/cpukit/score/cpu/aarch64/aarch64-exception-interrupt.S
+++ b/cpukit/score/cpu/aarch64/aarch64-exception-interrupt.S
@@ -255,7 +255,7 @@ _AArch64_Exception_interrupt_nest:
 Save volatile regs on interrupt stack
 Execute irq handler
 Restore volatile regs from interrupt stack
-Exception return
+Return to embedded exception vector code
 */
 
 /* Push interrupt context */
@@ -281,7 +281,7 @@ Execute interrupt handler
 Switch to thread stack
 Call thread dispatch
 Restore volatile registers from thread stack
-Return to dispatch
+Return to embedded exception vector code
 */
 
 



More information about the vc mailing list