1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:10:08 -07:00

runtime: add nowritebarrierrec to funcs called at signal time

Also nosplit where needed.

Change-Id: I1e3f6f8f76df9ee7e87ed1b8560cef145928314c
Reviewed-on: https://go-review.googlesource.com/18395
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2016-01-07 20:28:04 -08:00
parent a120beaa8d
commit 84a95be922
7 changed files with 10 additions and 0 deletions

View File

@ -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)))
}
//go:nosplit
//go:nowritebarrierrec
func sigaltstack(ss *sigaltstackt, oss *sigaltstackt) /* int32 */ {
sysvicall2(&libc_sigaltstack, uintptr(unsafe.Pointer(ss)), uintptr(unsafe.Pointer(oss)))
}

View File

@ -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
// signal to the handler that was installed before Go's. Returns whether the
// signal was forwarded.
// This is called by the signal handler, and the world may be stopped.
//go:nosplit
//go:nowritebarrierrec
func sigfwdgo(sig uint32, info *siginfo, ctx unsafe.Pointer) bool {
if sig >= uint32(len(sigtable)) {
return false

View File

@ -50,6 +50,7 @@ var sigtable = [...]sigTabT{
func sigreturn(ctx unsafe.Pointer, infostyle uint32)
//go:nosplit
//go:nowritebarrierrec
func sigtrampgo(fn uintptr, infostyle, sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) {
sigreturn(ctx, infostyle)

View File

@ -48,6 +48,7 @@ var sigtable = [...]sigTabT{
}
//go:nosplit
//go:nowritebarrierrec
func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) {
return

View File

@ -48,6 +48,7 @@ var sigtable = [...]sigTabT{
}
//go:nosplit
//go:nowritebarrierrec
func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) {
return

View File

@ -9,7 +9,9 @@ package runtime
import "unsafe"
// Continuation of the (assembly) sigtramp() logic.
// This may be called with the world stopped.
//go:nosplit
//go:nowritebarrierrec
func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
if sigfwdgo(sig, info, ctx) {
return

View File

@ -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.
//go:nosplit
//go:norace
//go:nowritebarrierrec
func badsignal(sig uintptr) {
cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig))
}