aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mkpreempt.go
diff options
context:
space:
mode:
authorKatie Hockman <katie@golang.org>2020-12-14 10:03:05 -0500
committerKatie Hockman <katie@golang.org>2020-12-14 10:06:13 -0500
commit0345ede87ee12698988973884cfc0fd3d499dffd (patch)
tree7123cff141ee5661208d2f5f437b8f5252ac7f6a /src/runtime/mkpreempt.go
parent4651d6b267818b0e0d128a5443289717c4bb8cbc (diff)
parent0a02371b0576964e81c3b40d328db9a3ef3b031b (diff)
downloadgo-0345ede87ee12698988973884cfc0fd3d499dffd.tar.xz
[dev.fuzz] all: merge master into dev.fuzz
Change-Id: I5d8c8329ccc9d747bd81ade6b1cb7cb8ae2e94b2
Diffstat (limited to 'src/runtime/mkpreempt.go')
-rw-r--r--src/runtime/mkpreempt.go22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/runtime/mkpreempt.go b/src/runtime/mkpreempt.go
index 44dea22ef3..1d614dd003 100644
--- a/src/runtime/mkpreempt.go
+++ b/src/runtime/mkpreempt.go
@@ -126,7 +126,8 @@ func header(arch string) {
}
fmt.Fprintf(out, "#include \"go_asm.h\"\n")
fmt.Fprintf(out, "#include \"textflag.h\"\n\n")
- fmt.Fprintf(out, "TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0\n")
+ fmt.Fprintf(out, "// Note: asyncPreempt doesn't use the internal ABI, but we must be able to inject calls to it from the signal handler, so Go code has to see the PC of this function literally.\n")
+ fmt.Fprintf(out, "TEXT ·asyncPreempt<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-0\n")
}
func p(f string, args ...interface{}) {
@@ -189,7 +190,6 @@ func (l *layout) restore() {
func gen386() {
p("PUSHFL")
-
// Save general purpose registers.
var l = layout{sp: "SP"}
for _, reg := range regNames386 {
@@ -199,12 +199,6 @@ func gen386() {
l.add("MOVL", reg, 4)
}
- // Save the 387 state.
- l.addSpecial(
- "FSAVE %d(SP)\nFLDCW runtime·controlWord64(SB)",
- "FRSTOR %d(SP)",
- 108)
-
// Save SSE state only if supported.
lSSE := layout{stack: l.stack, sp: "SP"}
for i := 0; i < 8; i++ {
@@ -355,10 +349,10 @@ func genARM64() {
p("MOVD R29, -8(RSP)") // save frame pointer (only used on Linux)
p("SUB $8, RSP, R29") // set up new frame pointer
p("#endif")
- // On darwin, save the LR again after decrementing SP. We run the
- // signal handler on the G stack (as it doesn't support SA_ONSTACK),
+ // On iOS, save the LR again after decrementing SP. We run the
+ // signal handler on the G stack (as it doesn't support sigaltstack),
// so any writes below SP may be clobbered.
- p("#ifdef GOOS_darwin")
+ p("#ifdef GOOS_ios")
p("MOVD R30, (RSP)")
p("#endif")
@@ -502,12 +496,12 @@ func genPPC64() {
}
func genRISCV64() {
- // X0 (zero), X1 (LR), X2 (SP), X4 (g), X31 (TMP) are special.
+ // X0 (zero), X1 (LR), X2 (SP), X4 (TP), X27 (g), X31 (TMP) are special.
var l = layout{sp: "X2", stack: 8}
- // Add integer registers (X3, X5-X30).
+ // Add integer registers (X3, X5-X26, X28-30).
for i := 3; i < 31; i++ {
- if i == 4 {
+ if i == 4 || i == 27 {
continue
}
reg := fmt.Sprintf("X%d", i)