Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 23 of file mmfault.c.
Referenced by MmAccessFault().
{ PMMSUPPORT AddressSpace; MEMORY_AREA* MemoryArea; NTSTATUS Status; DPRINT("MmAccessFault(Mode %d, Address %x)\n", Mode, Address); if (KeGetCurrentIrql() >= DISPATCH_LEVEL) { DPRINT1("Page fault at high IRQL was %d\n", KeGetCurrentIrql()); return(STATUS_UNSUCCESSFUL); } /* * Find the memory area for the faulting address */ if (Address >= (ULONG_PTR)MmSystemRangeStart) { /* * Check permissions */ if (Mode != KernelMode) { DPRINT1("MmAccessFault(Mode %d, Address %x)\n", Mode, Address); return(STATUS_ACCESS_VIOLATION); } AddressSpace = MmGetKernelAddressSpace(); } else { AddressSpace = &PsGetCurrentProcess()->Vm; } if (!FromMdl) { MmLockAddressSpace(AddressSpace); } do { MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, (PVOID)Address); if (MemoryArea == NULL || MemoryArea->DeleteInProgress) { if (!FromMdl) { MmUnlockAddressSpace(AddressSpace); } return (STATUS_ACCESS_VIOLATION); } switch (MemoryArea->Type) { case MEMORY_AREA_SECTION_VIEW: Status = MmAccessFaultSectionView(AddressSpace, MemoryArea, (PVOID)Address); break; case MEMORY_AREA_CACHE: // This code locks for itself to keep from having to break a lock // passed in. if (!FromMdl) MmUnlockAddressSpace(AddressSpace); Status = MmAccessFaultCacheSection(Mode, Address, FromMdl); if (!FromMdl) MmLockAddressSpace(AddressSpace); break; default: Status = STATUS_ACCESS_VIOLATION; break; } } while (Status == STATUS_MM_RESTART_OPERATION); DPRINT("Completed page fault handling\n"); if (!FromMdl) { MmUnlockAddressSpace(AddressSpace); } return(Status); }