sw: Move the exception message out of rodata Per offline discussion as well as https://spacebeaker-review.googlesource.com/c/shodan/sw/vec/+/8841/comments/e8cdd665_0d2807c6, move the string to be embedded as immediate data. Change-Id: Idd427a1ddf735b7b47e2aa6b265fedd9b1585379
diff --git a/springbok/crt0.S b/springbok/crt0.S index f9e46f6..d4ce006 100644 --- a/springbok/crt0.S +++ b/springbok/crt0.S
@@ -246,13 +246,27 @@ .weak exception_handler exception_handler: - li t4, 0 # ERROR logging level - la a0, exception_msg - csrr t5, mcause - .word 0x001E50EFB # simprint t4, a0, t5 (encoded as custom3<func3=0>) + # Exception occurred + li t0, 0x65637845 # "Exce" + li t1, 0x6f697470 # "ptio" + li t2, 0x636f206e # "n oc" + li t3, 0x72727563 # "curr" + li t4, 0x00006465 # "ed\0\0" + addi sp, sp, -20 + sw t0, 0(sp) + sw t1, 4(sp) + sw t2, 8(sp) + sw t3, 12(sp) + sw t4, 16(sp) + csrr a0, mcause + li t6, 0 # ERROR logging level + .word 0x00A10FFB # simprint t6, sp, a0 (encoded as custom3<func3=0>) + addi sp, sp, 20 + # Store mcause as the reture value + mv s0, a0 call print_csrs - # Store the return value as mcause to be used in _finish - mv a0, t5 + # Restore the return value to be used in _finish + mv a0, s0 # Clear the stack la sp, _stack_ptr j _finish @@ -260,7 +274,3 @@ .weak print_csrs print_csrs: mret - -.section ".rodata","a",@progbits -exception_msg: - .string "Exception occurred\0"