[PATCHv11 05/19] x86/relocate_kernel: Use named labels for less confusion
Nikolay Borisov
nik.borisov at suse.com
Wed May 29 03:47:50 PDT 2024
On 28.05.24 г. 12:55 ч., Kirill A. Shutemov wrote:
> From: Borislav Petkov <bp at alien8.de>
>
> That identity_mapped() functions was loving that "1" label to the point
> of completely confusing its readers.
>
> Use named labels in each place for clarity.
>
> No functional changes.
>
> Signed-off-by: Borislav Petkov (AMD) <bp at alien8.de>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov at linux.intel.com>
> ---
> arch/x86/kernel/relocate_kernel_64.S | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
> index 56cab1bb25f5..085eef5c3904 100644
> --- a/arch/x86/kernel/relocate_kernel_64.S
> +++ b/arch/x86/kernel/relocate_kernel_64.S
> @@ -148,9 +148,10 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
> */
> movl $X86_CR4_PAE, %eax
> testq $X86_CR4_LA57, %r13
> - jz 1f
> + jz .Lno_la57
> orl $X86_CR4_LA57, %eax
> -1:
> +.Lno_la57:
> +
> movq %rax, %cr4
>
> jmp 1f
That jmp 1f becomes redundant now as it simply jumps 1 line below.
> @@ -165,9 +166,9 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
> * used by kexec. Flush the caches before copying the kernel.
> */
> testq %r12, %r12
> - jz 1f
> + jz .Lsme_off
> wbinvd
> -1:
> +.Lsme_off:
>
> movq %rcx, %r11
> call swap_pages
> @@ -187,7 +188,7 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
> */
>
> testq %r11, %r11
> - jnz 1f
> + jnz .Lrelocate
> xorl %eax, %eax
> xorl %ebx, %ebx
> xorl %ecx, %ecx
> @@ -208,7 +209,7 @@ SYM_CODE_START_LOCAL_NOALIGN(identity_mapped)
> ret
> int3
>
> -1:
> +.Lrelocate:
> popq %rdx
> leaq PAGE_SIZE(%r10), %rsp
> ANNOTATE_RETPOLINE_SAFE
More information about the kexec
mailing list