runtime: move getcallersp to internal/runtime/sys

Moving these intrinsics to a base package enables other internal/runtime
packages to use them.

For #54766.

Change-Id: I45a530422207dd94b5ad4eee51216c9410a84040
Reviewed-on: https://go-review.googlesource.com/c/go/+/613261
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Michael Pratt 2024-09-16 15:58:36 -04:00
parent 41ca2637d4
commit 4f881115d4
26 changed files with 110 additions and 155 deletions

View file

@ -405,7 +405,7 @@ func sigFetchG(c *sigctxt) *g {
// bottom of the signal stack. Fetch from there.
// TODO: in efence mode, stack is sysAlloc'd, so this wouldn't
// work.
sp := getcallersp()
sp := sys.GetCallerSP()
s := spanOf(sp)
if s != nil && s.state.get() == mSpanManual && s.base() < sp && sp < s.limit {
gp := *(**g)(unsafe.Pointer(s.base()))
@ -479,7 +479,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
var gsignalStack gsignalStack
setStack := adjustSignalStack(sig, gp.m, &gsignalStack)
if setStack {
gp.m.gsignal.stktopsp = getcallersp()
gp.m.gsignal.stktopsp = sys.GetCallerSP()
}
if gp.stackguard0 == stackFork {