]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use return for async preemption resumption on arm64
authorJoel Sing <joel@sing.id.au>
Wed, 5 Feb 2025 13:38:51 +0000 (00:38 +1100)
committerJoel Sing <joel@sing.id.au>
Sat, 15 Feb 2025 03:36:58 +0000 (19:36 -0800)
Use return with register for async preemption resumption on arm64.
This has the same behaviour as the current use of JMP, however
is permitted when Branch Target Identification is being enforced,
while a JMP with register is considered an indirect call and
requires a `BTI J` marker at the resumption address.

Updates #66054

Change-Id: I135ac577073467bedd9efd8df15b76c97dc08767
Reviewed-on: https://go-review.googlesource.com/c/go/+/646782
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/runtime/mkpreempt.go
src/runtime/preempt_arm64.s

index 08500a90d532ed8da85575de1a3720c746381738..6a9cf77a43fcf09af04b50cddf73935c97c54d49 100644 (file)
@@ -370,7 +370,7 @@ func genARM64() {
        p("MOVD -8(RSP), R29")          // restore frame pointer
        p("MOVD (RSP), R27")            // load PC to REGTMP
        p("ADD $%d, RSP", l.stack+16)   // pop frame (including the space pushed by sigctxt.pushCall)
-       p("JMP (R27)")
+       p("RET (R27)")
 }
 
 func genMIPS(_64bit bool) {
index c27d475dee6ae02eda5f967b18f34b9120ae0eb6..31ec9d940f76d4944b8f4d35892d5f011b201aca 100644 (file)
@@ -82,4 +82,4 @@ TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
        MOVD -8(RSP), R29
        MOVD (RSP), R27
        ADD $512, RSP
-       JMP (R27)
+       RET (R27)