[ros-diffs] [ion] 21933: - Use the Spare0 array, present in EPROCESS instead of ReactOS-specific members for Process Locking (temporary fix until pushlocks are used).

ion at svn.reactos.org ion at svn.reactos.org
Thu May 18 20:55:38 CEST 2006


Author: ion
Date: Thu May 18 22:55:38 2006
New Revision: 21933

URL: http://svn.reactos.ru/svn/reactos?rev=21933&view=rev
Log:
- Use the Spare0 array, present in EPROCESS instead of ReactOS-specific members for Process Locking (temporary fix until pushlocks are used).

Modified:
    trunk/reactos/ntoskrnl/include/internal/ps.h
    trunk/reactos/ntoskrnl/ps/kill.c
    trunk/reactos/ntoskrnl/ps/process.c
    trunk/reactos/ntoskrnl/ps/psmgr.c

Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/include/internal/ps.h?rev=21933&r1=21932&r2=21933&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ps.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ps.h Thu May 18 22:55:38 2006
@@ -200,9 +200,6 @@
     UCHAR PriorityClass;
     MM_AVL_TABLE VadRoot;
     ULONG Cookie;
-    KEVENT LockEvent;
-    ULONG LockCount;
-    struct _KTHREAD *LockOwner;
     MADDRESS_SPACE AddressSpace;
 } ROS_EPROCESS, *PROS_EPROCESS;
 #include <poppack.h>

Modified: trunk/reactos/ntoskrnl/ps/kill.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ps/kill.c?rev=21933&r1=21932&r2=21933&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ps/kill.c (original)
+++ trunk/reactos/ntoskrnl/ps/kill.c Thu May 18 22:55:38 2006
@@ -14,6 +14,11 @@
 #define NDEBUG
 #include <internal/debug.h>
 
+#define LockEvent Spare0[0]
+#define LockCount Spare0[1]
+#define LockOwner Spare0[2]
+
+
 /* GLOBALS *******************************************************************/
 
 PETHREAD PspReaperList = NULL;
@@ -158,6 +163,9 @@
     {
         ExDestroyHandle(PspCidTable, Process->UniqueProcessId);
     }
+
+    /* Delete the process lock */
+    ExFreePool(((PROS_EPROCESS)Process)->LockEvent);
 
     /* KDB hook */
     KDB_DELETEPROCESS_HOOK(Process);

Modified: trunk/reactos/ntoskrnl/ps/process.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ps/process.c?rev=21933&r1=21932&r2=21933&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ps/process.c (original)
+++ trunk/reactos/ntoskrnl/ps/process.c Thu May 18 22:55:38 2006
@@ -14,6 +14,10 @@
 #define NDEBUG
 #include <internal/debug.h>
 
+#define LockEvent Spare0[0]
+#define LockCount Spare0[1]
+#define LockOwner Spare0[2]
+
 /* GLOBALS ******************************************************************/
 
 PEPROCESS PsInitialSystemProcess = NULL;
@@ -52,7 +56,7 @@
       /* we got the lock or already locked it */
       if(InterlockedIncrementUL(&Process->LockCount) == 1)
       {
-        KeClearEvent(&Process->LockEvent);
+        KeClearEvent(Process->LockEvent);
       }
 
       return STATUS_SUCCESS;
@@ -61,7 +65,7 @@
     {
       if(++Attempts > 2)
       {
-        Status = KeWaitForSingleObject(&Process->LockEvent,
+        Status = KeWaitForSingleObject(Process->LockEvent,
                                        Executive,
                                        KernelMode,
                                        FALSE,
@@ -99,7 +103,7 @@
   if(InterlockedDecrementUL(&Process->LockCount) == 0)
   {
     (void)InterlockedExchangePointer(&Process->LockOwner, NULL);
-    KeSetEvent(&Process->LockEvent, IO_NO_INCREMENT, FALSE);
+    KeSetEvent(Process->LockEvent, IO_NO_INCREMENT, FALSE);
   }
 
   KeLeaveCriticalRegion();
@@ -325,7 +329,10 @@
 
     /* Setup the Lock Event */
     DPRINT("Initialzing Process Lock\n");
-    KeInitializeEvent(&((PROS_EPROCESS)Process)->LockEvent, SynchronizationEvent, FALSE);
+    ((PROS_EPROCESS)Process)->LockEvent = ExAllocatePoolWithTag(PagedPool,
+                                                                sizeof(KEVENT),
+                                                                TAG('P', 's', 'L', 'k'));
+    KeInitializeEvent(((PROS_EPROCESS)Process)->LockEvent, SynchronizationEvent, FALSE);
 
     /* Setup the Thread List Head */
     DPRINT("Initialzing Process ThreadListHead\n");

Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ps/psmgr.c?rev=21933&r1=21932&r2=21933&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ps/psmgr.c (original)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c Thu May 18 22:55:38 2006
@@ -13,6 +13,10 @@
 #include <ntoskrnl.h>
 #define NDEBUG
 #include <internal/debug.h>
+
+#define LockEvent Spare0[0]
+#define LockCount Spare0[1]
+#define LockOwner Spare0[2]
 
 extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
 extern LIST_ENTRY PriorityListHead[MAXIMUM_PRIORITY];
@@ -253,7 +257,9 @@
    MmInitializeAddressSpace((PROS_EPROCESS)PsInitialSystemProcess,
 			    &((PROS_EPROCESS)PsInitialSystemProcess)->AddressSpace);
 
-   KeInitializeEvent(&((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent, SynchronizationEvent, FALSE);
+   ((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent = 
+       ExAllocatePoolWithTag(PagedPool, sizeof(KEVENT), TAG('P', 's', 'L', 'k'));
+   KeInitializeEvent(((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent, SynchronizationEvent, FALSE);
 
 #if defined(__GNUC__)
    KProcess->DirectoryTableBase =




More information about the Ros-diffs mailing list