diff options
| -rw-r--r-- | lib/std/c/dragonfly.zig | 54 | ||||
| -rw-r--r-- | lib/std/c/netbsd.zig | 25 | ||||
| -rw-r--r-- | lib/std/debug.zig | 3 | ||||
| -rw-r--r-- | lib/std/dwarf/abi.zig | 2 | ||||
| -rw-r--r-- | lib/std/fs/test.zig | 5 |
5 files changed, 85 insertions, 4 deletions
diff --git a/lib/std/c/dragonfly.zig b/lib/std/c/dragonfly.zig index d4f2867fda..15a5f7ef04 100644 --- a/lib/std/c/dragonfly.zig +++ b/lib/std/c/dragonfly.zig @@ -34,6 +34,10 @@ pub const pthread_attr_t = extern struct { // copied from freebsd __align: c_long, }; +pub const pthread_rwlock_t = extern struct { + ptr: ?*anyopaque = null, +}; + pub const sem_t = ?*opaque {}; pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8) E; @@ -55,6 +59,56 @@ pub const gid_t = u32; pub const time_t = isize; pub const suseconds_t = c_long; +pub const ucontext_t = extern struct { + sigmask: sigset_t, + mcontext: mcontext_t, + link: ?*ucontext_t, + stack: stack_t, + cofunc: ?*fn (?*ucontext_t, ?*anyopaque) void, + arg: ?*void, + _spare: [4]c_int, +}; + +pub const mcontext_t = extern struct { + onstack: register_t, // XXX - sigcontext compat. + rdi: register_t, + rsi: register_t, + rdx: register_t, + rcx: register_t, + r8: register_t, + r9: register_t, + rax: register_t, + rbx: register_t, + rbp: register_t, + r10: register_t, + r11: register_t, + r12: register_t, + r13: register_t, + r14: register_t, + r15: register_t, + xflags: register_t, + trapno: register_t, + addr: register_t, + flags: register_t, + err: register_t, + rip: register_t, + cs: register_t, + rflags: register_t, + rsp: register_t, // machine state + ss: register_t, + + len: c_uint, // sizeof(mcontext_t) + fpformat: c_uint, + ownedfp: c_uint, + reserved: c_uint, + unused: [8]c_uint, + + // NOTE! 64-byte aligned as of here. Also must match savefpu structure. + fpregs: [256]c_int align(64), +}; + +pub const register_t = isize; + pub const E = enum(u16) { /// No error occurred. SUCCESS = 0, diff --git a/lib/std/c/netbsd.zig b/lib/std/c/netbsd.zig index 4b627ed083..2380314429 100644 --- a/lib/std/c/netbsd.zig +++ b/lib/std/c/netbsd.zig @@ -93,7 +93,7 @@ pub const pthread_rwlock_t = extern struct { wblocked_first: ?*u8 = null, wblocked_last: ?*u8 = null, nreaders: c_uint = 0, - owner: std.c.pthread_t = null, + owner: ?std.c.pthread_t = null, private: ?*anyopaque = null, }; @@ -1227,9 +1227,32 @@ pub const REG = switch (builtin.cpu.arch) { pub const PC = 15; }, .x86_64 => struct { + pub const RDI = 0; + pub const RSI = 1; + pub const RDX = 2; + pub const RCX = 3; + pub const R8 = 4; + pub const R9 = 5; + pub const R10 = 6; + pub const R11 = 7; + pub const R12 = 8; + pub const R13 = 9; + pub const R14 = 10; + pub const R15 = 11; pub const RBP = 12; + pub const RBX = 13; + pub const RAX = 14; + pub const GS = 15; + pub const FS = 16; + pub const ES = 17; + pub const DS = 18; + pub const TRAPNO = 19; + pub const ERR = 20; pub const RIP = 21; + pub const CS = 22; + pub const RFLAGS = 23; pub const RSP = 24; + pub const SS = 25; }, else => struct {}, }; diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 3296f8190a..6de21ddd1b 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -168,6 +168,7 @@ pub fn relocateContext(context: *ThreadContext) void { } pub const have_getcontext = @hasDecl(os.system, "getcontext") and + builtin.os.tag != .openbsd and (builtin.os.tag != .linux or switch (builtin.cpu.arch) { .x86, .x86_64, @@ -1228,7 +1229,7 @@ pub fn readElfDebugInfo( } var cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; - const cwd_path = fs.cwd().realpath("", &cwd_buf) catch break :blk; + const cwd_path = os.realpath(".", &cwd_buf) catch break :blk; // <global debug directory>/<absolute folder of current binary>/<gnu_debuglink> for (global_debug_directories) |global_directory| { diff --git a/lib/std/dwarf/abi.zig b/lib/std/dwarf/abi.zig index 9a1385ba6f..b097fd8b15 100644 --- a/lib/std/dwarf/abi.zig +++ b/lib/std/dwarf/abi.zig @@ -229,7 +229,7 @@ pub fn regBytes( else => error.UnimplementedOs, }, .x86_64 => switch (builtin.os.tag) { - .linux, .netbsd, .solaris => switch (reg_number) { + .linux, .solaris => switch (reg_number) { 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RAX]), 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]), 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]), diff --git a/lib/std/fs/test.zig b/lib/std/fs/test.zig index 50804bf614..2b4eded4c8 100644 --- a/lib/std/fs/test.zig +++ b/lib/std/fs/test.zig @@ -102,7 +102,10 @@ test "openDir cwd parent .." { } test "openDir non-cwd parent .." { - if (builtin.os.tag == .wasi) return error.SkipZigTest; + switch (builtin.os.tag) { + .wasi, .netbsd, .openbsd => return error.SkipZigTest, + else => {}, + } var tmp = tmpDir(.{}); defer tmp.cleanup(); |
