PeiServicesAllocatePages () will output sizeof (EFI_PHYSICAL_ADDRESS) value.
IdtTableForX64 is sizeof (UINTN) local variable. It will overwrite other local
variable.

This issue is found when we dump BaseOfStack value.

Cc: Feng Tian <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Michael Kinney <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <[email protected]>
---
 MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c 
b/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
index 6ec51ff..8f6a97a 100644
--- a/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
+++ b/MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c
@@ -280,7 +280,7 @@ HandOffToDxeCore (
     Status = PeiServicesAllocatePages (
                EfiBootServicesData,
                EFI_SIZE_TO_PAGES(sizeof (X64_IDT_TABLE) + SizeOfTemplate * 
IDT_ENTRY_COUNT),
-               (EFI_PHYSICAL_ADDRESS *) &IdtTableForX64
+               &VectorAddress
                );
     ASSERT_EFI_ERROR (Status);
 
@@ -288,6 +288,7 @@ HandOffToDxeCore (
     // Store EFI_PEI_SERVICES** in the 4 bytes immediately preceding IDT to 
avoid that
     // it may not be gotten correctly after IDT register is re-written.
     //
+    IdtTableForX64 = (X64_IDT_TABLE *) (UINTN) VectorAddress;
     IdtTableForX64->PeiService = GetPeiServicesTablePointer ();
 
     VectorAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) (IdtTableForX64 + 1);
-- 
2.9.3.windows.2

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to