From bae775a4f43449e79622ed144118554ff780744a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Thu, 18 Dec 2014 10:36:33 +0200 Subject: arch/x86: Declare GDT symbols and move_gdt() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: http://review.coreboot.org/7858 Reviewed-by: Stefan Reinauer Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan --- src/arch/x86/boot/gdt.c | 12 +++++------- src/arch/x86/boot/tables.c | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/arch') 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 #include #include -#include #include - -// Global Descriptor Table, defined in c_start.S -extern char gdt; -extern char gdt_end; +#include /* 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); diff --git a/src/arch/x86/boot/tables.c b/src/arch/x86/boot/tables.c index 9f2afd4a2f..8685ed48df 100644 --- a/src/arch/x86/boot/tables.c +++ b/src/arch/x86/boot/tables.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include #include -- cgit v1.2.3