authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-23 03:14:55+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-23 19:34:02+02:00
logd99cf5061c205a57a721a5c6e751158803ed04b8
tree823faf5a01f77762d55b33177802960695091e46
parent23b299056dd6d5ed5f8f0dc4306add697e2154c2
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.debug.cpu_context: add signal_ucontext_t for alpha, hppa, microblaze, sh


1 files changed, 98 insertions(+), 0 deletions(-)

lib/std/debug/cpu_context.zig+98
......@@ -1492,6 +1492,21 @@ const X86_64 = struct {
14921492/// as unsigned everywhere even if that's not how they're declared in the C headers.
14931493const signal_ucontext_t = switch (native_os) {
14941494 .linux => switch (native_arch) {
1495 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/alpha/include/asm/ucontext.h
1496 .alpha => extern struct {
1497 _flags: u64,
1498 _link: ?*signal_ucontext_t,
1499 _osf_sigmask: u64,
1500 _stack: std.os.linux.stack_t,
1501 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/alpha/include/uapi/asm/sigcontext.h
1502 mcontext: extern struct {
1503 _onstack: i64,
1504 _mask: i64,
1505 pc: u64,
1506 _ps: i64,
1507 r: [32]u64,
1508 },
1509 },
14951510 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/arm64/include/uapi/asm/ucontext.h
14961511 .aarch64,
14971512 .aarch64_be,
......@@ -1618,6 +1633,21 @@ const signal_ucontext_t = switch (native_os) {
16181633 _ugp: u32,
16191634 pc: u32,
16201635 },
1636 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/parisc/include/uapi/asm/sigcontext.h
1637 .hppa => extern struct {
1638 _flags: u32,
1639 _psw: u32,
1640 r1_19: [19]u32,
1641 r20: u32,
1642 r21: u32,
1643 r22: u32,
1644 r23_29: [7]u32,
1645 r30: u32,
1646 r31: u32,
1647 _fr: [32]f64,
1648 _iasq: [2]u32,
1649 iaoq: [2]u32,
1650 },
16211651 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/m68k/include/asm/ucontext.h
16221652 .m68k => extern struct {
16231653 _version: i32,
......@@ -1625,6 +1655,11 @@ const signal_ucontext_t = switch (native_os) {
16251655 a: [8]u32,
16261656 pc: u32,
16271657 },
1658 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/microblaze/include/uapi/asm/sigcontext.h
1659 .microblaze, .microblazeel => extern struct {
1660 r: [32]u32,
1661 pc: u32,
1662 },
16281663 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/mips/include/uapi/asm/sigcontext.h
16291664 .mips, .mipsel => extern struct {
16301665 _regmask: u32,
......@@ -1654,6 +1689,13 @@ const signal_ucontext_t = switch (native_os) {
16541689 },
16551690 r: [16]u64,
16561691 },
1692 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/sh/include/uapi/asm/sigcontext.h
1693 .sh, .sheb => extern struct {
1694 _oldmask: u32,
1695 r: [16]u32,
1696 pc: u32,
1697 pr: u32,
1698 },
16571699 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/x86/include/uapi/asm/sigcontext.h
16581700 .x86 => extern struct {
16591701 _gs: u32,
......@@ -1950,6 +1992,7 @@ const signal_ucontext_t = switch (native_os) {
19501992 _err: i32,
19511993 eip: u32,
19521994 },
1995 // https://github.com/illumos/illumos-gate/blob/d4ce137bba3bd16823db6374d9e9a643264ce245/usr/src/uts/intel/sys/mcontext.h
19531996 .x86_64 => extern struct {
19541997 r15: u64,
19551998 r14: u64,
......@@ -1986,6 +2029,14 @@ const signal_ucontext_t = switch (native_os) {
19862029 x: [30]u64,
19872030 },
19882031 },
2032 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/alpha/include/signal.h
2033 .alpha => extern struct {
2034 _cookie: i64,
2035 _mask: i64,
2036 pc: u64,
2037 _ps: i64,
2038 r: [32]u64,
2039 },
19892040 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/arm/include/signal.h
19902041 .arm => extern struct {
19912042 _cookie: i32,
......@@ -1997,6 +2048,22 @@ const signal_ucontext_t = switch (native_os) {
19972048 pc: u32,
19982049 },
19992050 },
2051 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/hppa/include/signal.h
2052 .hppa => extern struct {
2053 _unused: u32,
2054 _mask: i32,
2055 _fp: u32,
2056 iaoq: [2]u32,
2057 _resv: [2]u32,
2058 r22: u32,
2059 r21: u32,
2060 r30: u32,
2061 r20: u32,
2062 _sar: u32,
2063 r1_19: [19]u32,
2064 r23_29: [7]u32,
2065 r31: u32,
2066 },
20002067 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/mips64/include/signal.h
20012068 .mips64, .mips64el => extern struct {
20022069 _cookie: i64,
......@@ -2036,6 +2103,18 @@ const signal_ucontext_t = switch (native_os) {
20362103 },
20372104 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/sparc64/include/signal.h
20382105 .sparc64 => @compileError("sparc64-openbsd ucontext_t missing"),
2106 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/sh/include/signal.h
2107 .sh, .sheb => extern struct {
2108 pc: u32,
2109 _sr: i32,
2110 _gbr: i32,
2111 _macl: i32,
2112 _mach: i32,
2113 pr: u32,
2114 r13_0: [14]u32,
2115 r15: u32,
2116 r14: u32,
2117 },
20392118 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/i386/include/signal.h
20402119 .x86 => extern struct {
20412120 mcontext: extern struct {
......@@ -2102,6 +2181,12 @@ const signal_ucontext_t = switch (native_os) {
21022181 sp: u64,
21032182 pc: u64,
21042183 },
2184 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/alpha/include/mcontext.h
2185 .alpha => extern struct {
2186 r: [32]u64,
2187 pc: u64,
2188 },
2189 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/arm/include/mcontext.h
21052190 .arm, .armeb => extern struct {
21062191 r: [15]u32 align(8),
21072192 pc: u32,
......@@ -2120,6 +2205,7 @@ const signal_ucontext_t = switch (native_os) {
21202205 _cause: i32,
21212206 pc: u32,
21222207 },
2208 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/mips/include/mcontext.h
21232209 .mips64, .mips64el => @compileError("https://github.com/ziglang/zig/issues/23765#issuecomment-2880386178"),
21242210 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/powerpc/include/mcontext.h
21252211 .powerpc => extern struct {
......@@ -2131,6 +2217,18 @@ const signal_ucontext_t = switch (native_os) {
21312217 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/sparc/include/mcontext.h
21322218 .sparc => @compileError("sparc-netbsd mcontext_t missing"),
21332219 .sparc64 => @compileError("sparc64-netbsd mcontext_t missing"),
2220 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/sh3/include/mcontext.h
2221 .sh, .sheb => extern struct {
2222 _gbr: i32,
2223 pc: u32,
2224 _sr: i32,
2225 _macl: i32,
2226 _mach: i32,
2227 pr: u32,
2228 r14: u32,
2229 r13_0: [14]u32,
2230 r15: u32,
2231 },
21342232 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/i386/include/mcontext.h
21352233 .x86 => extern struct {
21362234 _gs: i32,