aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86/boot/gdt.c
diff options
context:
space:
mode:
authorStefan Reinauer <stefan.reinauer@coreboot.org>2015-06-18 01:23:48 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-07-13 21:04:36 +0200
commit9693885ad88d21ead7bd9ebc32f3e4901841b18b (patch)
treece6fed36947956e17303cf7cbe9cfd2004022b10 /src/arch/x86/boot/gdt.c
parent492a07593b3d74d4b10fce95e5229cbd4535b1cb (diff)
x86: Port x86 over to compile cleanly with x86-64
Change-Id: I26f1bbf027435be593f11bce4780111dcaf7cb86 Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Signed-off-by: Scott Duplichan <scott@notabs.org> Reviewed-on: http://review.coreboot.org/10586 Tested-by: build bot (Jenkins) Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com> Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/arch/x86/boot/gdt.c')
-rw-r--r--src/arch/x86/boot/gdt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/arch/x86/boot/gdt.c b/src/arch/x86/boot/gdt.c
index 44156ea3f6..a21fab24ad 100644
--- a/src/arch/x86/boot/gdt.c
+++ b/src/arch/x86/boot/gdt.c
@@ -26,7 +26,11 @@
/* i386 lgdt argument */
struct gdtarg {
u16 limit;
+#ifdef __x86_64__
+ u64 base;
+#else
u32 base;
+#endif
} __attribute__((packed));
/* Copy GDT to new location and reload it.
@@ -35,7 +39,7 @@ struct gdtarg {
static void move_gdt(int is_recovery)
{
void *newgdt;
- u16 num_gdt_bytes = (u32)&gdt_end - (u32)&gdt;
+ u16 num_gdt_bytes = (uintptr_t)&gdt_end - (uintptr_t)&gdt;
struct gdtarg gdtarg;
newgdt = cbmem_find(CBMEM_ID_GDT);
@@ -49,7 +53,7 @@ static void move_gdt(int is_recovery)
memcpy((void*)newgdt, &gdt, num_gdt_bytes);
}
- gdtarg.base = (u32)newgdt;
+ gdtarg.base = (uintptr_t)newgdt;
gdtarg.limit = num_gdt_bytes - 1;
__asm__ __volatile__ ("lgdt %0\n\t" : : "m" (gdtarg));