summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpu/x86/32bit/entry32.inc4
-rw-r--r--src/cpu/x86/lapic/lapic_cpu_init.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/src/cpu/x86/32bit/entry32.inc b/src/cpu/x86/32bit/entry32.inc
index b016f8eb16..5c3072e8dc 100644
--- a/src/cpu/x86/32bit/entry32.inc
+++ b/src/cpu/x86/32bit/entry32.inc
@@ -27,6 +27,10 @@ gdtptr:
.word 0xffff, 0x0000
.byte 0x00, 0x93, 0xcf, 0x00
+ /* selgdt 0x18, flat code segment (64-bit) */
+ .word 0xffff, 0x0000
+ .byte 0x00, 0x9b, 0xaf, 0x00
+
gdt_end:
diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c
index 0e2550fb6f..0e314fd108 100644
--- a/src/cpu/x86/lapic/lapic_cpu_init.c
+++ b/src/cpu/x86/lapic/lapic_cpu_init.c
@@ -58,13 +58,17 @@ int lowmem_backup_size;
static inline void setup_secondary_gdt(void)
{
u16 *gdt_limit;
+#ifdef __x86_64__
+ u64 *gdt_base;
+#else
u32 *gdt_base;
+#endif
gdt_limit = (void *)&_secondary_gdt_addr;
gdt_base = (void *)&gdt_limit[1];
- *gdt_limit = (u32)&gdt_end - (u32)&gdt - 1;
- *gdt_base = (u32)&gdt;
+ *gdt_limit = (uintptr_t)&gdt_end - (uintptr_t)&gdt - 1;
+ *gdt_base = (uintptr_t)&gdt;
}
static void copy_secondary_start_to_lowest_1M(void)