arm64: kexec: arm64_relocate_new_kernel don't use x0 as temp
authorPavel Tatashin <pasha.tatashin@soleen.com>
Mon, 25 Jan 2021 19:19:17 +0000 (14:19 -0500)
committerWill Deacon <will@kernel.org>
Wed, 27 Jan 2021 15:41:12 +0000 (15:41 +0000)
x0 will contain the only argument to arm64_relocate_new_kernel; don't
use it as a temp. Reassigned registers to free-up x0 so we won't need
to copy argument, and can use it at the beginning and at the end of the
function.

Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: James Morse <james.morse@arm.com>
Link: https://lore.kernel.org/r/20210125191923.1060122-13-pasha.tatashin@soleen.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/relocate_kernel.S

index 462ffbc..b78ea5d 100644 (file)
@@ -34,7 +34,7 @@ SYM_CODE_START(arm64_relocate_new_kernel)
        mov     x13, xzr                        /* x13 = copy dest */
        /* Check if the new image needs relocation. */
        tbnz    x16, IND_DONE_BIT, .Ldone
-       raw_dcache_line_size x15, x0            /* x15 = dcache line size */
+       raw_dcache_line_size x15, x1            /* x15 = dcache line size */
 .Lloop:
        and     x12, x16, PAGE_MASK             /* x12 = addr */
 
@@ -43,17 +43,17 @@ SYM_CODE_START(arm64_relocate_new_kernel)
        tbz     x16, IND_SOURCE_BIT, .Ltest_indirection
 
        /* Invalidate dest page to PoC. */
-       mov     x0, x13
-       add     x20, x0, #PAGE_SIZE
+       mov     x2, x13
+       add     x20, x2, #PAGE_SIZE
        sub     x1, x15, #1
-       bic     x0, x0, x1
-2:     dc      ivac, x0
-       add     x0, x0, x15
-       cmp     x0, x20
+       bic     x2, x2, x1
+2:     dc      ivac, x2
+       add     x2, x2, x15
+       cmp     x2, x20
        b.lo    2b
        dsb     sy
 
-       copy_page x13, x12, x0, x1, x2, x3, x4, x5, x6, x7
+       copy_page x13, x12, x1, x2, x3, x4, x5, x6, x7, x8
        b       .Lnext
 .Ltest_indirection:
        tbz     x16, IND_INDIRECTION_BIT, .Ltest_destination