aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
diff options
context:
space:
mode:
authorAlex Cameron <ascottcameron@gmail.com>2020-12-19 10:21:55 +0000
committerVeikka Tuominen <git@vexu.eu>2020-12-23 11:02:05 +0200
commit60020fd545e508453ee599c9b792ddb6e164b115 (patch)
treeb947e98852242e6addfb027d9c8d7e5f2ee2f776 /lib/std/os
parentd9fe7ea81592e0978166a2fcfb5edb01ee7d48ef (diff)
downloadzig-60020fd545e508453ee599c9b792ddb6e164b115.tar.gz
zig-60020fd545e508453ee599c9b792ddb6e164b115.zip
Enable segfault handling on FreeBSD.
Diffstat (limited to 'lib/std/os')
-rw-r--r--lib/std/os/bits/freebsd.zig48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/std/os/bits/freebsd.zig b/lib/std/os/bits/freebsd.zig
index 6378dcaf8d..08713bb2e4 100644
--- a/lib/std/os/bits/freebsd.zig
+++ b/lib/std/os/bits/freebsd.zig
@@ -4,6 +4,7 @@
// The MIT license requires this copyright notice to be included in all copies
// and substantial portions of the software.
const std = @import("../../std.zig");
+const builtin = std.builtin;
const maxInt = std.math.maxInt;
// See https://svnweb.freebsd.org/base/head/sys/sys/_types.h?view=co
@@ -815,6 +816,53 @@ pub const sigset_t = extern struct {
pub const empty_sigset = sigset_t{ .__bits = [_]u32{0} ** _SIG_WORDS };
+pub usingnamespace switch (builtin.arch) {
+ .x86_64 => struct {
+ pub const ucontext_t = extern struct {
+ sigmask: sigset_t,
+ mcontext: mcontext_t,
+ link: ?*ucontext_t,
+ stack: stack_t,
+ flags: c_int,
+ __spare__: [4]c_int,
+ };
+
+ /// XXX x86_64 specific
+ pub const mcontext_t = extern struct {
+ onstack: u64,
+ rdi: u64,
+ rsi: u64,
+ rdx: u64,
+ rcx: u64,
+ r8: u64,
+ r9: u64,
+ rax: u64,
+ rbx: u64,
+ rbp: u64,
+ r10: u64,
+ r11: u64,
+ r12: u64,
+ r13: u64,
+ r14: u64,
+ r15: u64,
+ trapno: u32,
+ fs: u16,
+ gs: u16,
+ addr: u64,
+ flags: u32,
+ es: u16,
+ ds: u16,
+ err: u64,
+ rip: u64,
+ cs: u64,
+ rflags: u64,
+ rsp: u64,
+ ss: u64,
+ };
+ },
+ else => struct {},
+};
+
pub const EPERM = 1; // Operation not permitted
pub const ENOENT = 2; // No such file or directory
pub const ESRCH = 3; // No such process