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>
This commit is contained in:
Kyösti Mälkki
2014-12-18 10:36:33 +02:00
parent a91e1e6cc1
commit bae775a4f4
6 changed files with 42 additions and 21 deletions

View File

@@ -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);

View File

@@ -21,6 +21,7 @@
#include <console/console.h>
#include <cpu/cpu.h>
#include <cpu/x86/gdt.h>
#include <boot/tables.h>
#include <boot/coreboot_tables.h>
#include <arch/pirq_routing.h>
@@ -28,7 +29,6 @@
#include <arch/acpi.h>
#include <string.h>
#include <cbmem.h>
#include <lib.h>
#include <smbios.h>