4 Commits

Author SHA1 Message Date
d263f17831 Refactor panic calls in memory manager
All checks were successful
Builds / ExectOS (i686, debug) (push) Successful in 27s
Builds / ExectOS (amd64, debug) (push) Successful in 29s
Builds / ExectOS (amd64, release) (push) Successful in 39s
Builds / ExectOS (i686, release) (push) Successful in 38s
2026-03-13 19:44:29 +01:00
6175413db2 Merge branch 'master' into memmgr
Some checks failed
Builds / ExectOS (amd64, release) (push) Failing after 27s
Builds / ExectOS (i686, debug) (push) Failing after 26s
Builds / ExectOS (i686, release) (push) Failing after 31s
Builds / ExectOS (amd64, debug) (push) Failing after 35s
2026-03-13 19:43:01 +01:00
428928c7e1 Simplify panic interface by using C++ overloading
All checks were successful
Builds / ExectOS (amd64, debug) (push) Successful in 27s
Builds / ExectOS (i686, release) (push) Successful in 27s
Builds / ExectOS (amd64, release) (push) Successful in 42s
Builds / ExectOS (i686, debug) (push) Successful in 40s
2026-03-13 19:42:03 +01:00
7d2b41a044 Calculate virtual address per page when initializing PFN entries
All checks were successful
Builds / ExectOS (amd64, release) (push) Successful in 23s
Builds / ExectOS (amd64, debug) (push) Successful in 39s
Builds / ExectOS (i686, debug) (push) Successful in 37s
Builds / ExectOS (i686, release) (push) Successful in 24s
2026-03-13 19:35:29 +01:00
3 changed files with 38 additions and 30 deletions

View File

@@ -20,7 +20,7 @@ namespace KE
public:
STATIC XTAPI VOID HaltSystem(VOID);
STATIC XTAPI VOID Panic(IN ULONG Code);
STATIC XTAPI VOID PanicEx(IN ULONG Code,
STATIC XTAPI VOID Panic(IN ULONG Code,
IN ULONG_PTR Parameter1,
IN ULONG_PTR Parameter2,
IN ULONG_PTR Parameter3,

View File

@@ -43,7 +43,7 @@ XTAPI
VOID
KE::Crash::Panic(IN ULONG Code)
{
PanicEx(Code, 0, 0, 0, 0);
Panic(Code, 0, 0, 0, 0);
}
/**
@@ -70,7 +70,7 @@ KE::Crash::Panic(IN ULONG Code)
*/
XTAPI
VOID
KE::Crash::PanicEx(IN ULONG Code,
KE::Crash::Panic(IN ULONG Code,
IN ULONG_PTR Parameter1,
IN ULONG_PTR Parameter2,
IN ULONG_PTR Parameter3,

View File

@@ -173,7 +173,7 @@ MM::Pfn::DecrementReferenceCount(IN PMMPFN PageFrameNumber,
if(PageFrameNumber->u2.ShareCount)
{
/* This indicates a bug; crash the system */
KE::Crash::PanicEx(0x4E,
KE::Crash::Panic(0x4E,
0x07,
PageFrameIndex,
PageFrameNumber->u2.ShareCount,
@@ -256,7 +256,7 @@ MM::Pfn::DecrementShareCount(IN PMMPFN PageFrameNumber,
(PageFrameNumber->u3.e1.PageLocation != StandbyPageList))
{
/* This indicates a bug; crash the system */
KE::Crash::PanicEx(0x4E,
KE::Crash::Panic(0x4E,
0x99,
PageFrameIndex,
PageFrameNumber->u3.e1.PageLocation,
@@ -591,7 +591,7 @@ MM::Pfn::LinkPage(IN PMMPFNLIST ListHead,
MM::Paging::GetPteSoftwareTransition(&PageFrame->OriginalPte))
{
/* Crash system due to corrupted PFN/PTE state */
KE::Crash::PanicEx(0x71, 0x8888, 0, 0, 0);
KE::Crash::Panic(0x71, 0x8888, 0, 0, 0);
}
}
@@ -806,7 +806,7 @@ MM::Pfn::LinkPfn(IN PFN_NUMBER PageFrameIndex,
if(Status != STATUS_SUCCESS)
{
/* Could not make the page table resident, crash system */
KE::Crash::PanicEx(0x1,
KE::Crash::Panic(0x1,
(ULONG_PTR)0x61940,
(ULONG_PTR)PointerPte,
MM::Paging::GetPageFrameNumber(PointerPte),
@@ -1034,7 +1034,7 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
IN PFN_NUMBER PageCount,
IN LOADER_MEMORY_TYPE MemoryType)
{
PVOID VirtualRangeStart, VirtualRangeEnd;
PVOID VirtualAddress, VirtualRangeStart, VirtualRangeEnd;
PFN_NUMBER PageNumber;
PMMPDE PointerPde;
PMMPFN Pfn;
@@ -1087,8 +1087,12 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
/* Ensure that the page is not already in-use */
if(Pfn->u3.e2.ReferenceCount == 0)
{
/* Calculate the virtual address for this page */
VirtualAddress = (PVOID)(KSEG0_BASE + ((BasePage + PageNumber) << MM_PAGE_SHIFT));
PointerPde = MM::Paging::GetPdeAddress(VirtualAddress);
/* Initialize the PFN entry to represent a ROM page */
Pfn->PteAddress = MM::Paging::GetPteAddress(VirtualRangeStart);
Pfn->PteAddress = MM::Paging::GetPteAddress(VirtualAddress);
Pfn->u1.Flink = 0;
Pfn->u2.ShareCount = 0;
Pfn->u3.e1.CacheAttribute = PfnCached;
@@ -1117,8 +1121,12 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
/* Ensure that the page is not already in-use */
if(Pfn->u3.e2.ReferenceCount == 0)
{
/* Calculate the virtual address for this page */
VirtualAddress = (PVOID)(KSEG0_BASE + ((BasePage + PageNumber) << MM_PAGE_SHIFT));
PointerPde = MM::Paging::GetPdeAddress(VirtualAddress);
/* Initialize the PFN entry to represent an in-use page and prevent it from being allocated */
Pfn->PteAddress = MM::Paging::GetPteAddress(VirtualRangeStart);
Pfn->PteAddress = MM::Paging::GetPteAddress(VirtualAddress);
Pfn->u2.ShareCount++;
Pfn->u3.e1.CacheAttribute = PfnCached;
Pfn->u3.e1.PageLocation = ActiveAndValid;