Allow to specify virtual address during EFI memory mapping only
This commit is contained in:
parent
88321b5f4d
commit
c24745d233
@ -77,7 +77,7 @@ typedef EFI_STATUS (*PBL_FREE_POOL)(IN PVOID Memory);
|
|||||||
typedef EFI_STATUS (*PBL_GET_MEMORY_MAP)(OUT PEFI_MEMORY_MAP MemoryMap);
|
typedef EFI_STATUS (*PBL_GET_MEMORY_MAP)(OUT PEFI_MEMORY_MAP MemoryMap);
|
||||||
typedef PLIST_ENTRY (*PBL_GET_MODULES_LIST)();
|
typedef PLIST_ENTRY (*PBL_GET_MODULES_LIST)();
|
||||||
typedef INT_PTR (*PBL_GET_SECURE_BOOT_STATUS)();
|
typedef INT_PTR (*PBL_GET_SECURE_BOOT_STATUS)();
|
||||||
typedef VOID (*PBL_INITIALIZE_PAGE_MAP)(OUT PXTBL_PAGE_MAPPING PageMap, IN PVOID *MemoryMapAddress, IN SHORT PageMapLevel, IN PAGE_SIZE PageSize);
|
typedef VOID (*PBL_INITIALIZE_PAGE_MAP)(OUT PXTBL_PAGE_MAPPING PageMap, IN SHORT PageMapLevel, IN PAGE_SIZE PageSize);
|
||||||
typedef EFI_STATUS (*PBL_INSTALL_XT_PROTOCOL)(IN PVOID Interface, IN PEFI_GUID Guid);
|
typedef EFI_STATUS (*PBL_INSTALL_XT_PROTOCOL)(IN PVOID Interface, IN PEFI_GUID Guid);
|
||||||
typedef EFI_STATUS (*PBL_INVOKE_BOOT_PROTOCOL)(IN PLIST_ENTRY OptionsList);
|
typedef EFI_STATUS (*PBL_INVOKE_BOOT_PROTOCOL)(IN PLIST_ENTRY OptionsList);
|
||||||
typedef EFI_STATUS (*PBL_LOCATE_PROTOCOL_HANDLES)(OUT PEFI_HANDLE *Handles, OUT PUINT_PTR Count, IN PEFI_GUID ProtocolGuid);
|
typedef EFI_STATUS (*PBL_LOCATE_PROTOCOL_HANDLES)(OUT PEFI_HANDLE *Handles, OUT PUINT_PTR Count, IN PEFI_GUID ProtocolGuid);
|
||||||
@ -185,7 +185,6 @@ typedef struct _XTBL_PAGE_MAPPING
|
|||||||
{
|
{
|
||||||
LIST_ENTRY MemoryMap;
|
LIST_ENTRY MemoryMap;
|
||||||
PVOID PtePointer;
|
PVOID PtePointer;
|
||||||
PVOID MemoryMapAddress;
|
|
||||||
SHORT PageMapLevel;
|
SHORT PageMapLevel;
|
||||||
PAGE_SIZE PageSize;
|
PAGE_SIZE PageSize;
|
||||||
} XTBL_PAGE_MAPPING, *PXTBL_PAGE_MAPPING;
|
} XTBL_PAGE_MAPPING, *PXTBL_PAGE_MAPPING;
|
||||||
|
@ -157,7 +157,6 @@ BlInitializeConsole();
|
|||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN PVOID *MemoryMapAddress,
|
|
||||||
IN SHORT PageMapLevel,
|
IN SHORT PageMapLevel,
|
||||||
IN PAGE_SIZE PageSize);
|
IN PAGE_SIZE PageSize);
|
||||||
|
|
||||||
|
@ -160,9 +160,6 @@ BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
|
|||||||
* @param PageMap
|
* @param PageMap
|
||||||
* Supplies a pointer to the page mapping structure.
|
* Supplies a pointer to the page mapping structure.
|
||||||
*
|
*
|
||||||
* @param MemoryMapAddress
|
|
||||||
* Supplies an address of the mapped virtual memory area.
|
|
||||||
*
|
|
||||||
* @param PageMapLevel
|
* @param PageMapLevel
|
||||||
* Specifies a number of of paging structures levels.
|
* Specifies a number of of paging structures levels.
|
||||||
*
|
*
|
||||||
@ -176,7 +173,6 @@ BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
|
|||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN PVOID *MemoryMapAddress,
|
|
||||||
IN SHORT PageMapLevel,
|
IN SHORT PageMapLevel,
|
||||||
IN PAGE_SIZE PageSize)
|
IN PAGE_SIZE PageSize)
|
||||||
{
|
{
|
||||||
@ -184,7 +180,6 @@ BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
RtlInitializeListHead(&PageMap->MemoryMap);
|
RtlInitializeListHead(&PageMap->MemoryMap);
|
||||||
|
|
||||||
/* Set page map size/level and memory map address */
|
/* Set page map size/level and memory map address */
|
||||||
PageMap->MemoryMapAddress = &MemoryMapAddress;
|
|
||||||
PageMap->PageMapLevel = PageMapLevel;
|
PageMap->PageMapLevel = PageMapLevel;
|
||||||
PageMap->PageSize = PageSize;
|
PageMap->PageSize = PageSize;
|
||||||
}
|
}
|
||||||
@ -195,9 +190,8 @@ BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
* @param PageMap
|
* @param PageMap
|
||||||
* Supplies a pointer to the page mapping structure.
|
* Supplies a pointer to the page mapping structure.
|
||||||
*
|
*
|
||||||
* @param DesiredVirtualAddress
|
* @param MemoryMapAddress
|
||||||
* Supplies a desired virtual address, where EFI memory will be mapped.
|
* Supplies a virtual address, where EFI memory will be mapped.
|
||||||
* If not specified, memory map address will be used.
|
|
||||||
*
|
*
|
||||||
* @return This routine returns a status code.
|
* @return This routine returns a status code.
|
||||||
*
|
*
|
||||||
@ -206,7 +200,7 @@ BlInitializePageMap(OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||||
IN OUT PVOID *DesiredVirtualAddress)
|
IN OUT PVOID *MemoryMapAddress)
|
||||||
{
|
{
|
||||||
PEFI_MEMORY_DESCRIPTOR Descriptor;
|
PEFI_MEMORY_DESCRIPTOR Descriptor;
|
||||||
LOADER_MEMORY_TYPE MemoryType;
|
LOADER_MEMORY_TYPE MemoryType;
|
||||||
@ -216,17 +210,8 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
SIZE_T Index;
|
SIZE_T Index;
|
||||||
|
|
||||||
/* Set initial virtual address */
|
|
||||||
if(*DesiredVirtualAddress != NULL)
|
|
||||||
{
|
|
||||||
/* Set virtual address as specified in argument */
|
/* Set virtual address as specified in argument */
|
||||||
VirtualAddress = *DesiredVirtualAddress;
|
VirtualAddress = *MemoryMapAddress;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Otherwise, set virtual address as specified in page map */
|
|
||||||
VirtualAddress = PageMap->MemoryMapAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate and zero-fill buffer for EFI memory map */
|
/* Allocate and zero-fill buffer for EFI memory map */
|
||||||
BlAllocateMemoryPool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
BlAllocateMemoryPool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
||||||
@ -288,7 +273,8 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return success */
|
/* Store next valid virtual address and return success */
|
||||||
|
*MemoryMapAddress = VirtualAddress;
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,9 +191,9 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir,
|
|||||||
VirtualAddress = (PVOID)(KSEG0_BASE + KSEG0_KERNEL_BASE);
|
VirtualAddress = (PVOID)(KSEG0_BASE + KSEG0_KERNEL_BASE);
|
||||||
|
|
||||||
/* Initialize virtual memory mappings */
|
/* Initialize virtual memory mappings */
|
||||||
XtLdrProtocol->Memory.InitializePageMap(&PageMap, &VirtualMemoryArea, 3, Size4K);
|
XtLdrProtocol->Memory.InitializePageMap(&PageMap, 3, Size4K);
|
||||||
|
|
||||||
Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, NULL);
|
Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, &VirtualMemoryArea);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
|
Loading…
Reference in New Issue
Block a user