]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: enable async preemption on darwin/arm64
authorCherry Zhang <cherryyz@google.com>
Mon, 11 Nov 2019 02:57:14 +0000 (21:57 -0500)
committerCherry Zhang <cherryyz@google.com>
Tue, 12 Nov 2019 22:30:48 +0000 (22:30 +0000)
The problem should be fixed by the previous CL. Reenable async
preemption on darwin/arm64.

Updates #35439.

Change-Id: I93e8c4702b4d8fe6abaa6fc9c27def5c8aed1b59
Reviewed-on: https://go-review.googlesource.com/c/go/+/206419
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/mkpreempt.go
src/runtime/preempt_arm64.s
src/runtime/signal_arm64.go

index 987740c2f772339ae13fd8e8d65e90e27726238f..615ec1868ca2ea79ddee95fe26dd12efb3a30234 100644 (file)
@@ -342,6 +342,12 @@ 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),
+       // so any writes below SP may be clobbered.
+       p("#ifdef GOOS_darwin")
+       p("MOVD R30, (RSP)")
+       p("#endif")
 
        l.save()
        p("CALL ·asyncPreempt2(SB)")
index 3a7cdf489b1e4bf9d44c5c91e138cdee68fdcc0f..3c27b52de13b7507ee00139b87ede13c272a1c0e 100644 (file)
@@ -10,6 +10,9 @@ TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
        MOVD R29, -8(RSP)
        SUB $8, RSP, R29
        #endif
+       #ifdef GOOS_darwin
+       MOVD R30, (RSP)
+       #endif
        MOVD R0, 8(RSP)
        MOVD R1, 16(RSP)
        MOVD R2, 24(RSP)
index fb09aff6f968bda3a71bd33e18442a3da74bb6f0..db2ab2720b769440d10d43c6d0fc96a0e0a8302c 100644 (file)
@@ -79,9 +79,7 @@ func (c *sigctxt) preparePanic(sig uint32, gp *g) {
        c.set_pc(uint64(funcPC(sigpanic)))
 }
 
-// TODO(issue 35439): enabling async preemption causes failures on darwin/arm64.
-// Disable for now.
-const pushCallSupported = GOOS != "darwin"
+const pushCallSupported = true
 
 func (c *sigctxt) pushCall(targetPC uintptr) {
        // Push the LR to stack, as we'll clobber it in order to