x86: Move the GDT into global_data
[oweals/u-boot.git] / arch / x86 / cpu / start.S
index 7ef8b880ec600971207ad33caed4208b36c6cdc5..313fa3ff969f9c48c732c0e1fb2694e1bfc9de4f 100644 (file)
@@ -41,17 +41,32 @@ _x86boot_start:
        wbinvd
 
        /* Tell 32-bit code it is being entered from an in-RAM copy */
-       movw    $GD_FLG_WARM_BOOT, %bx
+       movl    $GD_FLG_WARM_BOOT, %ebx
+
+       /*
+        * Zero the BIST (Built-In Self Test) value since we don't have it.
+        * It must be 0 or the previous loader would have reported an error.
+        */
+       movl    $0, %ebp
+
        jmp     1f
+
+       /* Add a way for tools to discover the _start entry point */
+       .align  4
+       .long   0x12345678
 _start:
        /*
         * This is the 32-bit cold-reset entry point, coming from start16.
-        * Set %bx to 0 to indicate this.
+        * Set %ebx to GD_FLG_COLD_BOOT to indicate this.
         */
-       movw    $GD_FLG_COLD_BOOT, %bx
-1:
+       movl    $GD_FLG_COLD_BOOT, %ebx
+
        /* Save BIST */
        movl    %eax, %ebp
+1:
+
+       /* Save table pointer */
+       movl    %ecx, %esi
 
        /* Load the segement registers to match the GDT loaded in start16.S */
        movl    $(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax
@@ -113,6 +128,15 @@ car_init_ret:
        andl    $0xfffffff0, %esp
        post_code(POST_START_STACK)
 
+       /*
+        * Debug UART is available here although it may not be plumbed out
+        * to pins depending on the board. To use it:
+        *
+        * call  debug_uart_init
+        * mov   $'a', %eax
+        * call  printch
+        */
+
        /* Zero the global data since it won't happen later */
        xorl    %eax, %eax
        movl    $GENERATED_GBL_DATA_SIZE, %ecx
@@ -129,7 +153,13 @@ car_init_ret:
        movl    %esi, (%edx)
 
 skip_hob:
+#else
+       /* Store table pointer */
+       movl    %esp, %edx
+       addl    $GD_TABLE, %edx
+       movl    %esi, (%edx)
 #endif
+
        /* Setup first parameter to setup_gdt, pointer to global_data */
        movl    %esp, %eax