x86, boot: Update comments about entries for 64bit image
[firefly-linux-kernel-4.4.55.git] / arch / x86 / boot / compressed / head_64.S
index 2c4b171eec337619e8f2dab2b3c3b2048e622e51..d9ae9a4ffcb981ea165ccec893c8e3d28bbe1ff3 100644 (file)
        __HEAD
        .code32
 ENTRY(startup_32)
+       /*
+        * 32bit entry is 0 and it is ABI so immutable!
+        * If we come here directly from a bootloader,
+        * kernel(text+data+bss+brk) ramdisk, zero_page, command line
+        * all need to be under the 4G limit.
+        */
        cld
        /*
         * Test KEEP_SEGMENTS flag to see if the bootloader is asking
@@ -154,6 +160,12 @@ ENTRY(startup_32)
        btsl    $_EFER_LME, %eax
        wrmsr
 
+       /* After gdt is loaded */
+       xorl    %eax, %eax
+       lldt    %ax
+       movl    $0x20, %eax
+       ltr     %ax
+
        /*
         * Setup for the jump to 64bit mode
         *
@@ -176,28 +188,18 @@ ENTRY(startup_32)
        lret
 ENDPROC(startup_32)
 
-no_longmode:
-       /* This isn't an x86-64 CPU so hang */
-1:
-       hlt
-       jmp     1b
-
-#include "../../kernel/verify_cpu.S"
-
-       /*
-        * Be careful here startup_64 needs to be at a predictable
-        * address so I can export it in an ELF header.  Bootloaders
-        * should look at the ELF header to find this address, as
-        * it may change in the future.
-        */
        .code64
        .org 0x200
 ENTRY(startup_64)
        /*
+        * 64bit entry is 0x200 and it is ABI so immutable!
         * We come here either from startup_32 or directly from a
-        * 64bit bootloader.  If we come here from a bootloader we depend on
-        * an identity mapped page table being provied that maps our
-        * entire text+data+bss and hopefully all of memory.
+        * 64bit bootloader.
+        * If we come here from a bootloader, kernel(text+data+bss+brk),
+        * ramdisk, zero_page, command line could be above 4G.
+        * We depend on an identity mapped page table being provided
+        * that maps our entire kernel(text+data+bss+brk), zero page
+        * and command line.
         */
 #ifdef CONFIG_EFI_STUB
        /*
@@ -247,9 +249,6 @@ preferred_addr:
        movl    %eax, %ss
        movl    %eax, %fs
        movl    %eax, %gs
-       lldt    %ax
-       movl    $0x20, %eax
-       ltr     %ax
 
        /*
         * Compute the decompressed kernel start address.  It is where
@@ -349,6 +348,15 @@ relocated:
  */
        jmp     *%rbp
 
+       .code32
+no_longmode:
+       /* This isn't an x86-64 CPU so hang */
+1:
+       hlt
+       jmp     1b
+
+#include "../../kernel/verify_cpu.S"
+
        .data
 gdt:
        .word   gdt_end - gdt