Skip to content

Commit

Permalink
fix(mips): store copy of $ra after Context
Browse files Browse the repository at this point in the history
  • Loading branch information
SK83RJOSH committed Jan 10, 2024
1 parent 477582b commit 988a398
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/unwinder/arch/mips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,16 +337,17 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p
asm!(
"
move $t0, $sp
add $sp, $sp, -0x100
add $sp, $sp, -0x110
sw $ra, 0x100($sp)
",
code!(save_gp),
code!(save_fp),
"
move $t0, $a0
move $a0, $sp
jalr $t0
lw $ra, 0x7C($sp)
add $sp, $sp, 0x100
lw $ra, 0x100($sp)
add $sp, $sp, 0x110
jr $ra
",
options(noreturn)
Expand All @@ -355,15 +356,16 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p
asm!(
"
move $t0, $sp
add $sp, $sp, -0x80
add $sp, $sp, -0x90
sw $ra, 0x80($sp)
",
code!(save_gp),
"
move $t0, $a0
move $a0, $sp
jalr $t0
lw $ra, 0x7C($sp)
add $sp, $sp, 0x80
lw $ra, 0x80($sp)
add $sp, $sp, 0x90
jr $ra
",
options(noreturn)
Expand Down

0 comments on commit 988a398

Please sign in to comment.