Merge branch 'master' of https://spacebeaker.googlesource.com/shodan/sw/vec into vector_test
Change-Id: I13979c48cda162b959fecc8b97b9df0b5775ba99
diff --git a/springbok/crt0.S b/springbok/crt0.S
index 7e3ba79..f9e46f6 100644
--- a/springbok/crt0.S
+++ b/springbok/crt0.S
@@ -246,13 +246,15 @@
.weak exception_handler
exception_handler:
- .word 0x0000307B # finish (encoded as custom3<func3=3>)
li t4, 0 # ERROR logging level
- li t5, 0 # Return 0
- la a0, exception_msg
+ la a0, exception_msg
csrr t5, mcause
.word 0x001E50EFB # simprint t4, a0, t5 (encoded as custom3<func3=0>)
call print_csrs
+ # Store the return value as mcause to be used in _finish
+ mv a0, t5
+ # Clear the stack
+ la sp, _stack_ptr
j _finish
.weak print_csrs