From a1f49718aee378fa075303c86106309091d56b80 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Mon, 31 Jan 2022 19:05:50 -0700 Subject: Break exceptions off to own files --- src/exceptions/undefined.S | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/exceptions/undefined.S (limited to 'src/exceptions/undefined.S') diff --git a/src/exceptions/undefined.S b/src/exceptions/undefined.S new file mode 100644 index 0000000..b8eab29 --- /dev/null +++ b/src/exceptions/undefined.S @@ -0,0 +1,34 @@ +.section ".text.exceptions" +.globl undefined +undefined: + cpsid aif + stmfd sp!, {r0-r12,lr} + ldr r4, [lr, #-4] + mov r0, #0 + mov r1, #17 + ldr r2, =undefined_msg + bl draw_string + mov r0, #18 + mov r1, #17 + mov r2, r4 + bl draw_hex32 + mov r0, #27 + mov r1, #17 + ldr r2, =undefined_at + bl draw_string + // Output lr + mov r1, #0x1000 + ldr r0, [r1, #-4] + sub r2, r0, #4 + mov r0, #31 + mov r1, #17 + bl draw_hex32 + // Skip instruction for now + // In future, + // ldmfd sp!, {r0-r12,lr} // Note the lack of ^ since subs will handle it + // subs pc, lr, #4 + ldmfd sp!, {r0-r12,pc}^ + +.section .data +undefined_msg: .asciz "Undefined Handler" +undefined_at: .asciz "@ 0x" -- cgit v1.2.1