// "system call", run the Go code (which may grow the stack),
// and then re-enter the "system call" reusing the PC and SP
// saved by entersyscall here.
- entersyscall(0)
+ entersyscall()
mp.incgo = true
errno := asmcgocall(fn, arg)
// reschedule us on to a different M.
endcgo(mp)
- exitsyscall(0)
+ exitsyscall()
// From the garbage collector's perspective, time can move
// backwards in the sequence above. If there's a callback into
// save syscall* and let reentersyscall restore them.
savedsp := unsafe.Pointer(gp.syscallsp)
savedpc := gp.syscallpc
- exitsyscall(0) // coming out of cgo call
+ exitsyscall() // coming out of cgo call
gp.m.incgo = false
cgocallbackg1(ctxt)
//go:noinline
func TracebackSystemstack(stk []uintptr, i int) int {
if i == 0 {
- pc, sp := getcallerpc(), getcallersp(unsafe.Pointer(&stk))
+ pc, sp := getcallerpc(), getcallersp()
return gentraceback(pc, sp, 0, getg(), 0, &stk[0], len(stk), nil, nil, _TraceJumpStack)
}
n := 0
tt.ch = make(chan *futexsleepTest, 1)
wg.Add(1)
go func(tt *futexsleepTest) {
- runtime.Entersyscall(0)
+ runtime.Entersyscall()
runtime.Futexsleep(&tt.mtx, 0, tt.ns)
- runtime.Exitsyscall(0)
+ runtime.Exitsyscall()
tt.ch <- tt
wg.Done()
}(tt)
throw("notetsleepg on g0")
}
- entersyscallblock(0)
+ entersyscallblock()
ok := notetsleep_internal(n, ns)
- exitsyscall(0)
+ exitsyscall()
return ok
}
throw("notetsleepg on g0")
}
semacreate(gp.m)
- entersyscallblock(0)
+ entersyscallblock()
ok := notetsleep_internal(n, ns, nil, 0)
- exitsyscall(0)
+ exitsyscall()
return ok
}
r := p
// Save current goroutine.
- sp := getcallersp(unsafe.Pointer(&p))
+ sp := getcallersp()
pc := getcallerpc()
systemstack(func() {
saveg(pc, sp, gp, &r[0])
n := 0
if len(buf) > 0 {
gp := getg()
- sp := getcallersp(unsafe.Pointer(&buf))
+ sp := getcallersp()
pc := getcallerpc()
systemstack(func() {
g0 := getg()
if gp.m.curg == nil || gp == gp.m.curg {
goroutineheader(gp)
pc := getcallerpc()
- sp := getcallersp(unsafe.Pointer(&p))
+ sp := getcallersp()
systemstack(func() {
traceback(pc, sp, 0, gp)
})
print("tracefree(", p, ", ", hex(size), ")\n")
goroutineheader(gp)
pc := getcallerpc()
- sp := getcallersp(unsafe.Pointer(&p))
+ sp := getcallersp()
systemstack(func() {
traceback(pc, sp, 0, gp)
})
b.RunParallel(func(pb *testing.PB) {
foo := 42
for pb.Next() {
- runtime.Entersyscall(0)
+ runtime.Entersyscall()
for i := 0; i < work; i++ {
foo *= 2
foo /= 2
}
- runtime.Exitsyscall(0)
+ runtime.Exitsyscall()
}
_ = foo
})
mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them
- mp.libcallsp = getcallersp(unsafe.Pointer(&fn))
+ mp.libcallsp = getcallersp()
}
var libcall libcall
mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them
- mp.libcallsp = getcallersp(unsafe.Pointer(&fn))
+ mp.libcallsp = getcallersp()
}
var libcall libcall
mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them
- mp.libcallsp = getcallersp(unsafe.Pointer(&fn))
+ mp.libcallsp = getcallersp()
}
var libcall libcall
mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them
- mp.libcallsp = getcallersp(unsafe.Pointer(&fn))
+ mp.libcallsp = getcallersp()
}
var libcall libcall
mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them
- mp.libcallsp = getcallersp(unsafe.Pointer(&fn))
+ mp.libcallsp = getcallersp()
}
var libcall libcall
mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them
- mp.libcallsp = getcallersp(unsafe.Pointer(&fn))
+ mp.libcallsp = getcallersp()
}
var libcall libcall
mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them
- mp.libcallsp = getcallersp(unsafe.Pointer(&fn))
+ mp.libcallsp = getcallersp()
}
var libcall libcall
mp.libcallpc = getcallerpc()
// sp must be the last, because once async cpu profiler finds
// all three values to be non-zero, it will use them
- mp.libcallsp = getcallersp(unsafe.Pointer(&fn))
+ mp.libcallsp = getcallersp()
}
asmcgocall(asmstdcallAddr, unsafe.Pointer(&mp.libcall))
mp.libcallsp = 0
// collection or stack copying trigger until we've copied them out
// to somewhere safe. The memmove below does that.
// Until the copy completes, we can only call nosplit routines.
- sp := getcallersp(unsafe.Pointer(&siz))
+ sp := getcallersp()
argp := uintptr(unsafe.Pointer(&fn)) + unsafe.Sizeof(fn)
callerpc := getcallerpc()
if d == nil {
return
}
- sp := getcallersp(unsafe.Pointer(&arg0))
+ sp := getcallersp()
if d.sp != sp {
return
}
//go:nosplit
func fatalpanic(msgs *_panic) {
pc := getcallerpc()
- sp := getcallersp(unsafe.Pointer(&msgs))
+ sp := getcallersp()
gp := getg()
// Switch to the system stack to avoid any stack growth, which
// may make things worse if the runtime is in a bad state.
// both Go and C functions with stack growth prologues.
_g_.stackguard0 = _g_.stack.lo + _StackGuard
_g_.stackguard1 = _g_.stackguard0
- mstart1(0)
+ mstart1()
// Exit this thread.
if GOOS == "windows" || GOOS == "solaris" || GOOS == "plan9" {
mexit(osStack)
}
-func mstart1(dummy int32) {
+func mstart1() {
_g_ := getg()
if _g_ != _g_.m.g0 {
// for terminating the thread.
// We're never coming back to mstart1 after we call schedule,
// so other calls can reuse the current frame.
- save(getcallerpc(), getcallersp(unsafe.Pointer(&dummy)))
+ save(getcallerpc(), getcallersp())
asminit()
minit()
// Standard syscall entry used by the go syscall library and normal cgo calls.
//go:nosplit
-func entersyscall(dummy int32) {
- reentersyscall(getcallerpc(), getcallersp(unsafe.Pointer(&dummy)))
+func entersyscall() {
+ reentersyscall(getcallerpc(), getcallersp())
}
func entersyscall_sysmon() {
// The same as entersyscall(), but with a hint that the syscall is blocking.
//go:nosplit
-func entersyscallblock(dummy int32) {
+func entersyscallblock() {
_g_ := getg()
_g_.m.locks++ // see comment in entersyscall
// Leave SP around for GC and traceback.
pc := getcallerpc()
- sp := getcallersp(unsafe.Pointer(&dummy))
+ sp := getcallersp()
save(pc, sp)
_g_.syscallsp = _g_.sched.sp
_g_.syscallpc = _g_.sched.pc
systemstack(entersyscallblock_handoff)
// Resave for traceback during blocked call.
- save(getcallerpc(), getcallersp(unsafe.Pointer(&dummy)))
+ save(getcallerpc(), getcallersp())
_g_.m.locks--
}
//
//go:nosplit
//go:nowritebarrierrec
-func exitsyscall(dummy int32) {
+func exitsyscall() {
_g_ := getg()
_g_.m.locks++ // see comment in entersyscall
- if getcallersp(unsafe.Pointer(&dummy)) > _g_.syscallsp {
+ if getcallersp() > _g_.syscallsp {
throw("exitsyscall: syscall frame is no longer valid")
}
st := stackt{ss_size: g.m.g0.stack.hi - g.m.g0.stack.lo}
setSignalstackSP(&st, g.m.g0.stack.lo)
setGsignalStack(&st, &gsignalStack)
- g.m.gsignal.stktopsp = getcallersp(unsafe.Pointer(&sig))
+ g.m.gsignal.stktopsp = getcallersp()
setStack = true
} else {
var st stackt
dropm()
}
setGsignalStack(&st, &gsignalStack)
- g.m.gsignal.stktopsp = getcallersp(unsafe.Pointer(&sig))
+ g.m.gsignal.stktopsp = getcallersp()
setStack = true
}
}
// getcallerpc returns the program counter (PC) of its caller's caller.
// getcallersp returns the stack pointer (SP) of its caller's caller.
-// argp must be a pointer to the caller's first function argument.
-// The implementation may or may not use argp, depending on
-// the architecture. The implementation may be a compiler
-// intrinsic; there is not necessarily code implementing this
-// on every platform.
+// The implementation may be a compiler intrinsic; there is not
+// necessarily code implementing this on every platform.
//
// For example:
//
// func f(arg1, arg2, arg3 int) {
// pc := getcallerpc()
-// sp := getcallersp(unsafe.Pointer(&arg1))
+// sp := getcallersp()
// }
//
// These two lines find the PC and SP immediately following
func getcallerpc() uintptr
//go:noescape
-func getcallersp(argp unsafe.Pointer) uintptr // implemented as an intrinsic on all platforms
+func getcallersp() uintptr // implemented as an intrinsic on all platforms
// getclosureptr returns the pointer to the current closure.
// getclosureptr can only be used in an assignment statement
n: nargs,
args: uintptr(unsafe.Pointer(&a1)),
}
- entersyscallblock(0)
+ entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
- exitsyscall(0)
+ exitsyscall()
return call.r1, call.r2, call.err
}
n: 2,
args: uintptr(unsafe.Pointer(&args[0])),
}
- entersyscallblock(0)
+ entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
- exitsyscall(0)
+ exitsyscall()
if call.r1 != 0 {
return "", call.err
}
n: 0,
args: uintptr(unsafe.Pointer(&pipe1)), // it's unused but must be non-nil, otherwise crashes
}
- entersyscallblock(0)
+ entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
- exitsyscall(0)
+ exitsyscall()
return call.r1, call.r2, call.err
}
n: 4,
args: uintptr(unsafe.Pointer(&trap)),
}
- entersyscallblock(0)
+ entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
- exitsyscall(0)
+ exitsyscall()
return call.r1, call.r2, call.err
}
n: 4,
args: uintptr(unsafe.Pointer(&pid)),
}
- entersyscallblock(0)
+ entersyscallblock()
asmcgocall(unsafe.Pointer(&asmsysvicall6), unsafe.Pointer(&call))
- exitsyscall(0)
+ exitsyscall()
return int(call.r1), call.err
}
}
func callers(skip int, pcbuf []uintptr) int {
- sp := getcallersp(unsafe.Pointer(&skip))
+ sp := getcallersp()
pc := getcallerpc()
gp := getg()
var n int