Allocate and map the Kernel Shared Data page at startup
Some checks failed
Builds / ExectOS (amd64, debug) (push) Failing after -59m31s
Builds / ExectOS (amd64, release) (push) Failing after -59m34s
Builds / ExectOS (i686, debug) (push) Failing after -59m33s
Builds / ExectOS (i686, release) (push) Failing after -59m35s

This commit is contained in:
2026-04-24 12:12:23 +02:00
parent f2baa765b4
commit 5dc782ca24
4 changed files with 52 additions and 6 deletions

View File

@@ -282,6 +282,45 @@ MM::Manager::InitializeMemoryManager(VOID)
AR::CpuFunc::FlushTlb();
}
/**
* Allocates and maps the Kernel Shared Data page to its hardcoded virtual address.
*
* @return This routine returns status code.
*
* @since XT 1.0
*/
XTAPI
XTSTATUS
MM::Manager::MapKernelSharedData(VOID)
{
PHYSICAL_ADDRESS PhysAddr;
PMMPTE PtePointer;
XTSTATUS Status;
/* Allocate one physical page from the hardware pool for the shared data */
Status = MM::HardwarePool::AllocateHardwareMemory(1, FALSE, &PhysAddr);
if(Status != STATUS_SUCCESS)
{
/* Memory allocation failed, return error code */
return Status;
}
/* Retrieve the Page Table Entry (PTE) corresponding to the KSD virtual address */
PtePointer = MM::Paging::GetPteAddress((PVOID)MM_KERNEL_SHARED_DATA_ADDRESS);
/* Manually map the corresponding PTE */
MM::Paging::SetPte(PtePointer, (PFN_NUMBER)(PhysAddr.QuadPart >> MM_PAGE_SHIFT), MM_PTE_READWRITE);
/* Flush the Translation Lookaside Buffer (TLB) */
MM::Paging::FlushTlb();
/* Zero the page content */
RTL::Memory::ZeroMemory((PVOID)MM_KERNEL_SHARED_DATA_ADDRESS, MM_PAGE_SIZE);
/* Return success */
return STATUS_SUCCESS;
}
/**
* Checks whether the specified memory type should be considered as free.
*