arch/x86: Unify GDT entries
Currently there are 3 GDTs (Global Descriptor Tables) being used on x86: - preRAM (gdt_init.S) - SMM (smm_stub.S) - RAM (c_start.S) They have different layouts and thus different offsets for the segments being used in assembly code. Stop using different GDT segments and ensure that for ROM (preRAM + SMM) and RAM (ramstage) the segments match. RAM will have additional entries, not found in pre RAM GDT, but the segments for protected mode and 64-bit mode now match in all stages. This allows to use the same defines in all stages. It also drops the need to know in which stage the code is compiled and it's no longer necessary to switch the code segment between stages. While at it fix the comments in the ramstage GDT and drop unused declarations from header files, always set the accessed bit and drop GDT_CODE_ACPI_SEG. Change-Id: I208496e6e4cc82833636f4f42503b44b0d702b9e Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/87255 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Shuo Liu <shuo.liu@intel.com> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
This commit is contained in:
parent
1e7e4e943f
commit
a6be271e63
14 changed files with 89 additions and 135 deletions
|
|
@ -3,16 +3,28 @@
|
|||
#ifndef CPU_X86_GDT
|
||||
#define CPU_X86_GDT
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
/* These symbols are defined in c_start.S. */
|
||||
extern char gdt[];
|
||||
extern char per_cpu_segment_descriptors[];
|
||||
extern uint32_t per_cpu_segment_selector;
|
||||
extern char gdt_end[];
|
||||
extern char idtarg[];
|
||||
#endif
|
||||
|
||||
/* These symbols are defined in secondary.S. */
|
||||
extern char _secondary_gdt_addr[];
|
||||
extern char _secondary_start[];
|
||||
extern char _secondary_start_end[];
|
||||
/* Offset to GDT's segment descriptors: */
|
||||
#define GDT_CODE_SEG 0x08
|
||||
#define GDT_DATA_SEG 0x10
|
||||
#define GDT_CODE_SEG64 0x18
|
||||
/*
|
||||
* This define is placed here to make sure future romstage programmers
|
||||
* know about it.
|
||||
* It is used only in SMM for STM setup code.
|
||||
*/
|
||||
#define GDT_TASK_STATE_SEG 0x20
|
||||
|
||||
#define GDT_CODE16_SEG 0x28
|
||||
#define GDT_DATA16_SEG 0x30
|
||||
#define GDT_DATA_ACPI_SEG 0x38
|
||||
|
||||
#endif /* CPU_X86_GDT */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue