FASTCALL
MiCheckPdeForPagedPool(IN PVOID Address)
{
- PMMPTE PointerPde;
+ PMMPDE PointerPde;
NTSTATUS Status = STATUS_SUCCESS;
+ /* No session support in ReactOS yet */
+ ASSERT(MI_IS_SESSION_ADDRESS(Address) == FALSE);
+ ASSERT(MI_IS_SESSION_PTE(Address) == FALSE);
+
//
// Check if this is a fault while trying to access the page table itself
//
// Send a hint to the page fault handler that this is only a valid fault
// if we already detected this was access within the page table range
//
- PointerPde = MiAddressToPte(Address);
+ PointerPde = (PMMPDE)MiAddressToPte(Address);
Status = STATUS_WAIT_1;
}
else if (Address < MmSystemRangeStart)
//
if (PointerPde->u.Hard.Valid == 0)
{
+ /* This seems to be making the assumption that one PDE is one page long */
+ C_ASSERT(PAGE_SIZE == (PD_COUNT * (sizeof(MMPTE) * PDE_COUNT)));
+
//
// Copy it from our double-mapped system page directory
//
{
PFN_NUMBER PageFrameNumber;
MMPTE TempPte;
- DPRINT("ARM3 Demand Zero Page Fault Handler for address: %p in process: %p\n",
+ DPRINT1("ARM3 Demand Zero Page Fault Handler for address: %p in process: %p\n",
Address,
Process);
+ /* Must currently only be called by paging path, for system addresses only */
+ ASSERT(OldIrql == MM_NOIRQL);
+ ASSERT(Process == NULL);
+
//
// Lock the PFN database
//
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
ASSERT(PointerPte->u.Hard.Valid == 0);
- //
- // Get a page
- //
- PageFrameNumber = MmAllocPage(MC_PPOOL, 0);
+ /* Get a page */
+ PageFrameNumber = MiRemoveAnyPage(0);
DPRINT("New pool page: %lx\n", PageFrameNumber);
+ /* Initialize it */
+ MiInitializePfn(PageFrameNumber, PointerPte, TRUE);
+
//
// Release PFN lock
//
//
InterlockedIncrement(&KeGetCurrentPrcb()->MmDemandZeroCount);
- //
- // Build the PTE
- //
- TempPte = HyperTemplatePte;
- TempPte.u.Hard.PageFrameNumber = PageFrameNumber;
+ /* Shouldn't see faults for user PTEs yet */
+ ASSERT(PointerPte > MiHighestUserPte);
+
+ /* Build the PTE */
+ MI_MAKE_HARDWARE_PTE(&TempPte, PointerPte, PointerPte->u.Soft.Protection, PageFrameNumber);
+ ASSERT(TempPte.u.Hard.Valid == 1);
+ ASSERT(PointerPte->u.Hard.Valid == 0);
*PointerPte = TempPte;
ASSERT(PointerPte->u.Hard.Valid == 1);
//
TempPte = *PointerPte;
+ /* No prototype */
+ ASSERT(PrototypePte == NULL);
+
//
// The PTE must be invalid, but not totally blank
//
Status = MiResolveDemandZeroFault(Address,
PointerPte,
Process,
- -1);
+ MM_NOIRQL);
+ ASSERT(KeAreAllApcsDisabled () == TRUE);
if (NT_SUCCESS(Status))
{
//
IN PVOID TrapInformation)
{
KIRQL OldIrql = KeGetCurrentIrql(), LockIrql;
- PMMPTE PointerPde, PointerPte;
+ PMMPTE PointerPte;
+ PMMPDE PointerPde;
MMPTE TempPte;
PETHREAD CurrentThread;
NTSTATUS Status;
//
// This might happen...not sure yet
//
- DPRINT1("FAULT ON PAGE TABLES!\n");
+ DPRINT1("FAULT ON PAGE TABLES: %p %lx %lx!\n", Address, *PointerPte, *PointerPde);
//
// Map in the page table