What JIRA task is this associated with?

-----Original Message-----
From: ros-diffs-boun...@reactos.org [mailto:ros-diffs-boun...@reactos.org] On 
Behalf Of pschweit...@svn.reactos.org
Sent: Tuesday, November 5, 2013 2:04 PM
To: ros-di...@reactos.org
Subject: [ros-diffs] [pschweitzer] 60871: [NTOSKRNL] - Implement 
MiUnlockProcessWorkingSetShared() and make use of it in 
MiUnlockProcessWorkingSetForFault(). - Complete implementation of 
MiLockProcessWorkingSetForFault()

Author: pschweitzer
Date: Tue Nov  5 22:03:42 2013
New Revision: 60871

URL: http://svn.reactos.org/svn/reactos?rev=60871&view=rev
Log:
[NTOSKRNL]
- Implement MiUnlockProcessWorkingSetShared() and make use of it in 
MiUnlockProcessWorkingSetForFault().
- Complete implementation of MiLockProcessWorkingSetForFault()

Modified:
    trunk/reactos/ntoskrnl/mm/ARM3/miarm.h

Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?rev=60871&r1=60870&r2=60871&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h      [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h      [iso-8859-1] Tue Nov  5 
22:03:42 2013
@@ -1197,6 +1197,30 @@
 //
 FORCEINLINE
 VOID
+MiUnlockProcessWorkingSetShared(IN PEPROCESS Process,
+                                IN PETHREAD Thread) {
+    /* Make sure we are the owner of a safe acquisition (because shared) */
+    ASSERT(MI_WS_OWNER(Process));
+    ASSERT(!MI_IS_WS_UNSAFE(Process));
+
+    /* Ensure we are in a shared acquisition */
+    ASSERT(Thread->OwnsProcessWorkingSetShared == TRUE);
+    ASSERT(Thread->OwnsProcessWorkingSetExclusive == FALSE);
+
+    /* Don't claim the lock anylonger */
+    Thread->OwnsProcessWorkingSetShared = FALSE;
+
+    /* Release the lock and re-enable APCs */
+    ExReleasePushLockShared(&Process->Vm.WorkingSetMutex);
+    KeLeaveGuardedRegion();
+}
+
+//
+// Unlocks the working set for the given process // FORCEINLINE VOID
 MiUnlockProcessWorkingSetUnsafe(IN PEPROCESS Process,
                                 IN PETHREAD Thread)  { @@ -1330,7 +1354,7 @@
     else
     {
         /* Owner is shared (implies safe), release normally */
-        ASSERT(FALSE);
+        MiUnlockProcessWorkingSetShared(Process, Thread);
         *Safe = TRUE;
         *Shared = TRUE;
     }
@@ -1343,16 +1367,24 @@
                                 IN BOOLEAN Safe,
                                 IN BOOLEAN Shared)  {
-    ASSERT(Shared == FALSE);
-
     /* Check if this was a safe lock or not */
     if (Safe)
     {
-        /* Reacquire safely */
-        MiLockProcessWorkingSet(Process, Thread);
+        if (Shared)
+        {
+            /* Reacquire safely & shared */
+            MiLockProcessWorkingSetShared(Process, Thread);
+        }
+        else
+        {
+            /* Reacquire safely */
+            MiLockProcessWorkingSet(Process, Thread);
+        }
     }
     else
     {
+        /* Unsafe lock cannot be shared */
+        ASSERT(Shared == FALSE);
         /* Reacquire unsafely */
         MiLockProcessWorkingSetUnsafe(Process, Thread);
     }



_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Reply via email to