diff options
author | Srdjan Petrovic <spetrovic@google.com> | 2015-04-09 11:12:12 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2015-04-24 05:19:39 +0000 |
commit | 5c8fbc6f1e4ba78133c53ce73f82ad10e81b42f8 (patch) | |
tree | d6e877ab0831d38259d2cf332236354de74f205d /src/runtime/sys_linux_386.s | |
parent | b075d1fc2eaacde75261969372fb3275ef694668 (diff) | |
download | go-5c8fbc6f1e4ba78133c53ce73f82ad10e81b42f8.tar.gz go-5c8fbc6f1e4ba78133c53ce73f82ad10e81b42f8.zip |
runtime: signal forwarding
Forward signals to signal handlers installed before Go installs its own,
under certain circumstances. In particular, as iant@ suggests, signals are
forwarded iff:
(1) a non-SIG_DFL signal handler existed before Go, and
(2) signal is synchronous (i.e., one of SIGSEGV, SIGBUS, SIGFPE), and
(3a) signal occured on a non-Go thread, or
(3b) signal occurred on a Go thread but in CGo code.
Supported only on Linux, for now.
Change-Id: I403219ee47b26cf65da819fb86cf1ec04d3e25f5
Reviewed-on: https://go-review.googlesource.com/8712
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_386.s')
-rw-r--r-- | src/runtime/sys_linux_386.s | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s index 679a81d66d..f5cfb644c9 100644 --- a/src/runtime/sys_linux_386.s +++ b/src/runtime/sys_linux_386.s @@ -191,43 +191,25 @@ TEXT runtime·rt_sigaction(SB),NOSPLIT,$0 MOVL AX, ret+16(FP) RET -TEXT runtime·sigtramp(SB),NOSPLIT,$44 - get_tls(CX) - - // check that g exists - MOVL g(CX), DI - CMPL DI, $0 - JNE 6(PC) - MOVL sig+0(FP), BX - MOVL BX, 0(SP) - MOVL $runtime·badsignal(SB), AX +TEXT runtime·sigfwd(SB),NOSPLIT,$12-16 + MOVL sig+4(FP), AX + MOVL AX, 0(SP) + MOVL info+8(FP), AX + MOVL AX, 4(SP) + MOVL ctx+12(FP), AX + MOVL AX, 8(SP) + MOVL fn+0(FP), AX CALL AX RET - // save g - MOVL DI, 20(SP) - - // g = m->gsignal - MOVL g_m(DI), BX - MOVL m_gsignal(BX), BX - MOVL BX, g(CX) - - // copy arguments for call to sighandler +TEXT runtime·sigtramp(SB),NOSPLIT,$12 MOVL sig+0(FP), BX MOVL BX, 0(SP) MOVL info+4(FP), BX MOVL BX, 4(SP) MOVL context+8(FP), BX MOVL BX, 8(SP) - MOVL DI, 12(SP) - - CALL runtime·sighandler(SB) - - // restore g - get_tls(CX) - MOVL 20(SP), BX - MOVL BX, g(CX) - + CALL runtime·sigtrampgo(SB) RET TEXT runtime·sigreturn(SB),NOSPLIT,$0 |