Re: [PATCHv11 05/19] x86/relocate_kernel: Use named labels for less confusion

From: H. Peter Anvin
Date: Mon Jun 03 2024 - 19:47:57 EST


On 5/29/24 03:47, Nikolay Borisov wrote:

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


Sorry if this is a duplicate; something strange happened with my email.

If you are cleaning up this code anyway...

this whole piece of code can be simplified to:

and $(X86_CR4_PAE | X86_CR4_LA57), %r13d
mov %r13, %cr4

The PAE bit in %r13 is guaranteed to be set, and %r13 is dead after this.

-hpa