Skip to content

Commit 77343fa

Browse files
committed
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 <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
1 parent 6790301 commit 77343fa

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/runtime/mkpreempt.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ func genARM64() {
370370
p("MOVD -8(RSP), R29") // restore frame pointer
371371
p("MOVD (RSP), R27") // load PC to REGTMP
372372
p("ADD $%d, RSP", l.stack+16) // pop frame (including the space pushed by sigctxt.pushCall)
373-
p("JMP (R27)")
373+
p("RET (R27)")
374374
}
375375

376376
func genMIPS(_64bit bool) {

src/runtime/preempt_arm64.s

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ TEXT ·asyncPreempt(SB),NOSPLIT|NOFRAME,$0-0
8282
MOVD -8(RSP), R29
8383
MOVD (RSP), R27
8484
ADD $512, RSP
85-
JMP (R27)
85+
RET (R27)

0 commit comments

Comments
 (0)