Skip to content

Commit 7f153cc

Browse files
Ard Biesheuvelwilldeacon
authored andcommitted
arm64/lib: copy_page: avoid x18 register in assembler code
Register x18 will no longer be used as a caller save register in the future, so stop using it in the copy_page() code. Link: https://patchwork.kernel.org/patch/9836869/ Signed-off-by: Ard Biesheuvel <[email protected]> [Sami: changed the offset and bias to be explicit] Signed-off-by: Sami Tolvanen <[email protected]> Reviewed-by: Mark Rutland <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent e3ec658 commit 7f153cc

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

arch/arm64/lib/copy_page.S

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,45 +34,45 @@ alternative_else_nop_endif
3434
ldp x14, x15, [x1, #96]
3535
ldp x16, x17, [x1, #112]
3636

37-
mov x18, #(PAGE_SIZE - 128)
37+
add x0, x0, #256
3838
add x1, x1, #128
3939
1:
40-
subs x18, x18, #128
40+
tst x0, #(PAGE_SIZE - 1)
4141

4242
alternative_if ARM64_HAS_NO_HW_PREFETCH
4343
prfm pldl1strm, [x1, #384]
4444
alternative_else_nop_endif
4545

46-
stnp x2, x3, [x0]
46+
stnp x2, x3, [x0, #-256]
4747
ldp x2, x3, [x1]
48-
stnp x4, x5, [x0, #16]
48+
stnp x4, x5, [x0, #16 - 256]
4949
ldp x4, x5, [x1, #16]
50-
stnp x6, x7, [x0, #32]
50+
stnp x6, x7, [x0, #32 - 256]
5151
ldp x6, x7, [x1, #32]
52-
stnp x8, x9, [x0, #48]
52+
stnp x8, x9, [x0, #48 - 256]
5353
ldp x8, x9, [x1, #48]
54-
stnp x10, x11, [x0, #64]
54+
stnp x10, x11, [x0, #64 - 256]
5555
ldp x10, x11, [x1, #64]
56-
stnp x12, x13, [x0, #80]
56+
stnp x12, x13, [x0, #80 - 256]
5757
ldp x12, x13, [x1, #80]
58-
stnp x14, x15, [x0, #96]
58+
stnp x14, x15, [x0, #96 - 256]
5959
ldp x14, x15, [x1, #96]
60-
stnp x16, x17, [x0, #112]
60+
stnp x16, x17, [x0, #112 - 256]
6161
ldp x16, x17, [x1, #112]
6262

6363
add x0, x0, #128
6464
add x1, x1, #128
6565

66-
b.gt 1b
66+
b.ne 1b
6767

68-
stnp x2, x3, [x0]
69-
stnp x4, x5, [x0, #16]
70-
stnp x6, x7, [x0, #32]
71-
stnp x8, x9, [x0, #48]
72-
stnp x10, x11, [x0, #64]
73-
stnp x12, x13, [x0, #80]
74-
stnp x14, x15, [x0, #96]
75-
stnp x16, x17, [x0, #112]
68+
stnp x2, x3, [x0, #-256]
69+
stnp x4, x5, [x0, #16 - 256]
70+
stnp x6, x7, [x0, #32 - 256]
71+
stnp x8, x9, [x0, #48 - 256]
72+
stnp x10, x11, [x0, #64 - 256]
73+
stnp x12, x13, [x0, #80 - 256]
74+
stnp x14, x15, [x0, #96 - 256]
75+
stnp x16, x17, [x0, #112 - 256]
7676

7777
ret
7878
ENDPROC(copy_page)

0 commit comments

Comments
 (0)