diff --git a/src/unwinder/arch/aarch64.rs b/src/unwinder/arch/aarch64.rs index f8aa44c..8c64753 100644 --- a/src/unwinder/arch/aarch64.rs +++ b/src/unwinder/arch/aarch64.rs @@ -1,4 +1,3 @@ -use core::arch::asm; use core::fmt; use core::ops; use gimli::{AArch64, Register}; @@ -61,7 +60,7 @@ impl ops::IndexMut for Context { macro_rules! save { (gp$(, $fp:ident)?) => { // No need to save caller-saved registers here. - asm!( + core::arch::naked_asm!( " stp x29, x30, [sp, -16]! .cfi_def_cfa_offset 16 @@ -93,7 +92,6 @@ macro_rules! save { .cfi_restore x30 ret ", - options(noreturn) ); }; (maybesavefp(fp)) => { @@ -119,7 +117,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p macro_rules! restore { ($ctx:expr, gp$(, $fp:ident)?) => { - asm!( + core::arch::asm!( restore!(mayberestore($($fp)?)), " ldp x2, x3, [x0, 0x10] diff --git a/src/unwinder/arch/riscv32.rs b/src/unwinder/arch/riscv32.rs index caf5109..a5aeff7 100644 --- a/src/unwinder/arch/riscv32.rs +++ b/src/unwinder/arch/riscv32.rs @@ -1,4 +1,3 @@ -use core::arch::asm; use core::fmt; use core::ops; use gimli::{Register, RiscV}; @@ -173,7 +172,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p // No need to save caller-saved registers here. #[cfg(target_feature = "d")] unsafe { - asm!( + core::arch::naked_asm!( " mv t0, sp add sp, sp, -0x190 @@ -193,12 +192,11 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p .cfi_restore ra ret ", - options(noreturn) ); } #[cfg(not(target_feature = "d"))] unsafe { - asm!( + core::arch::naked_asm!( " mv t0, sp add sp, sp, -0x90 @@ -217,7 +215,6 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p .cfi_restore ra ret ", - options(noreturn) ); } } @@ -225,7 +222,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p pub unsafe fn restore_context(ctx: &Context) -> ! { #[cfg(target_feature = "d")] unsafe { - asm!( + core::arch::asm!( code!(restore_fp), code!(restore_gp), " @@ -238,7 +235,7 @@ pub unsafe fn restore_context(ctx: &Context) -> ! { } #[cfg(not(target_feature = "d"))] unsafe { - asm!( + core::arch::asm!( code!(restore_gp), " lw a0, 0x28(a0) diff --git a/src/unwinder/arch/riscv64.rs b/src/unwinder/arch/riscv64.rs index 71a1c60..f2f11ea 100644 --- a/src/unwinder/arch/riscv64.rs +++ b/src/unwinder/arch/riscv64.rs @@ -1,4 +1,3 @@ -use core::arch::asm; use core::fmt; use core::ops; use gimli::{Register, RiscV}; @@ -173,7 +172,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p // No need to save caller-saved registers here. #[cfg(target_feature = "d")] unsafe { - asm!( + core::arch::naked_asm!( " mv t0, sp add sp, sp, -0x210 @@ -193,12 +192,11 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p .cfi_restore ra ret ", - options(noreturn) ); } #[cfg(not(target_feature = "d"))] unsafe { - asm!( + core::arch::naked_asm!( " mv t0, sp add sp, sp, -0x110 @@ -217,7 +215,6 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p .cfi_restore ra ret ", - options(noreturn) ); } } @@ -225,7 +222,7 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p pub unsafe fn restore_context(ctx: &Context) -> ! { #[cfg(target_feature = "d")] unsafe { - asm!( + core::arch::asm!( code!(restore_fp), code!(restore_gp), " @@ -238,7 +235,7 @@ pub unsafe fn restore_context(ctx: &Context) -> ! { } #[cfg(not(target_feature = "d"))] unsafe { - asm!( + core::arch::asm!( code!(restore_gp), " ld a0, 0x50(a0) diff --git a/src/unwinder/arch/x86.rs b/src/unwinder/arch/x86.rs index 69a95ab..22d3b90 100644 --- a/src/unwinder/arch/x86.rs +++ b/src/unwinder/arch/x86.rs @@ -1,4 +1,3 @@ -use core::arch::asm; use core::fmt; use core::ops; use gimli::{Register, X86}; @@ -59,7 +58,7 @@ impl ops::IndexMut for Context { pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), ptr: *mut ()) { // No need to save caller-saved registers here. unsafe { - asm!( + core::arch::naked_asm!( " sub esp, 52 .cfi_def_cfa_offset 56 @@ -95,14 +94,13 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p .cfi_def_cfa_offset 4 ret ", - options(noreturn) ); } } pub unsafe fn restore_context(ctx: &Context) -> ! { unsafe { - asm!( + core::arch::asm!( " /* Restore stack */ mov esp, [edx + 16] diff --git a/src/unwinder/arch/x86_64.rs b/src/unwinder/arch/x86_64.rs index be76590..575e5eb 100644 --- a/src/unwinder/arch/x86_64.rs +++ b/src/unwinder/arch/x86_64.rs @@ -1,4 +1,3 @@ -use core::arch::asm; use core::fmt; use core::ops; use gimli::{Register, X86_64}; @@ -61,7 +60,7 @@ impl ops::IndexMut for Context { pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), ptr: *mut ()) { // No need to save caller-saved registers here. unsafe { - asm!( + core::arch::naked_asm!( " sub rsp, 0x98 .cfi_def_cfa_offset 0xA0 @@ -90,15 +89,14 @@ pub extern "C-unwind" fn save_context(f: extern "C" fn(&mut Context, *mut ()), p add rsp, 0x98 .cfi_def_cfa_offset 8 ret - ", - options(noreturn) + " ); } } pub unsafe fn restore_context(ctx: &Context) -> ! { unsafe { - asm!( + core::arch::asm!( " /* Restore stack */ mov rsp, [rdi + 0x38]