mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-24 14:11:32 +00:00
Port to FreeBSD
This commit is contained in:
@ -77,6 +77,9 @@ pub extern "C" fn nearbyintf64(x: f64) -> f64 {
|
||||
}
|
||||
|
||||
// FIXME: Is there a replacement on AArch64?
|
||||
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
|
||||
#[cfg(all(
|
||||
any(target_os = "freebsd", target_os = "linux"),
|
||||
target_arch = "aarch64"
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn __rust_probestack() {}
|
||||
|
@ -141,6 +141,84 @@ pub unsafe fn do_unwind(signum: i32, siginfo: *const c_void, ucontext: *const c_
|
||||
longjmp(jmp_buf as *mut ::nix::libc::c_void, signum)
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "freebsd", target_arch = "aarch64"))]
|
||||
unsafe fn get_faulting_addr_and_ip(
|
||||
_siginfo: *const c_void,
|
||||
_ucontext: *const c_void,
|
||||
) -> (*const c_void, *const c_void) {
|
||||
(::std::ptr::null(), ::std::ptr::null())
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "freebsd", target_arch = "x86_64"))]
|
||||
unsafe fn get_faulting_addr_and_ip(
|
||||
siginfo: *const c_void,
|
||||
ucontext: *const c_void,
|
||||
) -> (*const c_void, *const c_void) {
|
||||
#[repr(C)]
|
||||
pub struct ucontext_t {
|
||||
uc_sigmask: libc::sigset_t,
|
||||
uc_mcontext: mcontext_t,
|
||||
uc_link: *mut ucontext_t,
|
||||
uc_stack: libc::stack_t,
|
||||
uc_flags: i32,
|
||||
__spare__: [i32; 4],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct mcontext_t {
|
||||
mc_onstack: u64,
|
||||
mc_rdi: u64,
|
||||
mc_rsi: u64,
|
||||
mc_rdx: u64,
|
||||
mc_rcx: u64,
|
||||
mc_r8: u64,
|
||||
mc_r9: u64,
|
||||
mc_rax: u64,
|
||||
mc_rbx: u64,
|
||||
mc_rbp: u64,
|
||||
mc_r10: u64,
|
||||
mc_r11: u64,
|
||||
mc_r12: u64,
|
||||
mc_r13: u64,
|
||||
mc_r14: u64,
|
||||
mc_r15: u64,
|
||||
mc_trapno: u32,
|
||||
mc_fs: u16,
|
||||
mc_gs: u16,
|
||||
mc_addr: u64,
|
||||
mc_flags: u32,
|
||||
mc_es: u16,
|
||||
mc_ds: u16,
|
||||
mc_err: u64,
|
||||
mc_rip: u64,
|
||||
mc_cs: u64,
|
||||
mc_rflags: u64,
|
||||
mc_rsp: u64,
|
||||
mc_ss: u64,
|
||||
mc_len: i64,
|
||||
|
||||
mc_fpformat: i64,
|
||||
mc_ownedfp: i64,
|
||||
mc_fpstate: [i64; 64], // mc_fpstate[0] is a pointer to savefpu
|
||||
|
||||
mc_fsbase: u64,
|
||||
mc_gsbase: u64,
|
||||
|
||||
mc_xfpustate: u64,
|
||||
mc_xfpustate_len: u64,
|
||||
|
||||
mc_spare: [i64; 4],
|
||||
}
|
||||
|
||||
let siginfo = siginfo as *const siginfo_t;
|
||||
let si_addr = (*siginfo).si_addr;
|
||||
|
||||
let ucontext = ucontext as *const ucontext_t;
|
||||
let rip = (*ucontext).uc_mcontext.mc_rip;
|
||||
|
||||
(si_addr, rip as _)
|
||||
}
|
||||
|
||||
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
|
||||
unsafe fn get_faulting_addr_and_ip(
|
||||
_siginfo: *const c_void,
|
||||
@ -239,6 +317,8 @@ unsafe fn get_faulting_addr_and_ip(
|
||||
}
|
||||
|
||||
#[cfg(not(any(
|
||||
all(target_os = "freebsd", target_arch = "aarch64"),
|
||||
all(target_os = "freebsd", target_arch = "x86_64"),
|
||||
all(target_os = "macos", target_arch = "x86_64"),
|
||||
all(target_os = "linux", target_arch = "x86_64"),
|
||||
all(target_os = "linux", target_arch = "aarch64"),
|
||||
|
Reference in New Issue
Block a user