Compare commits
4 Commits
xtldr_pml_
...
memmgr
| Author | SHA1 | Date | |
|---|---|---|---|
|
d263f17831
|
|||
|
6175413db2
|
|||
|
428928c7e1
|
|||
|
7d2b41a044
|
@@ -20,11 +20,11 @@ namespace KE
|
|||||||
public:
|
public:
|
||||||
STATIC XTAPI VOID HaltSystem(VOID);
|
STATIC XTAPI VOID HaltSystem(VOID);
|
||||||
STATIC XTAPI VOID Panic(IN ULONG Code);
|
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 Parameter1,
|
||||||
IN ULONG_PTR Parameter2,
|
IN ULONG_PTR Parameter2,
|
||||||
IN ULONG_PTR Parameter3,
|
IN ULONG_PTR Parameter3,
|
||||||
IN ULONG_PTR Parameter4);
|
IN ULONG_PTR Parameter4);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ XTAPI
|
|||||||
VOID
|
VOID
|
||||||
KE::Crash::Panic(IN ULONG Code)
|
KE::Crash::Panic(IN ULONG Code)
|
||||||
{
|
{
|
||||||
PanicEx(Code, 0, 0, 0, 0);
|
Panic(Code, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,11 +70,11 @@ KE::Crash::Panic(IN ULONG Code)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KE::Crash::PanicEx(IN ULONG Code,
|
KE::Crash::Panic(IN ULONG Code,
|
||||||
IN ULONG_PTR Parameter1,
|
IN ULONG_PTR Parameter1,
|
||||||
IN ULONG_PTR Parameter2,
|
IN ULONG_PTR Parameter2,
|
||||||
IN ULONG_PTR Parameter3,
|
IN ULONG_PTR Parameter3,
|
||||||
IN ULONG_PTR Parameter4)
|
IN ULONG_PTR Parameter4)
|
||||||
{
|
{
|
||||||
KD::DebugIo::KdPrint(L"Fatal System Error: 0x%08lx\nKernel Panic!\n\n", Code);
|
KD::DebugIo::KdPrint(L"Fatal System Error: 0x%08lx\nKernel Panic!\n\n", Code);
|
||||||
HaltSystem();
|
HaltSystem();
|
||||||
|
|||||||
@@ -173,11 +173,11 @@ MM::Pfn::DecrementReferenceCount(IN PMMPFN PageFrameNumber,
|
|||||||
if(PageFrameNumber->u2.ShareCount)
|
if(PageFrameNumber->u2.ShareCount)
|
||||||
{
|
{
|
||||||
/* This indicates a bug; crash the system */
|
/* This indicates a bug; crash the system */
|
||||||
KE::Crash::PanicEx(0x4E,
|
KE::Crash::Panic(0x4E,
|
||||||
0x07,
|
0x07,
|
||||||
PageFrameIndex,
|
PageFrameIndex,
|
||||||
PageFrameNumber->u2.ShareCount,
|
PageFrameNumber->u2.ShareCount,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the PTE is marked as being ready for removal */
|
/* Check if the PTE is marked as being ready for removal */
|
||||||
@@ -256,11 +256,11 @@ MM::Pfn::DecrementShareCount(IN PMMPFN PageFrameNumber,
|
|||||||
(PageFrameNumber->u3.e1.PageLocation != StandbyPageList))
|
(PageFrameNumber->u3.e1.PageLocation != StandbyPageList))
|
||||||
{
|
{
|
||||||
/* This indicates a bug; crash the system */
|
/* This indicates a bug; crash the system */
|
||||||
KE::Crash::PanicEx(0x4E,
|
KE::Crash::Panic(0x4E,
|
||||||
0x99,
|
0x99,
|
||||||
PageFrameIndex,
|
PageFrameIndex,
|
||||||
PageFrameNumber->u3.e1.PageLocation,
|
PageFrameNumber->u3.e1.PageLocation,
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decrement the PFN share count */
|
/* Decrement the PFN share count */
|
||||||
@@ -591,7 +591,7 @@ MM::Pfn::LinkPage(IN PMMPFNLIST ListHead,
|
|||||||
MM::Paging::GetPteSoftwareTransition(&PageFrame->OriginalPte))
|
MM::Paging::GetPteSoftwareTransition(&PageFrame->OriginalPte))
|
||||||
{
|
{
|
||||||
/* Crash system due to corrupted PFN/PTE state */
|
/* 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,11 +806,11 @@ MM::Pfn::LinkPfn(IN PFN_NUMBER PageFrameIndex,
|
|||||||
if(Status != STATUS_SUCCESS)
|
if(Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Could not make the page table resident, crash system */
|
/* Could not make the page table resident, crash system */
|
||||||
KE::Crash::PanicEx(0x1,
|
KE::Crash::Panic(0x1,
|
||||||
(ULONG_PTR)0x61940,
|
(ULONG_PTR)0x61940,
|
||||||
(ULONG_PTR)PointerPte,
|
(ULONG_PTR)PointerPte,
|
||||||
MM::Paging::GetPageFrameNumber(PointerPte),
|
MM::Paging::GetPageFrameNumber(PointerPte),
|
||||||
(ULONG_PTR)MM::Paging::GetPteVirtualAddress(PointerPte));
|
(ULONG_PTR)MM::Paging::GetPteVirtualAddress(PointerPte));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1034,7 +1034,7 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
|
|||||||
IN PFN_NUMBER PageCount,
|
IN PFN_NUMBER PageCount,
|
||||||
IN LOADER_MEMORY_TYPE MemoryType)
|
IN LOADER_MEMORY_TYPE MemoryType)
|
||||||
{
|
{
|
||||||
PVOID VirtualRangeStart, VirtualRangeEnd;
|
PVOID VirtualAddress, VirtualRangeStart, VirtualRangeEnd;
|
||||||
PFN_NUMBER PageNumber;
|
PFN_NUMBER PageNumber;
|
||||||
PMMPDE PointerPde;
|
PMMPDE PointerPde;
|
||||||
PMMPFN Pfn;
|
PMMPFN Pfn;
|
||||||
@@ -1087,8 +1087,12 @@ MM::Pfn::ProcessMemoryDescriptor(IN PFN_NUMBER BasePage,
|
|||||||
/* Ensure that the page is not already in-use */
|
/* Ensure that the page is not already in-use */
|
||||||
if(Pfn->u3.e2.ReferenceCount == 0)
|
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 */
|
/* 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->u1.Flink = 0;
|
||||||
Pfn->u2.ShareCount = 0;
|
Pfn->u2.ShareCount = 0;
|
||||||
Pfn->u3.e1.CacheAttribute = PfnCached;
|
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 */
|
/* Ensure that the page is not already in-use */
|
||||||
if(Pfn->u3.e2.ReferenceCount == 0)
|
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 */
|
/* 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->u2.ShareCount++;
|
||||||
Pfn->u3.e1.CacheAttribute = PfnCached;
|
Pfn->u3.e1.CacheAttribute = PfnCached;
|
||||||
Pfn->u3.e1.PageLocation = ActiveAndValid;
|
Pfn->u3.e1.PageLocation = ActiveAndValid;
|
||||||
|
|||||||
Reference in New Issue
Block a user