IntelFsp2WrapperPkg: Bootloader need to recover fs and gs

When enter FSP, bootloader need to save fs and gs, when back
to bootloader, bootloader need to restore fs and gs, so it
could avoid bootloader access wrong data segment when usging
fs and gs.

Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Hongbin1 Zhang
2025-03-03 13:06:26 +08:00
committed by mergify[bot]
parent b509393160
commit 786ae76884

View File

@ -110,9 +110,11 @@ ASM_PFX(AsmExecute32BitCode):
retf
Compatible:
; reload DS/ES/SS to make sure they are correct referred to current GDT
; reload DS/ES/FS/GS/SS to make sure they are correct referred to current GDT
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
;
@ -208,11 +210,13 @@ ReloadCS:
retf
.0:
;
; Reload original DS/ES/SS
; Reload original DS/ES/FS/GS/SS
;
pop rcx
mov ds, rcx
mov es, rcx
mov fs, rcx
mov gs, rcx
mov ss, rcx
;