Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FreeBSD x86 support #3782

Merged
merged 5 commits into from
Apr 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/vm/src/trap/traphandlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ cfg_if::cfg_if! {
))] {
pc = context.uc_mcontext.gregs[libc::REG_EIP as usize] as usize;
sp = context.uc_mcontext.gregs[libc::REG_ESP as usize] as usize;
} else if #[cfg(all(target_os = "freebsd", any(target_arch = "x86", target_arch = "x86_64")))] {
} else if #[cfg(all(target_os = "freebsd", target_arch = "x86"))] {
pc = context.uc_mcontext.mc_eip as usize;
sp = context.uc_mcontext.mc_esp as usize;
} else if #[cfg(all(target_os = "freebsd", target_arch = "x86_64"))] {
pc = context.uc_mcontext.mc_rip as usize;
sp = context.uc_mcontext.mc_rsp as usize;
} else if #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))] {
Expand Down Expand Up @@ -330,6 +333,13 @@ cfg_if::cfg_if! {
(*context.uc_mcontext).__ss.__rbp = rbp;
(*context.uc_mcontext).__ss.__rdi = rdi;
(*context.uc_mcontext).__ss.__rsi = rsi;
} else if #[cfg(all(target_os = "freebsd", target_arch = "x86"))] {
let TrapHandlerRegs { eip, esp, ebp, ecx, edx } = regs;
context.uc_mcontext.mc_eip = eip as libc::register_t;
context.uc_mcontext.mc_esp = esp as libc::register_t;
context.uc_mcontext.mc_ebp = ebp as libc::register_t;
context.uc_mcontext.mc_ecx = ecx as libc::register_t;
context.uc_mcontext.mc_edx = edx as libc::register_t;
} else if #[cfg(all(target_os = "freebsd", target_arch = "x86_64"))] {
let TrapHandlerRegs { rip, rsp, rbp, rdi, rsi } = regs;
context.uc_mcontext.mc_rip = rip as libc::register_t;
Expand Down