Skip to content

Commit 149f91b

Browse files
[compiler-rt][AArch64] Don't use x18 in __arm_sme_save (#157802)
The AAPCS recommends avoiding the use of x18 as it may be used for other purposes such as a shadow call stack. In this particular case it could just as well use x16 instead.
1 parent 6c11130 commit 149f91b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler-rt/lib/builtins/aarch64/sme-abi.S

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,17 +280,17 @@ DEFINE_COMPILERRT_FUNCTION(__arm_sme_save)
280280
mov w16, #1
281281
str x16, [x0]
282282

283-
add x18, x0, #32
283+
add x16, x0, #32
284284
tbz x17, #FEAT_SME2_BIT, 1f
285285

286286
// Store ZT0
287-
str zt0, [x18]
288-
add x18, x18, #64
287+
str zt0, [x16]
288+
add x16, x16, #64
289289

290290
1:
291-
// Set up lazy-save (x18 = pointer to buffer)
291+
// Set up lazy-save (x16 = pointer to buffer)
292292
rdsvl x17, #1
293-
str x18, [x0, #16]!
293+
str x16, [x0, #16]!
294294
strh w17, [x0, #8]
295295
strh wzr, [x0, #10]
296296
str wzr, [x0, #12]

0 commit comments

Comments
 (0)