From: Christian Hoffmann Date: Tue, 7 Feb 2023 21:12:53 +0000 (+0100) Subject: Revert "arm64: entry: Free up another register on kpti's tramp_exit path" X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=219164d083aace73f78b6bbb178785bf6ba42764;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Revert "arm64: entry: Free up another register on kpti's tramp_exit path" This reverts commit a212d166a9d7c35e56ba11f15d6706eee3dd499b. Change-Id: If3cc91ff73fce3af22768516835a7050958571ed --- diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 8e00c6b4074a..a07d4ffb6465 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -311,9 +311,6 @@ alternative_else_nop_endif ldp x24, x25, [sp, #16 * 12] ldp x26, x27, [sp, #16 * 13] ldp x28, x29, [sp, #16 * 14] - - .if \el == 0 -alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 ldr lr, [sp, #S_LR] #ifdef CONFIG_AMLOGIC_VMAP /* restore context sp and per-cpu vmap stack */ @@ -328,11 +325,12 @@ alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 .endif #endif /* CONFIG_AMLOGIC_VMAP */ add sp, sp, #S_FRAME_SIZE // restore sp - eret -alternative_else_nop_endif + + .if \el == 0 +alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0 #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 bne 4f - msr far_el1, x29 + msr far_el1, x30 tramp_alias x30, tramp_exit_native, x29 br x30 4: @@ -340,8 +338,6 @@ alternative_else_nop_endif br x30 #endif .else - ldr lr, [sp, #S_LR] - add sp, sp, #S_FRAME_SIZE // restore sp eret .endif .endm @@ -1185,12 +1181,10 @@ alternative_endif ldr x30, [x30, x29] msr vbar_el1, x30 - ldr lr, [sp, #S_LR] - tramp_unmap_kernel x29 + tramp_unmap_kernel x30 .if \regsize == 64 - mrs x29, far_el1 + mrs x30, far_el1 .endif - add sp, sp, #S_FRAME_SIZE // restore sp eret .endm