Refactor kernel to use MM namespace for memory management
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in 31s
Builds / ExectOS (amd64, release) (push) Successful in 28s
Builds / ExectOS (i686, debug) (push) Successful in 31s
Builds / ExectOS (i686, release) (push) Successful in 29s

This commit is contained in:
2025-09-15 22:26:52 +02:00
parent 52c4d2a346
commit e3898f28fc
4 changed files with 21 additions and 21 deletions

View File

@@ -197,8 +197,8 @@ HL::Acpi::InitializeAcpiSystemDescriptionTable(OUT PACPI_DESCRIPTION_HEADER *Acp
RsdpAddress.QuadPart = (LONGLONG)AcpiResource->Header.PhysicalAddress;
/* Map RSDP and mark it as CD/WT to avoid delays in write-back cache */
Status = MmMapHardwareMemory(RsdpAddress, 1, TRUE, (PVOID *)&RsdpStructure);
MmMarkHardwareMemoryWriteThrough(RsdpStructure, 1);
Status = MM::HardwarePool::MapHardwareMemory(RsdpAddress, 1, TRUE, (PVOID *)&RsdpStructure);
MM::HardwarePool::MarkHardwareMemoryWriteThrough(RsdpStructure, 1);
/* Validate RSDP signature */
if(Status != STATUS_SUCCESS || RsdpStructure->Signature != ACPI_RSDP_SIGNATURE)
@@ -220,8 +220,8 @@ HL::Acpi::InitializeAcpiSystemDescriptionTable(OUT PACPI_DESCRIPTION_HEADER *Acp
}
/* Map RSDT/XSDT as CD/WT */
Status = MmMapHardwareMemory(RsdtAddress, 2, TRUE, (PVOID *)&Rsdt);
MmMarkHardwareMemoryWriteThrough(Rsdt, 2);
Status = MM::HardwarePool::MapHardwareMemory(RsdtAddress, 2, TRUE, (PVOID *)&Rsdt);
MM::HardwarePool::MarkHardwareMemoryWriteThrough(Rsdt, 2);
/* Validate RSDT/XSDT signature */
if((Status != STATUS_SUCCESS) ||
@@ -237,9 +237,9 @@ HL::Acpi::InitializeAcpiSystemDescriptionTable(OUT PACPI_DESCRIPTION_HEADER *Acp
if(RsdtPages != 2)
{
/* RSDT/XSDT needs less or more than 2 pages, remap it */
MmUnmapHardwareMemory(Rsdt, 2, TRUE);
Status = MmMapHardwareMemory(RsdtAddress, RsdtPages, TRUE, (PVOID *)&Rsdt);
MmMarkHardwareMemoryWriteThrough(Rsdt, RsdtPages);
MM::HardwarePool::UnmapHardwareMemory(Rsdt, 2, TRUE);
Status = MM::HardwarePool::MapHardwareMemory(RsdtAddress, RsdtPages, TRUE, (PVOID *)&Rsdt);
MM::HardwarePool::MarkHardwareMemoryWriteThrough(Rsdt, RsdtPages);
/* Make sure remapping was successful */
if(Status != STATUS_SUCCESS)
@@ -426,7 +426,7 @@ HL::Acpi::InitializeAcpiSystemStructure(VOID)
PageCount = SIZE_TO_PAGES(CpuCount * sizeof(PROCESSOR_IDENTITY));
/* Allocate memory for CPU information */
Status = MmAllocateHardwareMemory(PageCount, TRUE, &PhysicalAddress);
Status = MM::HardwarePool::AllocateHardwareMemory(PageCount, TRUE, &PhysicalAddress);
if(Status != STATUS_SUCCESS)
{
/* Failed to allocate memory, return error */
@@ -434,7 +434,7 @@ HL::Acpi::InitializeAcpiSystemStructure(VOID)
}
/* Map physical address to the virtual memory area */
Status = MmMapHardwareMemory(PhysicalAddress, PageCount, TRUE, (PVOID *)&SystemInfo.CpuInfo);
Status = MM::HardwarePool::MapHardwareMemory(PhysicalAddress, PageCount, TRUE, (PVOID *)&SystemInfo.CpuInfo);
if(Status != STATUS_SUCCESS)
{
/* Failed to map memory, return error */
@@ -609,7 +609,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
TableAddress.HighPart = 0;
/* Map table using hardware memory pool */
Status = MmMapHardwareMemory(TableAddress, 2, TRUE, (PVOID*)&TableHeader);
Status = MM::HardwarePool::MapHardwareMemory(TableAddress, 2, TRUE, (PVOID*)&TableHeader);
if(Status != STATUS_SUCCESS)
{
/* Failed to map table, return error */
@@ -665,11 +665,11 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
if(TableHeader != NULL)
{
/* Unmap previous table */
MmUnmapHardwareMemory(TableHeader, 2, TRUE);
MM::HardwarePool::UnmapHardwareMemory(TableHeader, 2, TRUE);
}
/* Map table using hardware memory pool */
Status = MmMapHardwareMemory(TableAddress, 2, TRUE, (PVOID*)&TableHeader);
Status = MM::HardwarePool::MapHardwareMemory(TableAddress, 2, TRUE, (PVOID*)&TableHeader);
if(Status != STATUS_SUCCESS)
{
/* Failed to map table, return error */
@@ -692,7 +692,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
if(TableHeader != NULL)
{
/* Unmap non-matching ACPI table */
MmUnmapHardwareMemory(TableHeader, 2, TRUE);
MM::HardwarePool::UnmapHardwareMemory(TableHeader, 2, TRUE);
}
/* Return error */
@@ -706,7 +706,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
if(!ValidateAcpiTable(TableHeader, TableHeader->Length))
{
/* Checksum mismatch, unmap table and return error */
MmUnmapHardwareMemory(TableHeader, 2, TRUE);
MM::HardwarePool::UnmapHardwareMemory(TableHeader, 2, TRUE);
return STATUS_CRC_ERROR;
}
}
@@ -716,8 +716,8 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
if(TablePages != 2)
{
/* ACPI table needs less or more than 2 pages, remap it */
MmUnmapHardwareMemory(TableHeader, 2, FALSE);
Status = MmMapHardwareMemory(TableAddress, TablePages, TRUE, (PVOID*)&TableHeader);
MM::HardwarePool::UnmapHardwareMemory(TableHeader, 2, FALSE);
Status = MM::HardwarePool::MapHardwareMemory(TableAddress, TablePages, TRUE, (PVOID*)&TableHeader);
/* Make sure remapping was successful */
if(Status != STATUS_SUCCESS)
@@ -728,7 +728,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature,
}
/* Mark table as write through and store it in local cache */
MmMarkHardwareMemoryWriteThrough(TableHeader, TablePages);
MM::HardwarePool::MarkHardwareMemoryWriteThrough(TableHeader, TablePages);
CacheAcpiTable(TableHeader);
/* Store ACPI table and return success */

View File

@@ -54,7 +54,7 @@ KE::KernelInit::InitializeMachine(VOID)
HL::Cpu::InitializeProcessor();
/* Initialize page map support */
MmInitializePageMapSupport();
MM::Paging::InitializePageMapSupport();
}
/**

View File

@@ -54,7 +54,7 @@ KE::KernelInit::InitializeMachine(VOID)
HL::Cpu::InitializeProcessor();
/* Initialize page map support */
MmInitializePageMapSupport();
MM::Paging::InitializePageMapSupport();
}
/**

View File

@@ -152,7 +152,7 @@ KE::KThread::InitializeThread(IN PKPROCESS Process,
if(!Stack)
{
/* Allocate new stack */
Status = MmAllocateKernelStack(&Stack, FALSE, 0);
Status = MM::KernelPool::AllocateKernelStack(&Stack, FALSE, 0);
if(Status != STATUS_SUCCESS || !Stack)
{
/* Stack allocation failed */
@@ -178,7 +178,7 @@ KE::KThread::InitializeThread(IN PKPROCESS Process,
if(Allocation)
{
/* Deallocate stack */
MmFreeKernelStack(Stack, FALSE);
MM::KernelPool::FreeKernelStack(Stack, FALSE);
Thread->InitialStack = NULL;
Thread->StackBase = NULL;
}