1
0
mirror of https://github.com/golang/go synced 2024-11-05 15:06:09 -07:00

runtime: fix runtime.sigreturn_tramp for NetBSD/ARM

using m->tls[0] to save ucontext pointer is not re-entry safe, and
the old code didn't set it before the early return when signal is
received on non-Go threads.

so misc/cgo/test used to hang when testing issue 5337.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/10076045
This commit is contained in:
Shenghou Ma 2013-07-03 00:33:38 +08:00
parent 7cfa8310c7
commit e555172592

View File

@ -174,9 +174,9 @@ TEXT runtime·sigprocmask(SB),7,$0
RET
TEXT runtime·sigreturn_tramp(SB),7,$-4
// in runtime·sigtramp, we saved ucontext into m->tls[0],
// here we just load it and call sys_setcontext
MOVW m_tls(m), R0
// on entry, SP points to siginfo, we add sizeof(ucontext)
// to SP to get a pointer to ucontext.
ADD $0x80, R13, R0 // 0x80 == sizeof(UcontextT)
SWI $0xa00134 // sys_setcontext
// something failed, we have to exit
MOVW $0x4242, R0 // magic return number
@ -223,9 +223,6 @@ TEXT runtime·sigtramp(SB),7,$24
MOVW R1, 8(R13) // info
MOVW R2, 12(R13) // context
MOVW R4, 16(R13) // gp
// we also save the ucontext into m->tls[0] for easy
// signal return
MOVW R2, m_tls(m)
BL runtime·sighandler(SB)