From: Joel Sing Date: Wed, 5 Feb 2025 13:38:51 +0000 (+1100) Subject: runtime: use return for async preemption resumption on arm64 X-Git-Tag: go1.25rc1~1012 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=77343fa646c5d2a01fb3cbeabda1b3ff008c3b03;p=gostls13.git runtime: use return for async preemption resumption on arm64 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui --- diff --git a/src/runtime/mkpreempt.go b/src/runtime/mkpreempt.go index 08500a90d5..6a9cf77a43 100644 --- a/src/runtime/mkpreempt.go +++ b/src/runtime/mkpreempt.go @@ -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) { diff --git a/src/runtime/preempt_arm64.s b/src/runtime/preempt_arm64.s index c27d475dee..31ec9d940f 100644 --- a/src/runtime/preempt_arm64.s +++ b/src/runtime/preempt_arm64.s @@ -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)