summaryrefslogtreecommitdiff
path: root/src/arch/x86/boot/gdt.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-12-18 10:36:33 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2014-12-31 09:51:50 +0100
commitbae775a4f43449e79622ed144118554ff780744a (patch)
treede6094464d801f18c33bb6e929ee9afef0cfce82 /src/arch/x86/boot/gdt.c
parenta91e1e6cc18b3d510a8dd5e3b2c7bdbba3299369 (diff)
arch/x86: Declare GDT symbols and move_gdt()
We relocate GDT to CBMEM, this can be done late in ramstage. Note: We currently do this for BSP CPU only. Change-Id: I626faaf22f846433f25ca2253d6a2a5230f50b6b Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/7858 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'src/arch/x86/boot/gdt.c')
-rw-r--r--src/arch/x86/boot/gdt.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/arch/x86/boot/gdt.c b/src/arch/x86/boot/gdt.c
index 7ebf92ae85..7b64af7c2e 100644
--- a/src/arch/x86/boot/gdt.c
+++ b/src/arch/x86/boot/gdt.c
@@ -20,12 +20,8 @@
#include <types.h>
#include <string.h>
#include <cbmem.h>
-#include <lib.h>
#include <console/console.h>
-
-// Global Descriptor Table, defined in c_start.S
-extern char gdt;
-extern char gdt_end;
+#include <cpu/x86/gdt.h>
/* i386 lgdt argument */
struct gdtarg {
@@ -33,11 +29,13 @@ struct gdtarg {
u32 base;
} __attribute__((packed));
-// Copy GDT to new location and reload it
+/* Copy GDT to new location and reload it.
+ * FIXME: We only do this for BSP CPU.
+ */
void move_gdt(void)
{
void *newgdt;
- u16 num_gdt_bytes = &gdt_end - &gdt;
+ u16 num_gdt_bytes = (u32)&gdt_end - (u32)&gdt;
struct gdtarg gdtarg;
newgdt = cbmem_find(CBMEM_ID_GDT);