Skip to content

Commit e9626d5

Browse files
committed
sw: Fix runtime routine
Fix runtime exit routine not recovering return address correctly
1 parent 9974c6a commit e9626d5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sw/snRuntime/src/platforms/cheshire/start_snitch.S

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,17 @@ _snrt_exit:
2525
# - a0: global core index
2626
# - t0: exit code
2727
bnez a0, 1f
28+
addi sp, sp, -8
29+
sw a0, 0(sp)
30+
sw ra, 4(sp)
31+
2832
slli t0, t0, 1
2933
ori t0, t0, 1
3034
mv a0, t0
3135
call snrt_set_eoc_and_return_code
36+
37+
lw t0, 0(sp)
38+
lw ra, 4(sp)
39+
addi sp, sp, 8
40+
3241
1: ret

0 commit comments

Comments
 (0)