From d188e6e88233bd91da5f9985a89cf791cb4fd117 Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Tue, 8 Dec 2020 09:11:34 -0600 Subject: 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 81aa82558e..970ccf735f 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 f534a526b3..cb0954a29b 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 */ -- cgit v1.2.3