[NTOSKRNL]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 23 Nov 2013 00:43:06 +0000 (00:43 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 23 Nov 2013 00:43:06 +0000 (00:43 +0000)
- Add hacks to MmMapViewInSessionSpace and MmUnmapViewInSessionSpace to check for legacy (non ARM3) sections (image sections) and (un)map them in system space instead.
- Fix MmCommitSessionMappedView (it wasn't resetting the PointerPte to the start, when processing the PTE range a second time)
- Remove an ASSERT that didn't allow unmapping session space mappings, since that works (see CORE-6729)
- Change a write to a PTE to using MI_WRITE_VALID_PTE

svn path=/trunk/; revision=61081

reactos/ntoskrnl/mm/ARM3/section.c

index f05b1a7..09e284e 100644 (file)
@@ -1917,7 +1917,7 @@ MiFlushTbAndCapture(IN PMMVAD FoundVad,
     ASSERT(PointerPte->u.Hard.Valid == 1);
     ASSERT(TempPte.u.Hard.Valid == 1);
     ASSERT(PointerPte->u.Hard.PageFrameNumber == TempPte.u.Hard.PageFrameNumber);
-    *PointerPte = TempPte;
+    MI_WRITE_VALID_PTE(PointerPte, TempPte);
 
     //
     // Flush the TLB
@@ -2257,9 +2257,6 @@ MiUnmapViewInSystemSpace(IN PMMSESSION Session,
     PCONTROL_AREA ControlArea;
     PAGED_CODE();
 
-    /* Only global mappings supported for now */
-    ASSERT(Session == &MmSession);
-
     /* Remove this mapping */
     KeAcquireGuardedMutex(Session->SystemSpaceViewLockPointer);
     Size = MiRemoveFromSystemSpace(Session, MappedBase, &ControlArea);
@@ -2783,6 +2780,12 @@ MmMapViewInSessionSpace(IN PVOID Section,
 {
     PAGED_CODE();
 
+    // HACK
+    if (MiIsRosSectionObject(Section))
+    {
+        return MmMapViewInSystemSpace(Section, MappedBase, ViewSize);
+    }
+
     /* Process must be in a session */
     if (PsGetCurrentProcess()->ProcessInSession == FALSE)
     {
@@ -2807,6 +2810,12 @@ MmUnmapViewInSessionSpace(IN PVOID MappedBase)
 {
     PAGED_CODE();
 
+    // HACK
+    if (!MI_IS_SESSION_ADDRESS(MappedBase))
+    {
+        return MmUnmapViewInSystemSpace(MappedBase);
+    }
+
     /* Process must be in a session */
     if (PsGetCurrentProcess()->ProcessInSession == FALSE)
     {
@@ -2990,6 +2999,7 @@ MmCommitSessionMappedView(IN PVOID MappedBase,
     ASSERT(TempPte.u.Long != 0);
 
     /* Loop all prototype PTEs to be committed */
+    PointerPte = ProtoPte;
     while (PointerPte < LastProtoPte)
     {
         /* Make sure the PTE is already invalid */