aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_unix.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2020-10-07 22:53:52 -0400
committerAustin Clements <austin@google.com>2020-10-26 14:50:34 +0000
commitc91dffbc9aeaacd087eb0c0c3f718739bc5f8c4a (patch)
tree464e8454d2c2a5b6f625785406682e2da6b73dfb /src/runtime/signal_unix.go
parent30c18878730434027dbefd343aad74963a1fdc48 (diff)
downloadgo-c91dffbc9aeaacd087eb0c0c3f718739bc5f8c4a.tar.gz
go-c91dffbc9aeaacd087eb0c0c3f718739bc5f8c4a.zip
runtime: tidy cgocallback
On amd64 and 386, we have a very roundabout way of remembering that we need to dropm on return that currently involves saving a zero to needm's argument slot and later bringing it back. Just store the zero. This also makes amd64 and 386 more consistent with cgocallback on all other platforms: rather than saving the old M to the G stack, they now save it to a named slot on the G0 stack. The needm function no longer needs a dummy argument to get the SP, so we drop that. Change-Id: I7e84bb4a5ff9552de70dcf41d8accf02310535e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/263268 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/signal_unix.go')
-rw-r--r--src/runtime/signal_unix.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index e8b6f95d8f..9318a9b8bc 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -504,14 +504,14 @@ func adjustSignalStack(sig uint32, mp *m, gsigStack *gsignalStack) bool {
sigaltstack(nil, &st)
if st.ss_flags&_SS_DISABLE != 0 {
setg(nil)
- needm(0)
+ needm()
noSignalStack(sig)
dropm()
}
stsp := uintptr(unsafe.Pointer(st.ss_sp))
if sp < stsp || sp >= stsp+st.ss_size {
setg(nil)
- needm(0)
+ needm()
sigNotOnStack(sig)
dropm()
}
@@ -951,7 +951,7 @@ func badsignal(sig uintptr, c *sigctxt) {
exit(2)
*(*uintptr)(unsafe.Pointer(uintptr(123))) = 2
}
- needm(0)
+ needm()
if !sigsend(uint32(sig)) {
// A foreign thread received the signal sig, and the
// Go code does not want to handle it.