]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
x86: Set up the global data pointer in C instead of asm
authorSimon Glass <sjg@chromium.org>
Thu, 13 Dec 2012 20:48:42 +0000 (20:48 +0000)
committerTom Rini <trini@ti.com>
Fri, 1 Feb 2013 20:36:53 +0000 (15:36 -0500)
We currently assume that the global data pointer is at the start of
struct global_data. We want to remove this restriction, and it is
easiest to do this in C.

Remove the asm code and add equivalent code in C.

This idea was proposed by Graeme Russ here:
   http://patchwork.ozlabs.org/patch/199741/

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Apply Graeme Russ' comments
http://patchwork.ozlabs.org/patch/206305/ here, re-order]
Signed-off-by: Tom Rini <trini@ti.com>
arch/x86/cpu/cpu.c
arch/x86/cpu/start.S

index 315e87afeb2120e4dab4929f7a6eac225348cfa6..4902f8bccc6c015a85b661e98468edd784867f0a 100644 (file)
@@ -100,7 +100,9 @@ void setup_gdt(gd_t *id, u64 *gdt_addr)
        gdt_addr[X86_GDT_ENTRY_32BIT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff);
 
        /* FS: data, read/write, 4 GB, base (Global Data Pointer) */
-       gdt_addr[X86_GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0xc093, (ulong)id, 0xfffff);
+       id->gd_addr = id;
+       gdt_addr[X86_GDT_ENTRY_32BIT_FS] = GDT_ENTRY(0xc093,
+                    (ulong)&id->gd_addr, 0xfffff);
 
        /* 16-bit CS: code, read/execute, 64 kB, base 0 */
        gdt_addr[X86_GDT_ENTRY_16BIT_CS] = GDT_ENTRY(0x109b, 0, 0x0ffff);
index e960e21f6e49d88979b3b502e163f646920dc41d..f389584567cf2823e64e3ed515823585d7875802 100644 (file)
@@ -113,9 +113,6 @@ car_init_ret:
        /* Set second parameter to setup_gdt */
        movl    %esp, %edx
 
-       /* gd->gd_addr = gd (Required to allow gd->xyz to work) */
-       movl    %eax, (%eax)
-
        /* Setup global descriptor table so gd->xyz works */
        call    setup_gdt
 
@@ -171,9 +168,6 @@ board_init_f_r_trampoline:
        /* Set second parameter to setup_gdt */
        movl    %esp, %edx
 
-       /* gd->gd_addr = gd (Required to allow gd->xyz to work) */
-       movl    %eax, (%eax)
-
        /* Setup global descriptor table so gd->xyz works */
        call    setup_gdt