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_ppc64x.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_ppc64x.s')
-rw-r--r-- | src/runtime/sys_linux_ppc64x.s | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s index 44a22c9c77..232f299ac2 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s @@ -196,6 +196,15 @@ TEXT runtime·rt_sigaction(SB),NOSPLIT,$-8-36 MOVW R3, ret+32(FP) RETURN +TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 + MOVW sig+8(FP), R3 + MOVD info+16(FP), R4 + MOVD ctx+24(FP), R5 + MOVD fn+0(FP), R31 + MOVD R31, CTR + BL (CTR) + RETURN + #ifdef GOARCH_ppc64le // ppc64le doesn't need function descriptors TEXT runtime·sigtramp(SB),NOSPLIT,$64 @@ -217,33 +226,12 @@ TEXT runtime·_sigtramp(SB),NOSPLIT,$64 BEQ 2(PC) BL runtime·load_g(SB) - // check that g exists - CMP g, $0 - BNE 6(PC) - MOVD R3, 8(R1) - MOVD $runtime·badsignal(SB), R31 - MOVD R31, CTR - BL (CTR) - RETURN - - // save g - MOVD g, 40(R1) - MOVD g, R6 - - // g = m->gsignal - MOVD g_m(g), R7 - MOVD m_gsignal(R7), g - MOVW R3, 8(R1) MOVD R4, 16(R1) MOVD R5, 24(R1) - MOVD R6, 32(R1) - - BL runtime·sighandler(SB) - - // restore g - MOVD 40(R1), g - + MOVD $runtime·sigtrampgo(SB), R31 + MOVD R31, CTR + BL (CTR) RETURN TEXT runtime·mmap(SB),NOSPLIT,$-8 |