Abstract base mapping address retrieval
This commit is contained in:
@@ -156,6 +156,20 @@ Xtos::EnablePaging(IN PXTBL_PAGE_MAPPING PageMap)
|
||||
return STATUS_EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base address of the memory mapping.
|
||||
*
|
||||
* @return This routine returns the base address of the memory mapping.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
ULONG_PTR
|
||||
Xtos::GetBaseMappingAddress(VOID)
|
||||
{
|
||||
return KSEG0_BASE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps the page table for hardware layer addess space.
|
||||
*
|
||||
|
||||
@@ -44,6 +44,20 @@ Xtos::DeterminePagingLevel(IN CONST PWCHAR Parameters)
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base address of the memory mapping.
|
||||
*
|
||||
* @return This routine returns the base address of the memory mapping.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTCDECL
|
||||
ULONG_PTR
|
||||
Xtos::GetBaseMappingAddress(VOID)
|
||||
{
|
||||
return KSEG0_BASE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the actual memory mapping page table and enables paging. This routine exits EFI boot services as well.
|
||||
*
|
||||
|
||||
@@ -35,6 +35,7 @@ class Xtos
|
||||
private:
|
||||
STATIC XTCDECL ULONG DeterminePagingLevel(IN CONST PWCHAR Parameters);
|
||||
STATIC XTCDECL EFI_STATUS EnablePaging(IN PXTBL_PAGE_MAPPING PageMap);
|
||||
STATIC XTCDECL ULONG_PTR GetBaseMappingAddress(VOID);
|
||||
STATIC XTCDECL VOID GetDisplayInformation(OUT PSYSTEM_RESOURCE_FRAMEBUFFER FrameBufferResource,
|
||||
IN PEFI_PHYSICAL_ADDRESS FrameBufferBase,
|
||||
IN PULONG_PTR FrameBufferSize,
|
||||
|
||||
@@ -554,7 +554,7 @@ Xtos::LoadModule(IN PEFI_FILE_HANDLE SystemDir,
|
||||
}
|
||||
|
||||
/* Relocate the PE/COFF image file */
|
||||
Status = PeCoffProtocol->RelocateImage(*ImageContext, KSEG0_BASE + (ULONGLONG)(*ImageContext)->PhysicalAddress);
|
||||
Status = PeCoffProtocol->RelocateImage(*ImageContext, GetBaseMappingAddress() | (ULONGLONG)(*ImageContext)->PhysicalAddress);
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
/* Unable to relocate the file */
|
||||
@@ -640,7 +640,7 @@ Xtos::MapMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
|
||||
if(KernelMapping)
|
||||
{
|
||||
/* Map memory based on kernel base address */
|
||||
BaseAddress = KSEG0_BASE;
|
||||
BaseAddress = GetBaseMappingAddress();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -666,7 +666,7 @@ XTCDECL
|
||||
PVOID
|
||||
Xtos::PhysicalAddressToVirtual(PVOID PhysicalAddress)
|
||||
{
|
||||
return (PVOID)((ULONG_PTR)PhysicalAddress | KSEG0_BASE);
|
||||
return (PVOID)((ULONG_PTR)PhysicalAddress | GetBaseMappingAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -762,7 +762,7 @@ Xtos::RunBootSequence(IN PEFI_FILE_HANDLE BootDir,
|
||||
/* Initialize virtual memory mappings */
|
||||
XtLdrProtocol->Memory.InitializePageMap(&PageMap, DeterminePagingLevel(Parameters->Parameters), Size4K);
|
||||
|
||||
Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, KSEG0_BASE);
|
||||
Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, GetBaseMappingAddress());
|
||||
if(Status != STATUS_EFI_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
|
||||
Reference in New Issue
Block a user