Commit a360190e authored by Pavel Tatashin's avatar Pavel Tatashin Committed by Will Deacon
Browse files

arm64: kexec: arm64_relocate_new_kernel don't use x0 as temp



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: default avatarPavel Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: default avatarJames Morse <james.morse@arm.com>
Link: https://lore.kernel.org/r/20210125191923.1060122-13-pasha.tatashin@soleen.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent dbd82fee
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -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