| ... | @@ -42,7 +42,7 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { | ... | @@ -42,7 +42,7 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { |
| 42 | // Deal with some special cases first. | 42 | // Deal with some special cases first. |
| 43 | if (native_arch.isArc() and native_os == .linux) { | 43 | if (native_arch.isArc() and native_os == .linux) { |
| 44 | var native: Native = .{ | 44 | var native: Native = .{ |
| 45 | .r = [_]u32{ uc.mcontext.r31, uc.mcontext.r30, 0, uc.mcontext.r28 } ++ | 45 | .r = [_]Arc.Gpr{ uc.mcontext.r31, uc.mcontext.r30, 0, uc.mcontext.r28 } ++ |
| 46 | uc.mcontext.r27_26 ++ | 46 | uc.mcontext.r27_26 ++ |
| 47 | uc.mcontext.r25_13 ++ | 47 | uc.mcontext.r25_13 ++ |
| 48 | uc.mcontext.r12_0, | 48 | uc.mcontext.r12_0, |
| ... | @@ -100,15 +100,29 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { | ... | @@ -100,15 +100,29 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { |
| 100 | .i = frame.i, | 100 | .i = frame.i, |
| 101 | .pc = uc.mcontext.pc, | 101 | .pc = uc.mcontext.pc, |
| 102 | }; | 102 | }; |
| | 103 | } else if (native_arch.isSparc() and native_os == .netbsd) { |
| | 104 | // The kernel flushes all user windows before delivering a signal. |
| | 105 | const save: *const [16]usize = @ptrFromInt(uc.mcontext.o[6] +% if (native_arch == .sparc64) 2047 else 0); |
| | 106 | |
| | 107 | return .{ |
| | 108 | .g = [_]Sparc.Gpr{0} ++ uc.mcontext.g1_7, |
| | 109 | .o = uc.mcontext.o, |
| | 110 | .l = save[0..8].*, |
| | 111 | .i = save[8..16].*, |
| | 112 | .pc = uc.mcontext.pc, |
| | 113 | }; |
| | 114 | } else if (native_arch == .sparc64 and native_os == .openbsd) { |
| | 115 | // https://codeberg.org/ziglang/zig/issues/30958 |
| | 116 | return null; |
| 103 | } | 117 | } |
| 104 | | 118 | |
| 105 | // Only unified conversions from here. | 119 | // Only unified conversions from here. |
| 106 | return switch (native_arch) { | 120 | return switch (native_arch) { |
| 107 | .arm, .armeb, .thumb, .thumbeb => .{ | 121 | .arm, .armeb, .thumb, .thumbeb => .{ |
| 108 | .r = uc.mcontext.r ++ [_]u32{uc.mcontext.pc}, | 122 | .r = uc.mcontext.r ++ [_]Arm.Gpr{uc.mcontext.pc}, |
| 109 | }, | 123 | }, |
| 110 | .aarch64, .aarch64_be => .{ | 124 | .aarch64, .aarch64_be => .{ |
| 111 | .x = uc.mcontext.x ++ [_]u64{uc.mcontext.lr}, | 125 | .x = uc.mcontext.x ++ [_]Aarch64.Gpr{uc.mcontext.lr}, |
| 112 | .sp = uc.mcontext.sp, | 126 | .sp = uc.mcontext.sp, |
| 113 | .pc = uc.mcontext.pc, | 127 | .pc = uc.mcontext.pc, |
| 114 | }, | 128 | }, |
| ... | @@ -118,9 +132,9 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { | ... | @@ -118,9 +132,9 @@ pub fn fromPosixSignalContext(ctx_ptr: ?*const anyopaque) ?Native { |
| 118 | }, | 132 | }, |
| 119 | .csky => .{ | 133 | .csky => .{ |
| 120 | .r = uc.mcontext.r0_13 ++ | 134 | .r = uc.mcontext.r0_13 ++ |
| 121 | [_]u32{ uc.mcontext.r14, uc.mcontext.r15 } ++ | 135 | [_]Csky.Gpr{ uc.mcontext.r14, uc.mcontext.r15 } ++ |
| 122 | uc.mcontext.r16_30 ++ | 136 | uc.mcontext.r16_30 ++ |
| 123 | [_]u32{uc.mcontext.r31}, | 137 | [_]Csky.Gpr{uc.mcontext.r31}, |
| 124 | .pc = uc.mcontext.pc, | 138 | .pc = uc.mcontext.pc, |
| 125 | }, | 139 | }, |
| 126 | .hexagon, .loongarch32, .loongarch64, .mips, .mipsel, .mips64, .mips64el, .or1k => .{ | 140 | .hexagon, .loongarch32, .loongarch64, .mips, .mipsel, .mips64, .mips64el, .or1k => .{ |
| ... | @@ -2557,7 +2571,17 @@ const signal_ucontext_t = switch (native_os) { | ... | @@ -2557,7 +2571,17 @@ const signal_ucontext_t = switch (native_os) { |
| 2557 | }, | 2571 | }, |
| 2558 | }, | 2572 | }, |
| 2559 | // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/sparc64/include/signal.h | 2573 | // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/sparc64/include/signal.h |
| 2560 | .sparc64 => @compileError("sparc64-openbsd ucontext_t missing"), | 2574 | .sparc64 => extern struct { |
| | 2575 | _cookie: i64, |
| | 2576 | mcontext: extern struct { |
| | 2577 | sp: u64, |
| | 2578 | pc: u64, |
| | 2579 | _npc: i64, |
| | 2580 | _tstate: i64, |
| | 2581 | g1: u64, |
| | 2582 | o0: u64, |
| | 2583 | }, |
| | 2584 | }, |
| 2561 | // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/sh/include/signal.h | 2585 | // https://github.com/openbsd/src/blob/42468faed8369d07ae49ae02dd71ec34f59b66cd/sys/arch/sh/include/signal.h |
| 2562 | .sh => extern struct { | 2586 | .sh => extern struct { |
| 2563 | pc: u32, | 2587 | pc: u32, |
| ... | @@ -2694,8 +2718,22 @@ const signal_ucontext_t = switch (native_os) { | ... | @@ -2694,8 +2718,22 @@ const signal_ucontext_t = switch (native_os) { |
| 2694 | pc: usize, | 2718 | pc: usize, |
| 2695 | }, | 2719 | }, |
| 2696 | // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/sparc/include/mcontext.h | 2720 | // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/sparc/include/mcontext.h |
| 2697 | .sparc => @compileError("sparc-netbsd mcontext_t missing"), | 2721 | .sparc => extern struct { |
| 2698 | .sparc64 => @compileError("sparc64-netbsd mcontext_t missing"), | 2722 | _psr: i32 align(8), |
| | 2723 | pc: u32, |
| | 2724 | _npc: i32, |
| | 2725 | _y: i32, |
| | 2726 | g1_7: [7]u32, |
| | 2727 | o: [8]u32, |
| | 2728 | }, |
| | 2729 | .sparc64 => extern struct { |
| | 2730 | _ccr: i64 align(16), |
| | 2731 | pc: u64, |
| | 2732 | _npc: i64, |
| | 2733 | _y: i64, |
| | 2734 | g1_7: [7]u64, |
| | 2735 | o: [8]u64, |
| | 2736 | }, |
| 2699 | // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/sh3/include/mcontext.h | 2737 | // https://github.com/NetBSD/src/blob/861008c62187bf7bc0aac4d81e52ed6eee4d0c74/sys/arch/sh3/include/mcontext.h |
| 2700 | .sh, .sheb => extern struct { | 2738 | .sh, .sheb => extern struct { |
| 2701 | _gbr: i32, | 2739 | _gbr: i32, |