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 {...@@ -1492,6 +1492,21 @@ const X86_64 = struct {
1492/// as unsigned everywhere even if that's not how they're declared in the C headers.1492/// as unsigned everywhere even if that's not how they're declared in the C headers.
1493const signal_ucontext_t = switch (native_os) {1493const signal_ucontext_t = switch (native_os) {
1494 .linux => switch (native_arch) {1494 .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 },
1495 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/arm64/include/uapi/asm/ucontext.h1510 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/arm64/include/uapi/asm/ucontext.h
1496 .aarch64,1511 .aarch64,
1497 .aarch64_be,1512 .aarch64_be,
...@@ -1618,6 +1633,21 @@ const signal_ucontext_t = switch (native_os) {...@@ -1618,6 +1633,21 @@ const signal_ucontext_t = switch (native_os) {
1618 _ugp: u32,1633 _ugp: u32,
1619 pc: u32,1634 pc: u32,
1620 },1635 },
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 },
1621 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/m68k/include/asm/ucontext.h1651 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/m68k/include/asm/ucontext.h
1622 .m68k => extern struct {1652 .m68k => extern struct {
1623 _version: i32,1653 _version: i32,
...@@ -1625,6 +1655,11 @@ const signal_ucontext_t = switch (native_os) {...@@ -1625,6 +1655,11 @@ const signal_ucontext_t = switch (native_os) {
1625 a: [8]u32,1655 a: [8]u32,
1626 pc: u32,1656 pc: u32,
1627 },1657 },
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 },
1628 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/mips/include/uapi/asm/sigcontext.h1663 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/mips/include/uapi/asm/sigcontext.h
1629 .mips, .mipsel => extern struct {1664 .mips, .mipsel => extern struct {
1630 _regmask: u32,1665 _regmask: u32,
...@@ -1654,6 +1689,13 @@ const signal_ucontext_t = switch (native_os) {...@@ -1654,6 +1689,13 @@ const signal_ucontext_t = switch (native_os) {
1654 },1689 },
1655 r: [16]u64,1690 r: [16]u64,
1656 },1691 },
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 },
1657 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/x86/include/uapi/asm/sigcontext.h1699 // https://github.com/torvalds/linux/blob/cd5a0afbdf8033dc83786315d63f8b325bdba2fd/arch/x86/include/uapi/asm/sigcontext.h
1658 .x86 => extern struct {1700 .x86 => extern struct {
1659 _gs: u32,1701 _gs: u32,
...@@ -1950,6 +1992,7 @@ const signal_ucontext_t = switch (native_os) {...@@ -1950,6 +1992,7 @@ const signal_ucontext_t = switch (native_os) {
1950 _err: i32,1992 _err: i32,
1951 eip: u32,1993 eip: u32,
1952 },1994 },
1995 // https://github.com/illumos/illumos-gate/blob/d4ce137bba3bd16823db6374d9e9a643264ce245/usr/src/uts/intel/sys/mcontext.h
1953 .x86_64 => extern struct {1996 .x86_64 => extern struct {
1954 r15: u64,1997 r15: u64,
1955 r14: u64,1998 r14: u64,
...@@ -1986,6 +2029,14 @@ const signal_ucontext_t = switch (native_os) {...@@ -1986,6 +2029,14 @@ const signal_ucontext_t = switch (native_os) {
1986 x: [30]u64,2029 x: [30]u64,
1987 },2030 },
1988 },2031 },
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 },
1989 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/arm/include/signal.h2040 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/arm/include/signal.h
1990 .arm => extern struct {2041 .arm => extern struct {
1991 _cookie: i32,2042 _cookie: i32,
...@@ -1997,6 +2048,22 @@ const signal_ucontext_t = switch (native_os) {...@@ -1997,6 +2048,22 @@ const signal_ucontext_t = switch (native_os) {
1997 pc: u32,2048 pc: u32,
1998 },2049 },
1999 },2050 },
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 },
2000 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/mips64/include/signal.h2067 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/mips64/include/signal.h
2001 .mips64, .mips64el => extern struct {2068 .mips64, .mips64el => extern struct {
2002 _cookie: i64,2069 _cookie: i64,
...@@ -2036,6 +2103,18 @@ const signal_ucontext_t = switch (native_os) {...@@ -2036,6 +2103,18 @@ const signal_ucontext_t = switch (native_os) {
2036 },2103 },
2037 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/sparc64/include/signal.h2104 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/sparc64/include/signal.h
2038 .sparc64 => @compileError("sparc64-openbsd ucontext_t missing"),2105 .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 },
2039 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/i386/include/signal.h2118 // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/i386/include/signal.h
2040 .x86 => extern struct {2119 .x86 => extern struct {
2041 mcontext: extern struct {2120 mcontext: extern struct {
...@@ -2102,6 +2181,12 @@ const signal_ucontext_t = switch (native_os) {...@@ -2102,6 +2181,12 @@ const signal_ucontext_t = switch (native_os) {
2102 sp: u64,2181 sp: u64,
2103 pc: u64,2182 pc: u64,
2104 },2183 },
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
2105 .arm, .armeb => extern struct {2190 .arm, .armeb => extern struct {
2106 r: [15]u32 align(8),2191 r: [15]u32 align(8),
2107 pc: u32,2192 pc: u32,
...@@ -2120,6 +2205,7 @@ const signal_ucontext_t = switch (native_os) {...@@ -2120,6 +2205,7 @@ const signal_ucontext_t = switch (native_os) {
2120 _cause: i32,2205 _cause: i32,
2121 pc: u32,2206 pc: u32,
2122 },2207 },
2208 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/mips/include/mcontext.h
2123 .mips64, .mips64el => @compileError("https://github.com/ziglang/zig/issues/23765#issuecomment-2880386178"),2209 .mips64, .mips64el => @compileError("https://github.com/ziglang/zig/issues/23765#issuecomment-2880386178"),
2124 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/powerpc/include/mcontext.h2210 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/powerpc/include/mcontext.h
2125 .powerpc => extern struct {2211 .powerpc => extern struct {
...@@ -2131,6 +2217,18 @@ const signal_ucontext_t = switch (native_os) {...@@ -2131,6 +2217,18 @@ const signal_ucontext_t = switch (native_os) {
2131 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/sparc/include/mcontext.h2217 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/sparc/include/mcontext.h
2132 .sparc => @compileError("sparc-netbsd mcontext_t missing"),2218 .sparc => @compileError("sparc-netbsd mcontext_t missing"),
2133 .sparc64 => @compileError("sparc64-netbsd mcontext_t missing"),2219 .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 },
2134 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/i386/include/mcontext.h2232 // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/i386/include/mcontext.h
2135 .x86 => extern struct {2233 .x86 => extern struct {
2136 _gs: i32,2234 _gs: i32,