A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Fix reading registers on aarch64 FreeBSD (#13036)
Alex Crichton2b31135800a7
diff --git a/crates/wasmtime/src/runtime/vm/sys/unix/signals.rs b/crates/wasmtime/src/runtime/vm/sys/unix/signals.rsindex d1bb4fe94d..f398ab8749 100644--- a/crates/wasmtime/src/runtime/vm/sys/unix/signals.rs+++ b/crates/wasmtime/src/runtime/vm/sys/unix/signals.rs@@ -308,10 +308,10 @@ unsafe fn get_trap_registers(cx: *mut libc::c_void, _signum: libc::c_int) -> Trafp: cx.uc_mcontext.__gregs[libc::REG_S0] as usize,}} else if #[cfg(all(target_os = "freebsd", target_arch = "aarch64"))] {- let cx = unsafe { &*(cx as *const libc::mcontext_t) };+ let cx = unsafe { &*(cx as *const libc::ucontext_t) };TrapRegisters {- pc: cx.mc_gpregs.gp_elr as usize,- fp: cx.mc_gpregs.gp_x[29] as usize,+ pc: cx.uc_mcontext.mc_gpregs.gp_elr as usize,+ fp: cx.uc_mcontext.mc_gpregs.gp_x[29] as usize,}} else if #[cfg(all(target_os = "openbsd", target_arch = "x86_64"))] {let cx = unsafe { &*(cx as *const libc::ucontext_t) };@@ -384,12 +384,12 @@ unsafe fn store_handler_in_ucontext(cx: *mut libc::c_void, handler: &Handler) {cx.uc_mcontext.mc_rax = 0;cx.uc_mcontext.mc_rdx = 0;} else if #[cfg(all(target_os = "freebsd", target_arch = "aarch64"))] {- let cx = unsafe { cx.cast::<libc::mcontext_t>().as_mut().unwrap() };- cx.mc_gpregs.gp_elr = handler.pc as _;- cx.mc_gpregs.gp_sp = handler.sp as _;- cx.mc_gpregs.gp_x[29] = handler.fp as _;- cx.mc_gpregs.gp_x[0] = 0;- cx.mc_gpregs.gp_x[1] = 0;+ let cx = unsafe { cx.cast::<libc::ucontext_t>().as_mut().unwrap() };+ cx.uc_mcontext.mc_gpregs.gp_elr = handler.pc as _;+ cx.uc_mcontext.mc_gpregs.gp_sp = handler.sp as _;+ cx.uc_mcontext.mc_gpregs.gp_x[29] = handler.fp as _;+ cx.uc_mcontext.mc_gpregs.gp_x[0] = 0;+ cx.uc_mcontext.mc_gpregs.gp_x[1] = 0;} else if #[cfg(all(target_os = "openbsd", target_arch = "x86_64"))] {let cx = unsafe { cx.cast::<libc::ucontext_t>().as_mut().unwrap() };cx.sc_rip = handler.pc as _;