Abstract base mapping address retrieval
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in 23s
Builds / ExectOS (i686, release) (push) Successful in 26s
Builds / ExectOS (i686, debug) (push) Successful in 38s
Builds / ExectOS (amd64, release) (push) Successful in 39s

This commit is contained in:
2026-01-12 23:03:13 +01:00
parent 15edd98242
commit 11f7c25713
4 changed files with 33 additions and 4 deletions

View File

@@ -156,6 +156,20 @@ Xtos::EnablePaging(IN PXTBL_PAGE_MAPPING PageMap)
return STATUS_EFI_SUCCESS; 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. * Maps the page table for hardware layer addess space.
* *

View File

@@ -44,6 +44,20 @@ Xtos::DeterminePagingLevel(IN CONST PWCHAR Parameters)
return 2; 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. * Builds the actual memory mapping page table and enables paging. This routine exits EFI boot services as well.
* *

View File

@@ -35,6 +35,7 @@ class Xtos
private: private:
STATIC XTCDECL ULONG DeterminePagingLevel(IN CONST PWCHAR Parameters); STATIC XTCDECL ULONG DeterminePagingLevel(IN CONST PWCHAR Parameters);
STATIC XTCDECL EFI_STATUS EnablePaging(IN PXTBL_PAGE_MAPPING PageMap); 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, STATIC XTCDECL VOID GetDisplayInformation(OUT PSYSTEM_RESOURCE_FRAMEBUFFER FrameBufferResource,
IN PEFI_PHYSICAL_ADDRESS FrameBufferBase, IN PEFI_PHYSICAL_ADDRESS FrameBufferBase,
IN PULONG_PTR FrameBufferSize, IN PULONG_PTR FrameBufferSize,

View File

@@ -554,7 +554,7 @@ Xtos::LoadModule(IN PEFI_FILE_HANDLE SystemDir,
} }
/* Relocate the PE/COFF image file */ /* 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) if(Status != STATUS_EFI_SUCCESS)
{ {
/* Unable to relocate the file */ /* Unable to relocate the file */
@@ -640,7 +640,7 @@ Xtos::MapMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
if(KernelMapping) if(KernelMapping)
{ {
/* Map memory based on kernel base address */ /* Map memory based on kernel base address */
BaseAddress = KSEG0_BASE; BaseAddress = GetBaseMappingAddress();
} }
else else
{ {
@@ -666,7 +666,7 @@ XTCDECL
PVOID PVOID
Xtos::PhysicalAddressToVirtual(PVOID PhysicalAddress) 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 */ /* Initialize virtual memory mappings */
XtLdrProtocol->Memory.InitializePageMap(&PageMap, DeterminePagingLevel(Parameters->Parameters), Size4K); 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) if(Status != STATUS_EFI_SUCCESS)
{ {
return Status; return Status;