Attention is currently required from: Jérémy Compostella, Shuo Liu.
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/87254?usp=email )
Change subject: arch/x86: Use defines for GDT segments ......................................................................
arch/x86: Use defines for GDT segments
Stop using magic values and use defines for GDT offsets.
Change-Id: I40c15f6341bdef9cd457619ec81e7ac624ec2d63 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/arch/x86/wakeup.S M src/cpu/x86/smm/smm_stub.S M src/device/oprom/realmode/x86_asm.S 3 files changed, 10 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/54/87254/1
diff --git a/src/arch/x86/wakeup.S b/src/arch/x86/wakeup.S index 7462dad..7bff006 100644 --- a/src/arch/x86/wakeup.S +++ b/src/arch/x86/wakeup.S @@ -1,5 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <arch/ram_segs.h> + #define WAKEUP_BASE 0x600 #define RELOCATED(x) (x - __wakeup + WAKEUP_BASE)
@@ -29,7 +31,7 @@ add $8, %rax push %rax pushfq - push $0x10 + push $RAM_CODE_SEG lea 3(%rip), %rax push %rax iretq @@ -58,7 +60,7 @@ movw %ax, (__wakeup_segment)
/* Activate the right segment descriptor real mode. */ - ljmp $0x28, $RELOCATED(1f) + ljmp $RAM_CODE16_SEG, $RELOCATED(1f) 1: .code16 /* 16 bit code from here on... */ @@ -68,7 +70,7 @@ * configurations (limits, writability, etc.) once * protected mode is turned off. */ - mov $0x30, %ax + mov $RAM_DATA16_SEG, %ax mov %ax, %ds mov %ax, %es mov %ax, %fs diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S index 9b4b966..e42d232 100644 --- a/src/cpu/x86/smm/smm_stub.S +++ b/src/cpu/x86/smm/smm_stub.S @@ -9,6 +9,7 @@ * found in smm.h. */
+#include <arch/rom_segs.h> #include <cpu/x86/cr.h> #include <cpu/x86/msr.h> #include <cpu/x86/lapic_def.h> @@ -93,8 +94,9 @@ movl %eax, %cr0
/* Enable protected mode */ - ljmpl $0x8, $smm_trampoline32 + ljmpl $ROM_CODE_SEG, $smm_trampoline32
+/* .align 4 smm_relocate_gdt: /* The first GDT entry is used for the lgdt instruction. */ @@ -124,7 +126,7 @@ .global smm_trampoline32 smm_trampoline32: /* Use flat data segment */ - movw $0x10, %ax + movw $ROM_DATA_SEG, %ax movw %ax, %ds movw %ax, %es movw %ax, %ss diff --git a/src/device/oprom/realmode/x86_asm.S b/src/device/oprom/realmode/x86_asm.S index a2c4aa5..ff33c0f 100644 --- a/src/device/oprom/realmode/x86_asm.S +++ b/src/device/oprom/realmode/x86_asm.S @@ -150,7 +150,7 @@ mov %ax, %es mov %ax, %fs mov %ax, %gs - mov $0x40, %ax + mov $RAM_DATA_ACPI_SEG, %ax mov %ax, %ds pop %ax