aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_arm.s
diff options
context:
space:
mode:
authorSrdjan Petrovic <spetrovic@google.com>2015-04-09 11:12:12 -0700
committerIan Lance Taylor <iant@golang.org>2015-04-24 05:19:39 +0000
commit5c8fbc6f1e4ba78133c53ce73f82ad10e81b42f8 (patch)
treed6e877ab0831d38259d2cf332236354de74f205d /src/runtime/sys_linux_arm.s
parentb075d1fc2eaacde75261969372fb3275ef694668 (diff)
downloadgo-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_arm.s')
-rw-r--r--src/runtime/sys_linux_arm.s36
1 files changed, 11 insertions, 25 deletions
diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s
index d0c6d22f31..3936cd93a8 100644
--- a/src/runtime/sys_linux_arm.s
+++ b/src/runtime/sys_linux_arm.s
@@ -327,7 +327,15 @@ TEXT runtime·sigaltstack(SB),NOSPLIT,$0
MOVW.HI R8, (R8)
RET
-TEXT runtime·sigtramp(SB),NOSPLIT,$24
+TEXT runtime·sigfwd(SB),NOSPLIT,$0-16
+ MOVW sig+4(FP), R0
+ MOVW info+8(FP), R1
+ MOVW ctx+12(FP), R2
+ MOVW fn+0(FP), R11
+ BL (R11)
+ RET
+
+TEXT runtime·sigtramp(SB),NOSPLIT,$12
// this might be called in external code context,
// where g is not set.
// first save R0, because runtime·load_g will clobber it
@@ -336,32 +344,10 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$24
CMP $0, R0
BL.NE runtime·load_g(SB)
- CMP $0, g
- BNE 4(PC)
- // signal number is already prepared in 4(R13)
- MOVW $runtime·badsignal(SB), R11
- BL (R11)
- RET
-
- // save g
- MOVW g, R3
- MOVW g, 20(R13)
-
- // g = m->gsignal
- MOVW g_m(g), R8
- MOVW m_gsignal(R8), g
-
- // copy arguments for call to sighandler
- // R0 is already saved above
MOVW R1, 8(R13)
MOVW R2, 12(R13)
- MOVW R3, 16(R13)
-
- BL runtime·sighandler(SB)
-
- // restore g
- MOVW 20(R13), g
-
+ MOVW $runtime·sigtrampgo(SB), R11
+ BL (R11)
RET
TEXT runtime·rtsigprocmask(SB),NOSPLIT,$0