diff --git a/src/unwinder/arch/aarch64.rs b/src/unwinder/arch/aarch64.rs index f65332c..28b740c 100644 --- a/src/unwinder/arch/aarch64.rs +++ b/src/unwinder/arch/aarch64.rs @@ -94,8 +94,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p } } -#[naked] -pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { +pub unsafe fn restore_context(ctx: &Context) -> ! { unsafe { asm!( " @@ -136,6 +135,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { ldp x0, x1, [x0, 0x00] ret ", + in("x0") ctx, options(noreturn) ); } diff --git a/src/unwinder/arch/riscv32.rs b/src/unwinder/arch/riscv32.rs index 45b8753..bebd390 100644 --- a/src/unwinder/arch/riscv32.rs +++ b/src/unwinder/arch/riscv32.rs @@ -214,8 +214,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p } } -#[naked] -pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { +pub unsafe fn restore_context(ctx: &Context) -> ! { #[cfg(target_feature = "d")] unsafe { asm!( @@ -225,6 +224,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { lw a0, 0x28(a0) ret ", + in("a0") ctx, options(noreturn) ); } @@ -236,6 +236,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { lw a0, 0x28(a0) ret ", + in("a0") ctx, options(noreturn) ); } diff --git a/src/unwinder/arch/riscv64.rs b/src/unwinder/arch/riscv64.rs index a680d70..badc433 100644 --- a/src/unwinder/arch/riscv64.rs +++ b/src/unwinder/arch/riscv64.rs @@ -214,8 +214,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p } } -#[naked] -pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { +pub unsafe fn restore_context(ctx: &Context) -> ! { #[cfg(target_feature = "d")] unsafe { asm!( @@ -225,6 +224,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { ld a0, 0x50(a0) ret ", + in("a0") ctx, options(noreturn) ); } @@ -236,6 +236,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { ld a0, 0x50(a0) ret ", + in("a0") ctx, options(noreturn) ); } diff --git a/src/unwinder/arch/x86.rs b/src/unwinder/arch/x86.rs index 992afb6..e627e7c 100644 --- a/src/unwinder/arch/x86.rs +++ b/src/unwinder/arch/x86.rs @@ -96,13 +96,10 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p } } -#[naked] -pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { +pub unsafe fn restore_context(ctx: &Context) -> ! { unsafe { asm!( " - mov edx, [esp + 4] - /* Restore stack */ mov esp, [edx + 16] @@ -130,6 +127,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { ret ", + in("edx") ctx, options(noreturn) ); } diff --git a/src/unwinder/arch/x86_64.rs b/src/unwinder/arch/x86_64.rs index 4387686..c7d9069 100644 --- a/src/unwinder/arch/x86_64.rs +++ b/src/unwinder/arch/x86_64.rs @@ -94,8 +94,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p } } -#[naked] -pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { +pub unsafe fn restore_context(ctx: &Context) -> ! { unsafe { asm!( " @@ -134,6 +133,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! { ret ", + in("rdi") ctx, options(noreturn) ); }