Skip to content

Commit f645ec0

Browse files
committed
windows arm64 don't crash in exception handler
1 parent 9ff0039 commit f645ec0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/runtime/sys_windows_arm64.s

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,14 @@ TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0
170170

171171
BL runtime·load_g(SB) // smashes R0, R27, R28 (g)
172172
CMP $0, g // is there a current g?
173-
BNE 2(PC)
174-
BL runtime·badsignal2(SB)
175-
173+
BNE g_ok
174+
// this is a foreign thread, just give up
175+
MOVD R7, LR
176+
MOVD R16, R27 // restore R27
177+
MOVD R17, g // restore R28
178+
MOVD $0, R0 // continue exception search
179+
RET
180+
g_ok:
176181
// Do we need to switch to the g0 stack?
177182
MOVD g, R3 // R3 = oldg (for sigtramp_g0)
178183
MOVD g_m(g), R2 // R2 = m

0 commit comments

Comments
 (0)