[RSHELL]
[reactos.git] / ntoskrnl / mm / mmfault.c
index 9a3ecf9..602d708 100644 (file)
@@ -9,9 +9,7 @@
 /* INCLUDES *******************************************************************/
 
 #include <ntoskrnl.h>
-#ifdef NEWCC
 #include "../cache/section/newmm.h"
-#endif
 #define NDEBUG
 #include <debug.h>
 
@@ -29,13 +27,12 @@ MmpAccessFault(KPROCESSOR_MODE Mode,
    PMMSUPPORT AddressSpace;
    MEMORY_AREA* MemoryArea;
    NTSTATUS Status;
-   BOOLEAN Locked = FromMdl;
 
    DPRINT("MmAccessFault(Mode %d, Address %x)\n", Mode, Address);
 
    if (KeGetCurrentIrql() >= DISPATCH_LEVEL)
    {
-      DPRINT1("Page fault at high IRQL was %d\n", KeGetCurrentIrql());
+      DPRINT1("Page fault at high IRQL was %u\n", KeGetCurrentIrql());
       return(STATUS_UNSUCCESSFUL);
    }
 
@@ -80,26 +77,19 @@ MmpAccessFault(KPROCESSOR_MODE Mode,
          case MEMORY_AREA_SECTION_VIEW:
             Status = MmAccessFaultSectionView(AddressSpace,
                                               MemoryArea,
-                                              (PVOID)Address,
-                                              Locked);
+                                              (PVOID)Address);
             break;
 
-         case MEMORY_AREA_VIRTUAL_MEMORY:
-            Status = STATUS_ACCESS_VIOLATION;
+         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;
 
-#ifdef NEWCC
-            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, Locked);
-                       if (!FromMdl)
-                               MmLockAddressSpace(AddressSpace);
-                       break;
-#endif
-
          default:
             Status = STATUS_ACCESS_VIOLATION;
             break;
@@ -124,13 +114,12 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
    PMMSUPPORT AddressSpace;
    MEMORY_AREA* MemoryArea;
    NTSTATUS Status;
-   BOOLEAN Locked = FromMdl;
 
    DPRINT("MmNotPresentFault(Mode %d, Address %x)\n", Mode, Address);
 
    if (KeGetCurrentIrql() >= DISPATCH_LEVEL)
    {
-      DPRINT1("Page fault at high IRQL was %d, address %x\n", KeGetCurrentIrql(), Address);
+      DPRINT1("Page fault at high IRQL was %u, address %x\n", KeGetCurrentIrql(), Address);
       return(STATUS_UNSUCCESSFUL);
    }
 
@@ -144,7 +133,7 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
        */
       if (Mode != KernelMode)
       {
-        DPRINT1("Address: %x\n", Address);
+         DPRINT1("Address: %x\n", Address);
          return(STATUS_ACCESS_VIOLATION);
       }
       AddressSpace = MmGetKernelAddressSpace();
@@ -180,28 +169,19 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
             Status = MmNotPresentFaultSectionView(AddressSpace,
                                                   MemoryArea,
                                                   (PVOID)Address,
-                                                  Locked);
+                                                  FromMdl);
             break;
 
-         case MEMORY_AREA_VIRTUAL_MEMORY:
-            Status = MmNotPresentFaultVirtualMemory(AddressSpace,
-                                                    MemoryArea,
-                                                    (PVOID)Address,
-                                                    Locked);
+         case MEMORY_AREA_CACHE:
+            // This code locks for itself to keep from having to break a lock
+            // passed in.
+            if (!FromMdl)
+               MmUnlockAddressSpace(AddressSpace);
+            Status = MmNotPresentFaultCacheSection(Mode, Address, FromMdl);
+            if (!FromMdl)
+               MmLockAddressSpace(AddressSpace);
             break;
 
-#ifdef  NEWCC
-           case MEMORY_AREA_CACHE:
-                       // This code locks for itself to keep from having to break a lock
-                       // passed in.
-                       if (!FromMdl)
-                               MmUnlockAddressSpace(AddressSpace);
-                   Status = MmNotPresentFaultCacheSection(Mode, Address, Locked);
-                       if (!FromMdl)
-                               MmLockAddressSpace(AddressSpace);
-                       break;
-#endif
-
          default:
             Status = STATUS_ACCESS_VIOLATION;
             break;
@@ -240,7 +220,7 @@ MmAccessFault(IN BOOLEAN StoreInstruction,
         }
 #endif
     }
-    
+
     /* Is there a ReactOS address space yet? */
     if (MmGetKernelAddressSpace())
     {
@@ -252,7 +232,7 @@ MmAccessFault(IN BOOLEAN StoreInstruction,
             MemoryArea = MmLocateMemoryAreaByAddress(MmGetCurrentAddressSpace(), Address);
         }
     }
-    
+
     /* Is this an ARM3 memory area, or is there no address space yet? */
     if (((MemoryArea) && (MemoryArea->Type == MEMORY_AREA_OWNED_BY_ARM3)) ||
         (!(MemoryArea) && ((ULONG_PTR)Address >= (ULONG_PTR)MmPagedPoolStart)) ||