Hi Laszlo,
The inner half of your call chain is probably EfiBootManagerBoot()
[MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c]. You'll see
gBS->LoadImage() and gBS->StartImage() calls there. Those are
implemented as CoreLoadImage() [MdeModulePkg/Core/Dxe/Image/Image.c] and
CoreStartImage() [MdeModulePkg/Core/Dxe/Image/Image.c], respectively.
I’ve been poking around in MdeModulePkg/Core/Dxe/Image/Image.c to see what is going on with the loading of the file and have got to the CoreLoadPeImage() function.
The memory that is being allocated for Xen’s \EFI\BOOT\BOOTX64.EFI to be loaded into is as a result of:
if (EFI_ERROR (Status) && !Image->ImageContext.RelocationsStripped) {
Status = CoreAllocatePages (
AllocateAnyPages,
(EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
Image->NumberOfPages,
&Image->ImageContext.ImageAddress
);
}
The ImageAddress being returned by CoreAllocatePages() is 0x45D3A8000.
Looking in MdeModulePkg/Core/Dxe/Mem/Page.c the call sequence seems to be CoreAllocatePages() -> CoreInternalAllocatePages() -> FindFreePages() -> CoreFindFreePagesI( ).
Somewhere around that point, I have got a bit lost as I can’t work out which if the calls to CoreFindFreePagesI() is successful to figure out which bin the memory is being allocated from.
Is the address being used based on information EDK2 has worked out for itself or is it based on setup that coreboot has already done? What I’m trying to do is find a way to make it allocate memory below 4GB.
-Andy.