From 5b334b88a635e46d47ce3f3b703d2470d6e8514c Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 30 Nov 2021 18:34:32 +0100 Subject: x86_64 assembly: Don't touch %gs With CPU_INFO_V2 enabled %gs holds the pointer to the cpu_info struct, so don't clobber it. Backup and restore %gs where possible. Fixes a crash in MPinit seen after calling FSP-S. Change-Id: If9fc999b34530de5d8b6ad27b9af25fc552e9420 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/59764 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- src/security/intel/txt/getsec_enteraccs.S | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/security') diff --git a/src/security/intel/txt/getsec_enteraccs.S b/src/security/intel/txt/getsec_enteraccs.S index 09f9f389e6..cbb24b6511 100644 --- a/src/security/intel/txt/getsec_enteraccs.S +++ b/src/security/intel/txt/getsec_enteraccs.S @@ -227,6 +227,10 @@ cond_clear_var_mtrrs: movd %esp, %xmm0 movd %ebp, %xmm1 + /* Backup %gs used by CPU_INFO_V2 */ + movl %gs, %eax + movd %eax, %xmm2 + /* * Get function arguments. * It's important to pass the exact ACM size as it's used by getsec to verify @@ -261,6 +265,8 @@ cond_clear_var_mtrrs: movl %eax, %es movl %eax, %ss movl %eax, %fs + /* Restore %gs used by CPU_INFO_V2 */ + movd %xmm2, %eax movl %eax, %gs /* Disable cache */ -- cgit v1.2.3