Implement BlGetMappingsCount() routine

This commit is contained in:
Rafal Kupiec 2024-01-28 17:26:20 +01:00
parent 670a812649
commit b8acfe1b66
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
4 changed files with 30 additions and 0 deletions

View File

@ -76,6 +76,7 @@ typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_DISPLAY_INFORMATION)(OUT PXTBL_FRAMEBUF
typedef EFI_STATUS (*PBL_FRAMEBUFFER_INITIALIZE)();
typedef EFI_STATUS (*PBL_FREE_PAGES)(IN UINT64 Size, IN EFI_PHYSICAL_ADDRESS Memory);
typedef EFI_STATUS (*PBL_FREE_POOL)(IN PVOID Memory);
typedef VOID (*PBL_GET_MAPPINGS_COUNT)(IN PXTBL_PAGE_MAPPING PageMap, OUT PULONG NumberOfMappings);
typedef EFI_STATUS (*PBL_GET_MEMORY_MAP)(OUT PEFI_MEMORY_MAP MemoryMap);
typedef PLIST_ENTRY (*PBL_GET_MODULES_LIST)();
typedef INT_PTR (*PBL_GET_SECURE_BOOT_STATUS)();
@ -308,6 +309,7 @@ typedef struct _XTBL_LOADER_PROTOCOL
PBL_COPY_MEMORY CopyMemory;
PBL_FREE_PAGES FreePages;
PBL_FREE_POOL FreePool;
PBL_GET_MAPPINGS_COUNT GetMappingsCount;
PBL_GET_MEMORY_MAP GetMemoryMap;
PBL_INITIALIZE_PAGE_MAP InitializePageMap;
PBL_MAP_EFI_MEMORY MapEfiMemory;

View File

@ -135,6 +135,11 @@ EFI_STATUS
BlGetEfiPath(IN PWCHAR SystemPath,
OUT PWCHAR *EfiPath);
XTCDECL
VOID
BlGetMappingsCount(IN PXTBL_PAGE_MAPPING PageMap,
OUT PULONG NumberOfMappings);
XTCDECL
EFI_STATUS
BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap);

View File

@ -91,6 +91,28 @@ BlFreeMemoryPool(IN PVOID Memory)
return EfiSystemTable->BootServices->FreePool(Memory);
}
/**
* Returns the number of mappings in the page mapping structure.
*
* @param PageMap
* Supplies a pointer to the page mapping structure.
*
* @param NumberOfMappings
* Supplies a pointer to memory area where the number of mappings is returned.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
BlGetMappingsCount(IN PXTBL_PAGE_MAPPING PageMap,
OUT PULONG NumberOfMappings)
{
/* Return number of mappings */
*NumberOfMappings = PageMap->MapSize;
}
/**
* Returns the memory descriptors which define a memory map of all the physical memory ranges reserved by the UEFI.
*

View File

@ -630,6 +630,7 @@ BlpInstallXtLoaderProtocol()
BlpLdrProtocol.Memory.CopyMemory = RtlCopyMemory;
BlpLdrProtocol.Memory.FreePages = BlFreeMemoryPages;
BlpLdrProtocol.Memory.FreePool = BlFreeMemoryPool;
BlpLdrProtocol.Memory.GetMappingsCount = BlGetMappingsCount;
BlpLdrProtocol.Memory.GetMemoryMap = BlGetMemoryMap;
BlpLdrProtocol.Memory.InitializePageMap = BlInitializePageMap;
BlpLdrProtocol.Memory.MapEfiMemory = BlMapEfiMemory;