From b028c1021cdfbfaa0202711f2a008c801752917f Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Fri, 4 Nov 2016 10:01:21 +0800 Subject: [PATCH] MdeModulePkg/DxeIplPeim: UINTN used wrongly for EFI_PHYSICAL_ADDRESS 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 Cc: Liming Gao Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Liming Gao Reviewed-by: Feng Tian --- 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 6ec51ff09a..8f6a97a174 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);