diff options
author | Ian Moffett <ian@osmora.org> | 2025-06-19 00:53:55 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-06-19 00:53:55 -0400 |
commit | caad8df87d20c5949ef4c1190bc5a63ccf75dc05 (patch) | |
tree | 9aa3abd04a4797dfbeb1a82820a2367bfb5a9371 /sys/include/arch/aarch64/frameasm.h | |
parent | 1a3e39cd28f90754c3927dabe32a37836db3f8d5 (diff) |
kernel/aarch64: Add exception code + frame fixups
- Add handle_exception() as higher level logic to handle the exceptions
- Simplify frame.h
- Call C handler in vector.S
- Clean up stack after creating frame
- Add register dump on exception
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include/arch/aarch64/frameasm.h')
-rw-r--r-- | sys/include/arch/aarch64/frameasm.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/include/arch/aarch64/frameasm.h b/sys/include/arch/aarch64/frameasm.h index 5664ff5..ca7f81a 100644 --- a/sys/include/arch/aarch64/frameasm.h +++ b/sys/include/arch/aarch64/frameasm.h @@ -31,13 +31,14 @@ #define _MACHINE_FRAMEASM_H_ /* XXX: Must be 16-byte aligned!!! */ -#define XFRAME_STACK_SIZE (34 * 8) +#define XFRAME_STACK_SIZE (38 * 8) /* Trap numbers */ -#define TRAPNO_XSYNC #0 /* Synchronous */ -#define TRAPNO_XIRQ #1 /* IRQ */ -#define TRAPNO_XFIQ #2 /* FIQ */ -#define TRAPNO_XSERR #3 /* System error */ +#define TRAPNO_UNKNOWN #0 +#define TRAPNO_XSYNC #1 /* Synchronous */ +#define TRAPNO_XIRQ #2 /* IRQ */ +#define TRAPNO_XFIQ #3 /* FIQ */ +#define TRAPNO_XSERR #4 /* System error */ #define PUSH_XFRAME(TRAPNO) \ sub sp, sp, #XFRAME_STACK_SIZE ; \ @@ -57,11 +58,16 @@ stp x4, x3, [sp, #(26 * 8)] ; \ stp x2, x1, [sp, #(28 * 8)] ; \ str x0, [sp, #(30 * 8)] ; \ + ; \ + mrs x0, elr_el1 ; \ + str x0, [sp, #(31 * 8)] ; \ + mrs x0, esr_el1 ; \ + str x0, [sp, #(32 * 8)] ; \ mov x0, TRAPNO ; \ - str x0, [sp, #(31 * 8)] + str x0, [sp, #(33 * 8)] ; \ + mov x0, sp #define POP_XFRAME() \ - add sp, sp, #8 ; \ ldr x0, [sp, #(30 * 8)] ; \ ldp x2, x1, [sp, #(28 * 8)] ; \ ldp x4, x3, [sp, #(26 * 8)] ; \ @@ -78,5 +84,6 @@ ldp x26, x25, [sp, #(4 * 8)] ; \ ldp x28, x27, [sp, #(2 * 8)] ; \ ldp x30, x29, [sp, #(0 * 8)] ; \ + add sp, sp, #XFRAME_STACK_SIZE #endif /* !_MACHINE_FRAMEASM_H_ */ |