[QEMU] Fix QEMU boot issue in nested virtualization env

Is is reported that SBL QEMU target crashes when running in nested
virtualization env. For example, run QEMU with KVM flag inside
Ubuntu running on Windows Virtual Box.
After debug, it turned out somehow the KVM generated exception for
instruction "movd mm0, eax" at the very beginning. This was used to
save the CPU BIST info. If it is moved to be after switching to FLAT32
mode, then everything goes well.  This patch moved the BIST saving
into later stage in the boot in order to address the KVM crash issue.

This fixed #1469.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This commit is contained in:
Maurice Ma 2022-01-26 14:33:45 -08:00 committed by Guo Dong
parent 12a4402ee8
commit e75725ef11
2 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,5 @@ EarlyInit16:
;
; ESP - Initial value of the EAX register (BIST: Built-in Self Test)
;
movd mm0, eax
OneTimeCallRet EarlyInit16

View File

@ -105,6 +105,7 @@ TransitionFromReal16To32BitFlat:
mov ds, bx
mov bx, ADDR16_OF(gdtr)
o32 lgdt [cs:bx]
mov ebx, eax ; save BIST to EBX
mov eax, cr0
and eax, SEC_DEFAULT_CR0_MASK
or eax, SEC_DEFAULT_CR0
@ -120,5 +121,6 @@ jumpTo32BitAndLandHere:
mov fs, ax
mov gs, ax
mov ss, ax
movd mm0, ebx ; save BIST to MM0
OneTimeCallRet TransitionFromReal16To32BitFlat