std.c.openbsd: add ucontext_t for aarch64

Reapplies 1585ed637d101ed16adb6b9ebdfa465299bfdb13 which was reverted in
f3adbe249b0dfad91318916142a33619232a968f.

I removed use of `usingnamespace` in this commit.

@semarie audited this struct definition.
This commit is contained in:
Andrew Kelley 2023-07-31 11:51:08 -07:00
parent 235b9fc28a
commit b1bde35651

View File

@ -1092,44 +1092,57 @@ comptime {
}
pub usingnamespace switch (builtin.cpu.arch) {
.x86_64 => struct {
pub const ucontext_t = extern struct {
sc_rdi: c_long,
sc_rsi: c_long,
sc_rdx: c_long,
sc_rcx: c_long,
sc_r8: c_long,
sc_r9: c_long,
sc_r10: c_long,
sc_r11: c_long,
sc_r12: c_long,
sc_r13: c_long,
sc_r14: c_long,
sc_r15: c_long,
sc_rbp: c_long,
sc_rbx: c_long,
sc_rax: c_long,
sc_gs: c_long,
sc_fs: c_long,
sc_es: c_long,
sc_ds: c_long,
sc_trapno: c_long,
sc_err: c_long,
sc_rip: c_long,
sc_cs: c_long,
sc_rflags: c_long,
sc_rsp: c_long,
sc_ss: c_long,
sc_fpstate: *anyopaque, // struct fxsave64 *
__sc_unused: c_int,
sc_mask: c_int,
sc_cookie: c_long,
};
},
.x86_64 => struct {},
else => struct {},
};
pub const ucontext_t = switch (builtin.cpu.arch) {
.x86_64 => extern struct {
sc_rdi: c_long,
sc_rsi: c_long,
sc_rdx: c_long,
sc_rcx: c_long,
sc_r8: c_long,
sc_r9: c_long,
sc_r10: c_long,
sc_r11: c_long,
sc_r12: c_long,
sc_r13: c_long,
sc_r14: c_long,
sc_r15: c_long,
sc_rbp: c_long,
sc_rbx: c_long,
sc_rax: c_long,
sc_gs: c_long,
sc_fs: c_long,
sc_es: c_long,
sc_ds: c_long,
sc_trapno: c_long,
sc_err: c_long,
sc_rip: c_long,
sc_cs: c_long,
sc_rflags: c_long,
sc_rsp: c_long,
sc_ss: c_long,
sc_fpstate: *anyopaque, // struct fxsave64 *
__sc_unused: c_int,
sc_mask: c_int,
sc_cookie: c_long,
},
.aarch64 => extern struct {
__sc_unused: c_int,
sc_mask: c_int,
sc_sp: c_ulong,
sc_lr: c_ulong,
sc_elr: c_ulong,
sc_spsr: c_ulong,
sc_x: [30]c_ulong,
sc_cookie: c_long,
},
else => @compileError("missing ucontext_t type definition"),
};
pub const sigset_t = c_uint;
pub const empty_sigset: sigset_t = 0;