#endif
}
- //
- // Check if this is an ARM3 memory area
- //
+ /*
+ * Check if this is an ARM3 memory area or if there's no memory area at all.
+ * The latter can happen early in the boot cycle when ARM3 paged pool is in
+ * use before having defined the memory areas proper.
+ * A proper fix would be to define memory areas in the ARM3 code, but we want
+ * to avoid adding this ReactOS-specific construct to ARM3 code.
+ * Either way, in the future, as ReactOS-paged pool is eliminated, this hack
+ * can go away.
+ */
MemoryArea = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(), Address);
- if ((MemoryArea) && (MemoryArea->Type == MEMORY_AREA_OWNED_BY_ARM3))
+ if ((!(MemoryArea) && ((ULONG_PTR)Address >= (ULONG_PTR)MmPagedPoolStart)) ||
+ ((MemoryArea) && (MemoryArea->Type == MEMORY_AREA_OWNED_BY_ARM3)))
{
//
// Hand it off to more competent hands...
//
+ DPRINT("ARM3 fault %p\n", MemoryArea);
return MmArmAccessFault(StoreInstruction, Address, Mode, TrapInformation);
}
{
NTSTATUS Status;
PFN_TYPE AllocatedPage;
- KIRQL OldIrql;
Status = MmRequestPageMemoryConsumer(MC_PPOOL, FALSE, &AllocatedPage);
if (!NT_SUCCESS(Status))
PAGE_READWRITE,
&AllocatedPage,
1);
- if (Locked)
- {
- OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
- MmLockPage(AllocatedPage);
- KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
- }
return(Status);
}
-
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-/*
- * @implemented
- */
-BOOLEAN
-NTAPI
-MmIsAddressValid(IN PVOID VirtualAddress)
-{
- MEMORY_AREA* MemoryArea;
- PMMSUPPORT AddressSpace;
-
- DPRINT1("WARNING: %s returns bogus result\n", __FUNCTION__);
-
- if (VirtualAddress >= MmSystemRangeStart)
- {
- AddressSpace = MmGetKernelAddressSpace();
- }
- else
- {
- AddressSpace = &PsGetCurrentProcess()->Vm;
- }
-
- MmLockAddressSpace(AddressSpace);
- MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
- VirtualAddress);
-
- if (MemoryArea == NULL || MemoryArea->DeleteInProgress)
- {
- MmUnlockAddressSpace(AddressSpace);
- return(FALSE);
- }
- MmUnlockAddressSpace(AddressSpace);
- return(TRUE);
-}
-
-/* EOF */