Skip to content

Commit 196f09f

Browse files
authored
Add OpenBSD support in wasmtime for setjmp/longjmp (#12097)
In crates/wasmtime/src/runtime/vm/sys/unix/signals.rs, add case for OpenBSD/x86_64 according to libc (src/unix/bsd/netbsdlike/openbsd/x86_64.rs) Signed-off-by: Laurent Cheylus <[email protected]>
1 parent c00e9ea commit 196f09f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/wasmtime/src/runtime/vm/sys/unix/signals.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,13 @@ unsafe fn store_handler_in_ucontext(cx: *mut libc::c_void, handler: &Handler) {
383383
cx.uc_mcontext.mc_rsp = handler.sp as _;
384384
cx.uc_mcontext.mc_rax = 0;
385385
cx.uc_mcontext.mc_rdx = 0;
386+
} else if #[cfg(all(target_os = "openbsd", target_arch = "x86_64"))] {
387+
let cx = unsafe { cx.cast::<libc::ucontext_t>().as_mut().unwrap() };
388+
cx.sc_rip = handler.pc as _;
389+
cx.sc_rbp = handler.fp as _;
390+
cx.sc_rsp = handler.sp as _;
391+
cx.sc_rax = 0;
392+
cx.sc_rdx = 0;
386393
} else if #[cfg(all(target_os = "linux", target_arch = "riscv64"))] {
387394
let cx = unsafe { cx.cast::<libc::ucontext_t>().as_mut().unwrap() };
388395
cx.uc_mcontext.__gregs[libc::REG_PC] = handler.pc as _;

0 commit comments

Comments
 (0)