| ... | ... | @@ -4,6 +4,7 @@ const debug = std.debug; |
| 4 | 4 | const os = std.os; |
| 5 | 5 | const io = std.io; |
| 6 | 6 | const print_zir = @import("print_zir.zig"); |
| 7 | const native_os = builtin.os.tag; |
| 7 | 8 | |
| 8 | 9 | const Module = @import("Module.zig"); |
| 9 | 10 | const Sema = @import("Sema.zig"); |
| ... | ... | @@ -233,9 +234,15 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any |
| 233 | 234 | }, |
| 234 | 235 | .aarch64 => ctx: { |
| 235 | 236 | const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr)); |
| 236 | | const ip = @intCast(usize, ctx.mcontext.pc); |
| 237 | const ip = switch (native_os) { |
| 238 | .macos => @intCast(usize, ctx.mcontext.ss.pc), |
| 239 | else => @intCast(usize, ctx.mcontext.pc), |
| 240 | }; |
| 237 | 241 | // x29 is the ABI-designated frame pointer |
| 238 | | const bp = @intCast(usize, ctx.mcontext.regs[29]); |
| 242 | const bp = switch (native_os) { |
| 243 | .macos => @intCast(usize, ctx.mcontext.ss.fp), |
| 244 | else => @intCast(usize, ctx.mcontext.regs[29]), |
| 245 | }; |
| 239 | 246 | break :ctx StackContext{ .exception = .{ .bp = bp, .ip = ip } }; |
| 240 | 247 | }, |
| 241 | 248 | else => .not_supported, |