From ea5c31138b7591efd68147b6ea12097ea98d98c9 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Tue, 21 Sep 2021 10:17:24 -0600 Subject: arch/x86,cpu/x86: Disable the %gs and %fs segments The %fs and %gs segment are typically used to implement thread local storage or cpu local storage. We don't currently use these in coreboot, so there is no reason to map them. By setting the segment index to 0, it disables the segment. If an instruction tries to read from one of these segments an exception will be raised. The end goal is to make cpu_info() use the %gs segment. This will remove the stack alignment requirements and fix smm_do_relocation. BUG=b:194391185, b:179699789 TEST=Boot guybrush to OS Signed-off-by: Raul E Rangel Change-Id: Iaa376e562acc6bd1dfffb7a23bdec82aa474c1d5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57860 Tested-by: build bot (Jenkins) Reviewed-by: Eric Peers Reviewed-by: Arthur Heymans --- src/cpu/x86/lapic/secondary.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/cpu/x86/lapic') diff --git a/src/cpu/x86/lapic/secondary.S b/src/cpu/x86/lapic/secondary.S index d36bc9a645..d2d43a2b5b 100644 --- a/src/cpu/x86/lapic/secondary.S +++ b/src/cpu/x86/lapic/secondary.S @@ -52,8 +52,9 @@ __ap_protected_start: movw %ax, %ds movw %ax, %es movw %ax, %ss + xor %ax, %ax /* zero out the gs and fs segment index */ movw %ax, %fs - movw %ax, %gs + movw %ax, %gs /* Will be used for cpu_info */ /* Load the Interrupt descriptor table */ lidt idtarg -- cgit v1.2.3