On 1 March 2016 at 03:05, Zeng, Star <[email protected]> wrote:
> On 2016/3/1 0:16, Ard Biesheuvel wrote:
>>
>> When the DXE core is loaded, it invokes the PeCoffExtraActionLib library
>> function 'PeCoffLoaderRelocateImageExtraAction' explicitly, which may be
>> in addition to the same function having been called by the DxeIpl PE/COFF
>> loader instance.
>>
>> The ImageContext that DXE core presents to this function is only partially
>> initialized, which may result in the following output on AArch64 systems:
>>
>> add-symbol-file ..MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll
>> 0x5F226240
>> <some intermediate output>
>> add-symbol-file ..MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll
>> 0x5F226000
>>
>> This is caused by incorrect data in the ImageContext structure, which
>> means
>> the start of the .text section is calculated incorrectly. In general, it
>> is
>> the duty of the caller to present a valid ImageContext structure, so let's
>> add the missing values before invoking
>> PeCoffLoaderRelocateImageExtraAction().
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ard Biesheuvel <[email protected]>
>> ---
>> MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>
>
> Reviewed-by: Star Zeng <[email protected]>
>
Thanks. Committed as 1cf4e9339de9
>
>>
>> diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
>> b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
>> index 0a34711b22a4..20ff02f663b2 100644
>> --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
>> +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
>> @@ -247,6 +247,7 @@ DxeMain (
>> EFI_HOB_GUID_TYPE *GuidHob;
>> EFI_VECTOR_HANDOFF_INFO *VectorInfoList;
>> EFI_VECTOR_HANDOFF_INFO *VectorInfo;
>> + VOID *EntryPoint;
>>
>> //
>> // Setup the default exception handlers
>> @@ -293,8 +294,13 @@ DxeMain (
>> // Report DXE Core image information to the PE/COFF Extra Action
>> Library
>> //
>> ZeroMem (&ImageContext, sizeof (ImageContext));
>> - ImageContext.ImageAddress =
>> (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase;
>> - ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN)
>> ImageContext.ImageAddress);
>> + ImageContext.ImageAddress =
>> (EFI_PHYSICAL_ADDRESS)(UINTN)gDxeCoreLoadedImage->ImageBase;
>> + ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer
>> ((VOID*)(UINTN)ImageContext.ImageAddress);
>> + ImageContext.SizeOfHeaders = PeCoffGetSizeOfHeaders
>> ((VOID*)(UINTN)ImageContext.ImageAddress);
>> + Status = PeCoffLoaderGetEntryPoint
>> ((VOID*)(UINTN)ImageContext.ImageAddress, &EntryPoint);
>> + if (Status == EFI_SUCCESS) {
>> + ImageContext.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;
>> + }
>> PeCoffLoaderRelocateImageExtraAction (&ImageContext);
>>
>> //
>>
>
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel