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

@@ -29,6 +29,7 @@ namespace MM
STATIC XTAPI PPHYSICAL_MEMORY_DESCRIPTOR GetPhysicalMemoryBlock(VOID);
STATIC XTAPI VOID InitializeMemoryLayout(VOID);
STATIC XTAPI VOID InitializeMemoryManager(VOID);
STATIC XTAPI XTSTATUS MapKernelSharedData(VOID);
STATIC XTAPI BOOLEAN VerifyMemoryTypeFree(IN LOADER_MEMORY_TYPE MemoryType);
STATIC XTAPI BOOLEAN VerifyMemoryTypeInvisible(IN LOADER_MEMORY_TYPE MemoryType);

View File

@@ -50,11 +50,14 @@ KE::KernelInit::InitializeMachine(VOID)
/* Initialize frame buffer */
HL::FrameBuffer::InitializeFrameBuffer();
/* Initialize processor */
HL::Cpu::InitializeProcessor();
/* Initialize page map support */
MM::Paging::InitializePageMapSupport();
/* Map Kernel Shared Data (KSD) */
MM::Manager::MapKernelSharedData();
/* Initialize processor */
HL::Cpu::InitializeProcessor();
}
/**

View File

@@ -50,11 +50,14 @@ KE::KernelInit::InitializeMachine(VOID)
/* Initialize frame buffer */
HL::FrameBuffer::InitializeFrameBuffer();
/* Initialize processor */
HL::Cpu::InitializeProcessor();
/* Initialize page map support */
MM::Paging::InitializePageMapSupport();
/* Map Kernel Shared Data (KSD) */
MM::Manager::MapKernelSharedData();
/* Initialize processor */
HL::Cpu::InitializeProcessor();
}
/**

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.
*