mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
30c1887873
commit
c91dffbc9a
4 changed files with 19 additions and 27 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue