| author | |
| committer | |
| log | 576ffaa3298b4e99b7e46d4eccad4763b18985f8 |
| tree | 5abb00cc3c329894f5d5bb2ad4743c3bd343481e |
| parent | 412cd789bf38a8fb6126803b8eab601b700e5a9e |
4 files changed, 28 insertions(+), 6 deletions(-)
lib/std/c/darwin.zig+1-5| ... | @@ -151,11 +151,7 @@ pub const ucontext_t = extern struct { | ... | @@ -151,11 +151,7 @@ pub const ucontext_t = extern struct { |
| 151 | __mcontext_data: mcontext_t, | 151 | __mcontext_data: mcontext_t, |
| 152 | }; | 152 | }; |
| 153 | 153 | ||
| 154 | pub const mcontext_t = extern struct { | 154 | pub const mcontext_t = arch_bits.mcontext_t; |
| 155 | es: arch_bits.exception_state, | ||
| 156 | ss: arch_bits.thread_state, | ||
| 157 | fs: arch_bits.float_state, | ||
| 158 | }; | ||
| 159 | 155 | ||
| 160 | extern "c" fn __error() *c_int; | 156 | extern "c" fn __error() *c_int; |
| 161 | pub extern "c" fn NSVersionOfRunTimeLibrary(library_name: [*:0]const u8) u32; | 157 | pub extern "c" fn NSVersionOfRunTimeLibrary(library_name: [*:0]const u8) u32; |
lib/std/c/darwin/aarch64.zig+13| ... | @@ -1,5 +1,12 @@ | ... | @@ -1,5 +1,12 @@ |
| 1 | // See C headers in | 1 | // See C headers in |
| 2 | // lib/libc/include/aarch64-macos.12-gnu/mach/arm/_structs.h | 2 | // lib/libc/include/aarch64-macos.12-gnu/mach/arm/_structs.h |
| 3 | // lib/libc/include/aarch64-macos.13-none/arm/_mcontext.h | ||
| 4 | |||
| 5 | pub const mcontext_t = extern struct { | ||
| 6 | es: exception_state, | ||
| 7 | ss: thread_state, | ||
| 8 | ns: neon_state, | ||
| 9 | }; | ||
| 3 | 10 | ||
| 4 | pub const exception_state = extern struct { | 11 | pub const exception_state = extern struct { |
| 5 | far: u64, // Virtual Fault Address | 12 | far: u64, // Virtual Fault Address |
| ... | @@ -17,6 +24,12 @@ pub const thread_state = extern struct { | ... | @@ -17,6 +24,12 @@ pub const thread_state = extern struct { |
| 17 | __pad: u32, | 24 | __pad: u32, |
| 18 | }; | 25 | }; |
| 19 | 26 | ||
| 27 | pub const neon_state = extern struct { | ||
| 28 | q: [32]u128, | ||
| 29 | fpsr: u32, | ||
| 30 | fpcr: u32, | ||
| 31 | }; | ||
| 32 | |||
| 20 | pub const EXC_TYPES_COUNT = 14; | 33 | pub const EXC_TYPES_COUNT = 14; |
| 21 | pub const EXC_MASK_MACHINE = 0; | 34 | pub const EXC_MASK_MACHINE = 0; |
| 22 | 35 |
lib/std/c/darwin/x86_64.zig+6| ... | @@ -1,5 +1,11 @@ | ... | @@ -1,5 +1,11 @@ |
| 1 | const c = @import("../darwin.zig"); | 1 | const c = @import("../darwin.zig"); |
| 2 | 2 | ||
| 3 | pub const mcontext_t = extern struct { | ||
| 4 | es: exception_state, | ||
| 5 | ss: thread_state, | ||
| 6 | fs: float_state, | ||
| 7 | }; | ||
| 8 | |||
| 3 | pub const exception_state = extern struct { | 9 | pub const exception_state = extern struct { |
| 4 | trapno: u16, | 10 | trapno: u16, |
| 5 | cpu: u16, | 11 | cpu: u16, |
lib/std/debug.zig+8-1| ... | @@ -445,7 +445,14 @@ pub inline fn getContext(context: *StackTraceContext) bool { | ... | @@ -445,7 +445,14 @@ pub inline fn getContext(context: *StackTraceContext) bool { |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | const result = have_getcontext and os.system.getcontext(context) == 0; | 447 | const result = have_getcontext and os.system.getcontext(context) == 0; |
| 448 | if (native_os == .macos) assert(context.mcsize == @sizeOf(std.c.mcontext_t)); | 448 | if (native_os == .macos) { |
| 449 | // TODO: Temp, to discover this size via aarch64 CI | ||
| 450 | if (context.mcsize != @sizeOf(std.c.mcontext_t)) { | ||
| 451 | print("context.mcsize does not match! {} vs {}\n", .{ context.mcsize, @sizeOf(std.c.mcontext_t)}); | ||
| 452 | } | ||
| 453 | |||
| 454 | assert(context.mcsize == @sizeOf(std.c.mcontext_t)); | ||
| 455 | } | ||
| 449 | 456 | ||
| 450 | return result; | 457 | return result; |
| 451 | } | 458 | } |