Implement BlEfiMemoryAllocatePages() and BlEfiMemoryFreePages() for manipulating memory pages
ci/woodpecker/push/build Pipeline was successful Details

This commit is contained in:
Rafal Kupiec 2022-10-30 22:24:21 +01:00
parent b29162841c
commit f5e9bd11f1
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 49 additions and 0 deletions

View File

@ -162,6 +162,27 @@ BlDbgPrint(IN PUINT16 Format,
}
}
/**
* This routine allocates one or more 4KB pages.
*
* @param Size
* The number of contiguous 4KB pages to allocate.
*
* @param Memory
* The pointer to a physical address.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
EFI_STATUS
BlEfiMemoryAllocatePages(IN UINT64 Size,
OUT PEFI_PHYSICAL_ADDRESS Memory)
{
return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiRuntimeServicesData,
EFI_SIZE_TO_PAGES(Size), Memory);
}
/**
* This routine allocates a pool memory.
*
@ -183,6 +204,26 @@ BlEfiMemoryAllocatePool(IN UINT_PTR Size,
return EfiSystemTable->BootServices->AllocatePool(EfiLoaderData, Size, Memory);
}
/**
* This routine frees memory pages.
*
* @param Size
* The number of contiguous 4 KB pages to free.
*
* @param Memory
* The base physical address of the pages to be freed.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
EFI_STATUS
BlEfiMemoryFreePages(IN UINT64 Size,
IN EFI_PHYSICAL_ADDRESS Memory)
{
return EfiSystemTable->BootServices->FreePages(Memory, Size);
}
/**
* Returns pool memory to the system.
*

View File

@ -58,10 +58,18 @@ EFI_STATUS
BlEfiGetSystemConfigurationTable(IN PEFI_GUID TableGuid,
OUT PVOID *Table);
EFI_STATUS
BlEfiMemoryAllocatePages(IN UINT64 Size,
OUT PEFI_PHYSICAL_ADDRESS Memory);
EFI_STATUS
BlEfiMemoryAllocatePool(IN UINT_PTR Size,
OUT PVOID *Memory);
EFI_STATUS
BlEfiMemoryFreePages(IN UINT64 Size,
IN EFI_PHYSICAL_ADDRESS Memory);
EFI_STATUS
BlEfiMemoryFreePool(IN PVOID Memory);