Commit cbaa8e5f authored by Clément Chigot's avatar Clément Chigot Committed by Ian Lance Taylor

runtime: move libcall to stack for runtime syscalls on AIX

As the stackguard was increased on AIX by CL 157117, every syscalls can
now have libcall directly on the stack. This fixes some concurrency bugs
which seems to occur when semasleep is interrupted by a SIGPROF signal.

Change-Id: I905a9618d13ef227dad6f8328b0f958f2f917a5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/172359
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 4312a18b
......@@ -169,12 +169,13 @@ func syscall0(fn *libFunc) (r, err uintptr) {
resetLibcall = false // See comment in sys_darwin.go:libcCall
}
c := &mp.libcall
c.fn = uintptr(unsafe.Pointer(fn))
c.n = 0
c.args = uintptr(noescape(unsafe.Pointer(&fn))) // it's unused but must be non-nil, otherwise crashes
c := libcall{
fn: uintptr(unsafe.Pointer(fn)),
n: 0,
args: uintptr(unsafe.Pointer(&fn)), // it's unused but must be non-nil, otherwise crashes
}
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(c))
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
if resetLibcall {
mp.libcallsp = 0
......@@ -199,12 +200,13 @@ func syscall1(fn *libFunc, a0 uintptr) (r, err uintptr) {
resetLibcall = false // See comment in sys_darwin.go:libcCall
}
c := &gp.m.libcall
c.fn = uintptr(unsafe.Pointer(fn))
c.n = 1
c.args = uintptr(noescape(unsafe.Pointer(&a0)))
c := libcall{
fn: uintptr(unsafe.Pointer(fn)),
n: 1,
args: uintptr(unsafe.Pointer(&a0)),
}
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(c))
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
if resetLibcall {
mp.libcallsp = 0
......@@ -230,12 +232,13 @@ func syscall2(fn *libFunc, a0, a1 uintptr) (r, err uintptr) {
resetLibcall = false // See comment in sys_darwin.go:libcCall
}
c := &gp.m.libcall
c.fn = uintptr(unsafe.Pointer(fn))
c.n = 2
c.args = uintptr(noescape(unsafe.Pointer(&a0)))
c := libcall{
fn: uintptr(unsafe.Pointer(fn)),
n: 2,
args: uintptr(unsafe.Pointer(&a0)),
}
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(c))
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
if resetLibcall {
mp.libcallsp = 0
......@@ -261,12 +264,13 @@ func syscall3(fn *libFunc, a0, a1, a2 uintptr) (r, err uintptr) {
resetLibcall = false // See comment in sys_darwin.go:libcCall
}
c := &gp.m.libcall
c.fn = uintptr(unsafe.Pointer(fn))
c.n = 3
c.args = uintptr(noescape(unsafe.Pointer(&a0)))
c := libcall{
fn: uintptr(unsafe.Pointer(fn)),
n: 3,
args: uintptr(unsafe.Pointer(&a0)),
}
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(c))
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
if resetLibcall {
mp.libcallsp = 0
......@@ -292,12 +296,13 @@ func syscall4(fn *libFunc, a0, a1, a2, a3 uintptr) (r, err uintptr) {
resetLibcall = false // See comment in sys_darwin.go:libcCall
}
c := &gp.m.libcall
c.fn = uintptr(unsafe.Pointer(fn))
c.n = 4
c.args = uintptr(noescape(unsafe.Pointer(&a0)))
c := libcall{
fn: uintptr(unsafe.Pointer(fn)),
n: 4,
args: uintptr(unsafe.Pointer(&a0)),
}
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(c))
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
if resetLibcall {
mp.libcallsp = 0
......@@ -323,12 +328,13 @@ func syscall5(fn *libFunc, a0, a1, a2, a3, a4 uintptr) (r, err uintptr) {
resetLibcall = false // See comment in sys_darwin.go:libcCall
}
c := &gp.m.libcall
c.fn = uintptr(unsafe.Pointer(fn))
c.n = 5
c.args = uintptr(noescape(unsafe.Pointer(&a0)))
c := libcall{
fn: uintptr(unsafe.Pointer(fn)),
n: 5,
args: uintptr(unsafe.Pointer(&a0)),
}
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(c))
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
if resetLibcall {
mp.libcallsp = 0
......@@ -354,12 +360,13 @@ func syscall6(fn *libFunc, a0, a1, a2, a3, a4, a5 uintptr) (r, err uintptr) {
resetLibcall = false // See comment in sys_darwin.go:libcCall
}
c := &gp.m.libcall
c.fn = uintptr(unsafe.Pointer(fn))
c.n = 6
c.args = uintptr(noescape(unsafe.Pointer(&a0)))
c := libcall{
fn: uintptr(unsafe.Pointer(fn)),
n: 6,
args: uintptr(unsafe.Pointer(&a0)),
}
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(c))
asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
if resetLibcall {
mp.libcallsp = 0
......
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