summaryrefslogtreecommitdiff
path: root/src/runtime/asm_amd64.s
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-11 12:08:30 -0400
committerRuss Cox <rsc@golang.org>2014-09-11 12:08:30 -0400
commitba9cd2517db68b6a4b218ca73239a9940684c1ac (patch)
treebf32c0de2dcd34c4af6d08a502ae5f3537f33982 /src/runtime/asm_amd64.s
parent03a54ed0e6623884cc7db8d36f4a1152b6b56afd (diff)
downloadgo-ba9cd2517db68b6a4b218ca73239a9940684c1ac.tar.gz
runtime: allow crash from gsignal stack
The uses of onM in dopanic/startpanic are okay even from the signal stack. Fixes issue 8666. LGTM=khr R=khr CC=golang-codereviews https://codereview.appspot.com/134710043
Diffstat (limited to 'src/runtime/asm_amd64.s')
-rw-r--r--src/runtime/asm_amd64.s17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index e5702d074..bf0f490ae 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -200,6 +200,23 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-8
TEXT runtime·switchtoM(SB), NOSPLIT, $0-8
RET
+// func onM_signalok(fn func())
+TEXT runtime·onM_signalok(SB), NOSPLIT, $0-8
+ get_tls(CX)
+ MOVQ g(CX), AX // AX = g
+ MOVQ g_m(AX), BX // BX = m
+ MOVQ m_gsignal(BX), DX // DX = gsignal
+ CMPQ AX, DX
+ JEQ ongsignal
+ JMP runtime·onM(SB)
+
+ongsignal:
+ MOVQ fn+0(FP), DI // DI = fn
+ MOVQ DI, DX
+ MOVQ 0(DI), DI
+ CALL DI
+ RET
+
// func onM(fn func())
TEXT runtime·onM(SB), NOSPLIT, $0-8
MOVQ fn+0(FP), DI // DI = fn