Commit b30814bb authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: add ctxt parameter to cgocallback called from Go

The cgocallback function picked up a ctxt parameter in CL 22508.
That CL updated the assembler implementation, but there are a few
mentions in Go code that were not updated. This CL fixes that.

Fixes #16326

Change-Id: I5f68e23565c6a0b11057aff476d13990bff54a66
Reviewed-on: https://go-review.googlesource.com/24848
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent 1f4e68d9
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
// call arbitrary Go code directly and must be careful not to allocate // call arbitrary Go code directly and must be careful not to allocate
// memory or use up m->g0's stack. // memory or use up m->g0's stack.
// //
// _cgoexp_GoF calls runtime.cgocallback(p.GoF, frame, framesize). // _cgoexp_GoF calls runtime.cgocallback(p.GoF, frame, framesize, ctxt).
// (The reason for having _cgoexp_GoF instead of writing a crosscall3 // (The reason for having _cgoexp_GoF instead of writing a crosscall3
// to make this call directly is that _cgoexp_GoF, because it is compiled // to make this call directly is that _cgoexp_GoF, because it is compiled
// with 6c instead of gcc, can refer to dotted names like // with 6c instead of gcc, can refer to dotted names like
......
...@@ -246,7 +246,7 @@ func memlimit() uintptr { ...@@ -246,7 +246,7 @@ func memlimit() uintptr {
//go:norace //go:norace
//go:nowritebarrierrec //go:nowritebarrierrec
func badsignal(sig uintptr) { func badsignal(sig uintptr) {
cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
func badsignalgo(sig uintptr) { func badsignalgo(sig uintptr) {
......
...@@ -338,7 +338,7 @@ func sigNotOnStack(sig uint32) { ...@@ -338,7 +338,7 @@ func sigNotOnStack(sig uint32) {
//go:norace //go:norace
//go:nowritebarrierrec //go:nowritebarrierrec
func badsignal(sig uintptr, c *sigctxt) { func badsignal(sig uintptr, c *sigctxt) {
cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)+unsafe.Sizeof(c)) cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)+unsafe.Sizeof(c), 0)
} }
func badsignalgo(sig uintptr, c *sigctxt) { func badsignalgo(sig uintptr, c *sigctxt) {
......
...@@ -70,12 +70,12 @@ func sigtrampgo(fn uintptr, infostyle, sig uint32, info *siginfo, ctx unsafe.Poi ...@@ -70,12 +70,12 @@ func sigtrampgo(fn uintptr, infostyle, sig uint32, info *siginfo, ctx unsafe.Poi
sigaltstack(nil, &st) sigaltstack(nil, &st)
if st.ss_flags&_SS_DISABLE != 0 { if st.ss_flags&_SS_DISABLE != 0 {
setg(nil) setg(nil)
cgocallback(unsafe.Pointer(funcPC(noSignalStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(noSignalStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
stsp := uintptr(unsafe.Pointer(st.ss_sp)) stsp := uintptr(unsafe.Pointer(st.ss_sp))
if sp < stsp || sp >= stsp+st.ss_size { if sp < stsp || sp >= stsp+st.ss_size {
setg(nil) setg(nil)
cgocallback(unsafe.Pointer(funcPC(sigNotOnStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(sigNotOnStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
g.m.gsignal.stack.lo = stsp g.m.gsignal.stack.lo = stsp
g.m.gsignal.stack.hi = stsp + st.ss_size g.m.gsignal.stack.hi = stsp + st.ss_size
......
...@@ -66,12 +66,12 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { ...@@ -66,12 +66,12 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
sigaltstack(nil, &st) sigaltstack(nil, &st)
if st.ss_flags&_SS_DISABLE != 0 { if st.ss_flags&_SS_DISABLE != 0 {
setg(nil) setg(nil)
cgocallback(unsafe.Pointer(funcPC(noSignalStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(noSignalStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
stsp := uintptr(unsafe.Pointer(st.ss_sp)) stsp := uintptr(unsafe.Pointer(st.ss_sp))
if sp < stsp || sp >= stsp+st.ss_size { if sp < stsp || sp >= stsp+st.ss_size {
setg(nil) setg(nil)
cgocallback(unsafe.Pointer(funcPC(sigNotOnStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(sigNotOnStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
g.m.gsignal.stack.lo = stsp g.m.gsignal.stack.lo = stsp
g.m.gsignal.stack.hi = stsp + st.ss_size g.m.gsignal.stack.hi = stsp + st.ss_size
......
...@@ -66,12 +66,12 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { ...@@ -66,12 +66,12 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
sigaltstack(nil, &st) sigaltstack(nil, &st)
if st.ss_flags&_SS_DISABLE != 0 { if st.ss_flags&_SS_DISABLE != 0 {
setg(nil) setg(nil)
cgocallback(unsafe.Pointer(funcPC(noSignalStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(noSignalStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
stsp := uintptr(unsafe.Pointer(st.ss_sp)) stsp := uintptr(unsafe.Pointer(st.ss_sp))
if sp < stsp || sp >= stsp+st.ss_size { if sp < stsp || sp >= stsp+st.ss_size {
setg(nil) setg(nil)
cgocallback(unsafe.Pointer(funcPC(sigNotOnStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(sigNotOnStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
g.m.gsignal.stack.lo = stsp g.m.gsignal.stack.lo = stsp
g.m.gsignal.stack.hi = stsp + st.ss_size g.m.gsignal.stack.hi = stsp + st.ss_size
......
...@@ -37,12 +37,12 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { ...@@ -37,12 +37,12 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
sigaltstack(nil, &st) sigaltstack(nil, &st)
if st.ss_flags&_SS_DISABLE != 0 { if st.ss_flags&_SS_DISABLE != 0 {
setg(nil) setg(nil)
cgocallback(unsafe.Pointer(funcPC(noSignalStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(noSignalStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
stsp := uintptr(unsafe.Pointer(st.ss_sp)) stsp := uintptr(unsafe.Pointer(st.ss_sp))
if sp < stsp || sp >= stsp+st.ss_size { if sp < stsp || sp >= stsp+st.ss_size {
setg(nil) setg(nil)
cgocallback(unsafe.Pointer(funcPC(sigNotOnStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig)) cgocallback(unsafe.Pointer(funcPC(sigNotOnStack)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0)
} }
g.m.gsignal.stack.lo = stsp g.m.gsignal.stack.lo = stsp
g.m.gsignal.stack.hi = stsp + st.ss_size g.m.gsignal.stack.hi = stsp + st.ss_size
......
...@@ -98,7 +98,7 @@ func noescape(p unsafe.Pointer) unsafe.Pointer { ...@@ -98,7 +98,7 @@ func noescape(p unsafe.Pointer) unsafe.Pointer {
return unsafe.Pointer(x ^ 0) return unsafe.Pointer(x ^ 0)
} }
func cgocallback(fn, frame unsafe.Pointer, framesize uintptr) func cgocallback(fn, frame unsafe.Pointer, framesize, ctxt uintptr)
func gogo(buf *gobuf) func gogo(buf *gobuf)
func gosave(buf *gobuf) func gosave(buf *gobuf)
func mincore(addr unsafe.Pointer, n uintptr, dst *byte) int32 func mincore(addr unsafe.Pointer, n uintptr, dst *byte) int32
...@@ -143,7 +143,7 @@ func goexit(neverCallThisFunction) ...@@ -143,7 +143,7 @@ func goexit(neverCallThisFunction)
// cgocallback_gofunc is not called from go, only from cgocallback, // cgocallback_gofunc is not called from go, only from cgocallback,
// so the arguments will be found via cgocallback's pointer-declared arguments. // so the arguments will be found via cgocallback's pointer-declared arguments.
// See the assembly implementations for more details. // See the assembly implementations for more details.
func cgocallback_gofunc(fv uintptr, frame uintptr, framesize uintptr) func cgocallback_gofunc(fv uintptr, frame uintptr, framesize, ctxt uintptr)
// publicationBarrier performs a store/store barrier (a "publication" // publicationBarrier performs a store/store barrier (a "publication"
// or "export" barrier). Some form of synchronization is required // or "export" barrier). Some form of synchronization is required
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment