From 988a398ef08e8e0d931a157820438529fc401c08 Mon Sep 17 00:00:00 2001 From: SK83RJOSH Date: Wed, 10 Jan 2024 18:48:01 +0100 Subject: [PATCH] fix(mips): store copy of `$ra` after `Context` --- src/unwinder/arch/mips.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/unwinder/arch/mips.rs b/src/unwinder/arch/mips.rs index f99da61..7d61243 100644 --- a/src/unwinder/arch/mips.rs +++ b/src/unwinder/arch/mips.rs @@ -337,7 +337,8 @@ 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), @@ -345,8 +346,8 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p 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) @@ -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)