Allow specifying an allocation type when allocating pages
This commit is contained in:
parent
9f6121e9b2
commit
88b3a57962
@ -35,7 +35,7 @@ BlBuildPageMap(IN PXTBL_PAGE_MAPPING PageMap,
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Allocate pages for the Page Map */
|
||||
Status = BlAllocateMemoryPages(1, &Address);
|
||||
Status = BlAllocateMemoryPages(AllocateAnyPages, 1, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure */
|
||||
@ -288,7 +288,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
|
||||
else
|
||||
{
|
||||
/* Allocate pages for new PML entry */
|
||||
Status = BlAllocateMemoryPages(1, &Address);
|
||||
Status = BlAllocateMemoryPages(AllocateAnyPages, 1, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure */
|
||||
|
@ -18,7 +18,8 @@
|
||||
/* XTLDR routines forward references */
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlAllocateMemoryPages(IN ULONGLONG NumberOfPages,
|
||||
BlAllocateMemoryPages(IN EFI_ALLOCATE_TYPE AllocationType,
|
||||
IN ULONGLONG NumberOfPages,
|
||||
OUT PEFI_PHYSICAL_ADDRESS Memory);
|
||||
|
||||
XTCDECL
|
||||
|
@ -24,10 +24,11 @@
|
||||
*/
|
||||
XTCDECL
|
||||
EFI_STATUS
|
||||
BlAllocateMemoryPages(IN ULONGLONG NumberOfPages,
|
||||
BlAllocateMemoryPages(IN EFI_ALLOCATE_TYPE AllocationType,
|
||||
IN ULONGLONG NumberOfPages,
|
||||
OUT PEFI_PHYSICAL_ADDRESS Memory)
|
||||
{
|
||||
return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiLoaderData, NumberOfPages, Memory);
|
||||
return EfiSystemTable->BootServices->AllocatePages(AllocationType, EfiLoaderData, NumberOfPages, Memory);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -409,7 +409,7 @@ PeLoadImage(IN PEFI_FILE_HANDLE FileHandle,
|
||||
Pages = EFI_SIZE_TO_PAGES(ImageData->FileSize);
|
||||
|
||||
/* Allocate pages */
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(Pages, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, Pages, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Pages allocation failure */
|
||||
@ -472,7 +472,7 @@ PeLoadImage(IN PEFI_FILE_HANDLE FileHandle,
|
||||
ImageData->ImagePages = EFI_SIZE_TO_PAGES(ImageData->ImageSize);
|
||||
|
||||
/* Allocate image pages */
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(ImageData->ImagePages, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, ImageData->ImagePages, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Pages reallocation failure */
|
||||
|
@ -84,7 +84,7 @@ XtpMapHardwareMemoryPool(IN PXTBL_PAGE_MAPPING PageMap)
|
||||
if(!P5eBase[(MM_HARDWARE_VA_START >> MM_P5I_SHIFT) & 0x1FF].Valid)
|
||||
{
|
||||
/* No valid P5E, allocate memory */
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(1, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, 1, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure, return error */
|
||||
@ -118,7 +118,7 @@ XtpMapHardwareMemoryPool(IN PXTBL_PAGE_MAPPING PageMap)
|
||||
if(!PxeBase[(MM_HARDWARE_VA_START >> MM_PXI_SHIFT) & 0x1FF].Valid)
|
||||
{
|
||||
/* No valid PXE, allocate memory */
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(1, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, 1, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure, return error */
|
||||
@ -146,7 +146,7 @@ XtpMapHardwareMemoryPool(IN PXTBL_PAGE_MAPPING PageMap)
|
||||
if(!PpeBase[(MM_HARDWARE_VA_START >> MM_PPI_SHIFT) & 0x1FF].Valid)
|
||||
{
|
||||
/* No valid PPE, allocate memory */
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(1, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, 1, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure, return error */
|
||||
@ -177,7 +177,7 @@ XtpMapHardwareMemoryPool(IN PXTBL_PAGE_MAPPING PageMap)
|
||||
if(!PdeBase[((MM_HARDWARE_VA_START >> MM_PDI_SHIFT) & 0x1FF) + Index].Valid)
|
||||
{
|
||||
/* No valid PDE, allocate memory */
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(1, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, 1, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure, return error */
|
||||
|
@ -64,7 +64,7 @@ XtpMapHardwareMemoryPool(IN PXTBL_PAGE_MAPPING PageMap)
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Allocate memory */
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(1, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, 1, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure, return error */
|
||||
|
@ -75,7 +75,7 @@ XtGetMemoryDescriptorList(IN PXTBL_PAGE_MAPPING PageMap,
|
||||
|
||||
Pages = (ULONGLONG)EFI_SIZE_TO_PAGES((PageMap->MapSize + 1) * sizeof(LOADER_MEMORY_DESCRIPTOR));
|
||||
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(Pages, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, Pages, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
@ -136,7 +136,7 @@ XtGetSystemResourcesList(IN PXTBL_PAGE_MAPPING PageMap,
|
||||
|
||||
Pages = (ULONGLONG)EFI_SIZE_TO_PAGES(sizeof(SYSTEM_RESOURCE_ACPI) + sizeof(SYSTEM_RESOURCE_FRAMEBUFFER));
|
||||
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(Pages, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, Pages, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
@ -552,7 +552,7 @@ XtpInitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap,
|
||||
BlockPages = EFI_SIZE_TO_PAGES(sizeof(KERNEL_INITIALIZATION_BLOCK));
|
||||
|
||||
/* Allocate memory for kernel initialization block */
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(BlockPages, &Address);
|
||||
Status = XtLdrProtocol->Memory.AllocatePages(AllocateAnyPages, BlockPages, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Memory allocation failure */
|
||||
|
@ -616,7 +616,7 @@ BlReadFile(IN PEFI_FILE_HANDLE DirHandle,
|
||||
Pages = EFI_SIZE_TO_PAGES(FileInfo->FileSize);
|
||||
|
||||
/* Allocate pages */
|
||||
Status = BlAllocateMemoryPages(Pages, &Address);
|
||||
Status = BlAllocateMemoryPages(AllocateAnyPages, Pages, &Address);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Pages allocation failure */
|
||||
|
Loading…
x
Reference in New Issue
Block a user