From cd6f2152237713d12723a55aa258c7ae91577dff Mon Sep 17 00:00:00 2001 From: Tom Lendacky Date: Fri, 2 Feb 2024 13:18:37 -0600 Subject: OvmfPkg/ResetVector: Fix SNP CPUID table processing results for ECX/EDX The current support within the boot SNP CPUID table processing mistakenly swaps the ECX and EDX results. It does not have an effect at this time because current CPUID results checking does not check ECX or EDX. However, any future CPUID checks that need to check ECX or EDX may have erroneous behavior. Fix the assembler code to save ECX and EDX to the proper locations. Fixes: 34819f2caccb ("OvmfPkg/ResetVector: use SEV-SNP-validated CPUID values") Signed-off-by: Tom Lendacky Reviewed-by: Michael Roth --- OvmfPkg/ResetVector/Ia32/AmdSev.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/ResetVector/Ia32/AmdSev.asm b/OvmfPkg/ResetVector/Ia32/AmdSev.asm index 3abc8300c4..043c88a7ab 100644 --- a/OvmfPkg/ResetVector/Ia32/AmdSev.asm +++ b/OvmfPkg/ResetVector/Ia32/AmdSev.asm @@ -395,9 +395,9 @@ SnpCpuidEntryFound: mov [esp + VC_CPUID_RESULT_EAX], eax mov eax, [ecx + SNP_CPUID_ENTRY_EBX] mov [esp + VC_CPUID_RESULT_EBX], eax - mov eax, [ecx + SNP_CPUID_ENTRY_EDX] - mov [esp + VC_CPUID_RESULT_ECX], eax mov eax, [ecx + SNP_CPUID_ENTRY_ECX] + mov [esp + VC_CPUID_RESULT_ECX], eax + mov eax, [ecx + SNP_CPUID_ENTRY_EDX] mov [esp + VC_CPUID_RESULT_EDX], eax jmp VmmDoneSnpCpuid -- cgit