diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig index 5f28191221..1901271b83 100644 --- a/lib/std/c/darwin.zig +++ b/lib/std/c/darwin.zig @@ -151,11 +151,7 @@ pub const ucontext_t = extern struct { __mcontext_data: mcontext_t, }; -pub const mcontext_t = extern struct { - es: arch_bits.exception_state, - ss: arch_bits.thread_state, - fs: arch_bits.float_state, -}; +pub const mcontext_t = arch_bits.mcontext_t; extern "c" fn __error() *c_int; pub extern "c" fn NSVersionOfRunTimeLibrary(library_name: [*:0]const u8) u32; diff --git a/lib/std/c/darwin/aarch64.zig b/lib/std/c/darwin/aarch64.zig index 48b03363a1..d00b92af83 100644 --- a/lib/std/c/darwin/aarch64.zig +++ b/lib/std/c/darwin/aarch64.zig @@ -1,5 +1,12 @@ // See C headers in // lib/libc/include/aarch64-macos.12-gnu/mach/arm/_structs.h +// lib/libc/include/aarch64-macos.13-none/arm/_mcontext.h + +pub const mcontext_t = extern struct { + es: exception_state, + ss: thread_state, + ns: neon_state, +}; pub const exception_state = extern struct { far: u64, // Virtual Fault Address @@ -17,6 +24,12 @@ pub const thread_state = extern struct { __pad: u32, }; +pub const neon_state = extern struct { + q: [32]u128, + fpsr: u32, + fpcr: u32, +}; + pub const EXC_TYPES_COUNT = 14; pub const EXC_MASK_MACHINE = 0; diff --git a/lib/std/c/darwin/x86_64.zig b/lib/std/c/darwin/x86_64.zig index db94840d9d..7b66fb2e97 100644 --- a/lib/std/c/darwin/x86_64.zig +++ b/lib/std/c/darwin/x86_64.zig @@ -1,5 +1,11 @@ const c = @import("../darwin.zig"); +pub const mcontext_t = extern struct { + es: exception_state, + ss: thread_state, + fs: float_state, +}; + pub const exception_state = extern struct { trapno: u16, cpu: u16, diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 249674e0d4..eef65bd677 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -445,7 +445,14 @@ pub inline fn getContext(context: *StackTraceContext) bool { } const result = have_getcontext and os.system.getcontext(context) == 0; - if (native_os == .macos) assert(context.mcsize == @sizeOf(std.c.mcontext_t)); + if (native_os == .macos) { + // TODO: Temp, to discover this size via aarch64 CI + if (context.mcsize != @sizeOf(std.c.mcontext_t)) { + print("context.mcsize does not match! {} vs {}\n", .{ context.mcsize, @sizeOf(std.c.mcontext_t)}); + } + + assert(context.mcsize == @sizeOf(std.c.mcontext_t)); + } return result; }