Commit 84a95be9 authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: add nowritebarrierrec to funcs called at signal time

Also nosplit where needed.

Change-Id: I1e3f6f8f76df9ee7e87ed1b8560cef145928314c
Reviewed-on: https://go-review.googlesource.com/18395Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent a120beaa
...@@ -520,6 +520,8 @@ func sigaction(sig int32, act *sigactiont, oact *sigactiont) /* int32 */ { ...@@ -520,6 +520,8 @@ func sigaction(sig int32, act *sigactiont, oact *sigactiont) /* int32 */ {
sysvicall3(&libc_sigaction, uintptr(sig), uintptr(unsafe.Pointer(act)), uintptr(unsafe.Pointer(oact))) sysvicall3(&libc_sigaction, uintptr(sig), uintptr(unsafe.Pointer(act)), uintptr(unsafe.Pointer(oact)))
} }
//go:nosplit
//go:nowritebarrierrec
func sigaltstack(ss *sigaltstackt, oss *sigaltstackt) /* int32 */ { func sigaltstack(ss *sigaltstackt, oss *sigaltstackt) /* int32 */ {
sysvicall2(&libc_sigaltstack, uintptr(unsafe.Pointer(ss)), uintptr(unsafe.Pointer(oss))) sysvicall2(&libc_sigaltstack, uintptr(unsafe.Pointer(ss)), uintptr(unsafe.Pointer(oss)))
} }
......
...@@ -14,7 +14,9 @@ func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer) ...@@ -14,7 +14,9 @@ func sigfwd(fn uintptr, sig uint32, info *siginfo, ctx unsafe.Pointer)
// Determines if the signal should be handled by Go and if not, forwards the // Determines if the signal should be handled by Go and if not, forwards the
// signal to the handler that was installed before Go's. Returns whether the // signal to the handler that was installed before Go's. Returns whether the
// signal was forwarded. // signal was forwarded.
// This is called by the signal handler, and the world may be stopped.
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool { func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool {
if sig >= uint32(len(sigtable)) { if sig >= uint32(len(sigtable)) {
return false return false
......
...@@ -50,6 +50,7 @@ var sigtable = [...]sigTabT{ ...@@ -50,6 +50,7 @@ var sigtable = [...]sigTabT{
func sigreturn(ctx unsafe.Pointer, infostyle uint32) func sigreturn(ctx unsafe.Pointer, infostyle uint32)
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func sigtrampgo(fn uintptr, infostyle, sig uint32, info *siginfo, ctx unsafe.Pointer) { func sigtrampgo(fn uintptr, infostyle, sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) { if sigfwdgo(sig, info, ctx) {
sigreturn(ctx, infostyle) sigreturn(ctx, infostyle)
......
...@@ -48,6 +48,7 @@ var sigtable = [...]sigTabT{ ...@@ -48,6 +48,7 @@ var sigtable = [...]sigTabT{
} }
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) { if sigfwdgo(sig, info, ctx) {
return return
......
...@@ -48,6 +48,7 @@ var sigtable = [...]sigTabT{ ...@@ -48,6 +48,7 @@ var sigtable = [...]sigTabT{
} }
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) { if sigfwdgo(sig, info, ctx) {
return return
......
...@@ -9,7 +9,9 @@ package runtime ...@@ -9,7 +9,9 @@ package runtime
import "unsafe" import "unsafe"
// Continuation of the (assembly) sigtramp() logic. // Continuation of the (assembly) sigtramp() logic.
// This may be called with the world stopped.
//go:nosplit //go:nosplit
//go:nowritebarrierrec
func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) { func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) { if sigfwdgo(sig, info, ctx) {
return return
......
...@@ -180,6 +180,7 @@ func signal_ignored(s uint32) bool { ...@@ -180,6 +180,7 @@ func signal_ignored(s uint32) bool {
// This runs on a foreign stack, without an m or a g. No stack split. // This runs on a foreign stack, without an m or a g. No stack split.
//go:nosplit //go:nosplit
//go:norace //go:norace
//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))
} }
......
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