Preserve ebx register in AsmEnableAvx()

System reset occurs after returning from AsmEnableAvx() in Stage1A.c
because ebx register is used for cpuid, but not restored.
- Save/Restore ebx register
- Move AsmEnableAvx () after init idt and serialport

Signed-off-by: Aiden Park <aiden.park@intel.com>
This commit is contained in:
Aiden Park 2019-12-04 22:30:03 -08:00 committed by Maurice Ma
parent 72262b4722
commit 66b9a5191d
2 changed files with 5 additions and 3 deletions

View File

@ -57,6 +57,7 @@ FlushExit:
;------------------------------------------------------------------------------
global ASM_PFX(AsmEnableAvx)
ASM_PFX(AsmEnableAvx):
push ebx
;
; Check if AVX is supported
;
@ -79,4 +80,5 @@ ASM_PFX(AsmEnableAvx):
xsetbv
NoAvxSupport:
pop ebx
ret

View File

@ -243,6 +243,9 @@ SecStartup2 (
BoardInit (PostTempRamInit);
AddMeasurePoint (0x1040);
// Enable more CPU featurs
AsmEnableAvx ();
if (DebugCodeEnabled()) {
DEBUG ((DEBUG_INFO, "\n============= %a STAGE1A =============\n",mBootloaderName));
} else {
@ -315,9 +318,6 @@ SecStartup (
TimeStamp = ReadTimeStamp ();
Stage1aAsmHob = (STAGE1A_ASM_HOB *)Params;
// Enable more CPU featurs
AsmEnableAvx ();
// Init global data
LdrGlobal = &LdrGlobalData;
ZeroMem (LdrGlobal, sizeof (LOADER_GLOBAL_DATA));