[ros-diffs] [ion] 24426: - Add PROFILE_ACPI_DOCKING_STATE. - Fix HvInitialize definition to match more closely NT's since I need some of the extra parameters for the cm rewrite. - Implement ExInitializePushLock and ExConvertPushLockSharedToExclusive macros.

ion at svn.reactos.org ion at svn.reactos.org
Sat Oct 7 18:37:04 CEST 2006


Author: ion
Date: Fri Oct  6 23:29:25 2006
New Revision: 24426

URL: http://svn.reactos.org/svn/reactos?rev=24426&view=rev
Log:
- Add PROFILE_ACPI_DOCKING_STATE.
- Fix HvInitialize definition to match more closely NT's since I need some of the extra parameters for the cm rewrite.
- Implement ExInitializePushLock and ExConvertPushLockSharedToExclusive macros.

Modified:
    trunk/reactos/include/reactos/arc/arc.h
    trunk/reactos/lib/cmlib/cmlib.h
    trunk/reactos/lib/cmlib/hiveinit.c
    trunk/reactos/ntoskrnl/cm/import.c
    trunk/reactos/ntoskrnl/cm/regfile.c
    trunk/reactos/ntoskrnl/include/internal/ex.h

Modified: trunk/reactos/include/reactos/arc/arc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arc/arc.h?rev=24426&r1=24425&r2=24426&view=diff
==============================================================================
--- trunk/reactos/include/reactos/arc/arc.h (original)
+++ trunk/reactos/include/reactos/arc/arc.h Fri Oct  6 23:29:25 2006
@@ -151,6 +151,16 @@
 } NLS_DATA_BLOCK, *PNLS_DATA_BLOCK;
 
 //
+// ACPI Docking State
+//
+typedef struct _PROFILE_ACPI_DOCKING_STATE
+{
+    USHORT DockingState;
+    USHORT SerialLength;
+    WCHAR SerialNumber[1];
+} PROFILE_ACPI_DOCKING_STATE, *PPROFILE_ACPI_DOCKING_STATE;
+
+//
 // Subsystem Specific Loader Blocks
 //
 typedef struct _PROFILE_PARAMETER_BLOCK

Modified: trunk/reactos/lib/cmlib/cmlib.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmlib.h?rev=24426&r1=24425&r2=24426&view=diff
==============================================================================
--- trunk/reactos/lib/cmlib/cmlib.h (original)
+++ trunk/reactos/lib/cmlib/cmlib.h Fri Oct  6 23:29:25 2006
@@ -18,7 +18,7 @@
 #define ROUND_DOWN(a,b)      (((a)/(b))*(b))
 #endif
 
-#define CMAPI
+#define CMAPI NTAPI
 
 struct _HHIVE;
 
@@ -110,6 +110,10 @@
     BOOLEAN ReadOnly;
     BOOLEAN Log;
     BOOLEAN DirtyFlag;
+    ULONG HvBinHeadersUse;
+    ULONG HvFreeCellsUse;
+    ULONG HvUsedcellsUse;
+    ULONG CmUsedCellsUse;
     ULONG HiveFlags;
     ULONG LogSize;
     ULONG RefreshCount;
@@ -146,6 +150,8 @@
    ULONG Operation,
    ULONG_PTR HiveData OPTIONAL,
    ULONG Cluster OPTIONAL,
+   ULONG Flags,
+   ULONG FileType,
    PALLOCATE_ROUTINE Allocate,
    PFREE_ROUTINE Free,
    PFILE_READ_ROUTINE FileRead,
@@ -163,6 +169,9 @@
    PHHIVE RegistryHive,
    HCELL_INDEX CellOffset);
 
+#define HvReleaseCell(h, c)     \
+    if (h->ReleaseCellRoutine) h->ReleaseCellRoutine(h, c)
+
 LONG CMAPI
 HvGetCellSize(
    PHHIVE RegistryHive,

Modified: trunk/reactos/lib/cmlib/hiveinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hiveinit.c?rev=24426&r1=24425&r2=24426&view=diff
==============================================================================
--- trunk/reactos/lib/cmlib/hiveinit.c (original)
+++ trunk/reactos/lib/cmlib/hiveinit.c Fri Oct  6 23:29:25 2006
@@ -306,6 +306,8 @@
 HvInitialize(
    PHHIVE RegistryHive,
    ULONG Operation,
+   ULONG HiveType,
+   ULONG HiveFlags,
    ULONG_PTR HiveData OPTIONAL,
    ULONG Cluster OPTIONAL,
    PALLOCATE_ROUTINE Allocate,

Modified: trunk/reactos/ntoskrnl/cm/import.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/import.c?rev=24426&r1=24425&r2=24426&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cm/import.c (original)
+++ trunk/reactos/ntoskrnl/cm/import.c Fri Oct  6 23:29:25 2006
@@ -52,7 +52,7 @@
 
   /* Allocate hive header */
   ((PHBASE_BLOCK)ChunkBase)->Length = ChunkSize;
-  Status = HvInitialize(&Hive->Hive, HV_OPERATION_MEMORY,
+  Status = HvInitialize(&Hive->Hive, HV_OPERATION_MEMORY, 0, 0,
                         (ULONG_PTR)ChunkBase, 0,
                         CmpAllocate, CmpFree,
                         CmpFileRead, CmpFileWrite, CmpFileSetSize,

Modified: trunk/reactos/ntoskrnl/cm/regfile.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regfile.c?rev=24426&r1=24425&r2=24426&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cm/regfile.c (original)
+++ trunk/reactos/ntoskrnl/cm/regfile.c Fri Oct  6 23:29:25 2006
@@ -141,7 +141,7 @@
 
   CmHive = CmpAllocate(sizeof(EREGISTRY_HIVE), TRUE);
   CmHive->HiveHandle = FileHandle;
-  Status = HvInitialize(&CmHive->Hive, HV_OPERATION_CREATE_HIVE, 0, 0,
+  Status = HvInitialize(&CmHive->Hive, HV_OPERATION_CREATE_HIVE, 0, 0, 0, 0,
                         CmpAllocate, CmpFree,
                         CmpFileRead, CmpFileWrite, CmpFileSetSize,
                         CmpFileFlush, NULL);
@@ -570,7 +570,7 @@
   DPRINT("ViewBase %p  ViewSize %lx\n", ViewBase, ViewSize);
 
   ((PHBASE_BLOCK)ViewBase)->Length = ViewSize;
-  Status = HvInitialize(&RegistryHive->Hive, HV_OPERATION_MEMORY,
+  Status = HvInitialize(&RegistryHive->Hive, HV_OPERATION_MEMORY, 0, 0,
                         (ULONG_PTR)ViewBase, 0,
                         CmpAllocate, CmpFree,
                         CmpFileRead, CmpFileWrite, CmpFileSetSize,
@@ -622,7 +622,7 @@
 
   DPRINT("Hive 0x%p\n", Hive);
 
-  Status = HvInitialize(&Hive->Hive, HV_OPERATION_CREATE_HIVE, 0, 0,
+  Status = HvInitialize(&Hive->Hive, HV_OPERATION_CREATE_HIVE, 0, 0, 0, 0,
                         CmpAllocate, CmpFree,
                         CmpFileRead, CmpFileWrite, CmpFileSetSize,
                         CmpFileFlush, NULL);

Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/ex.h?rev=24426&r1=24425&r2=24426&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ex.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ex.h Fri Oct  6 23:29:25 2006
@@ -14,6 +14,7 @@
 extern FAST_MUTEX ExpEnvironmentLock;
 extern ERESOURCE ExpFirmwareTableResource;
 extern LIST_ENTRY ExpFirmwareTableProviderListHead;
+extern BOOLEAN ExpIsWinPEMode;
 ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
 ULONG ExpUnicodeCaseTableDataOffset;
 PVOID ExpNlsSectionPointer;
@@ -139,6 +140,14 @@
 NTAPI
 ExInitPoolLookasidePointers(VOID);
 
+/* Callback Functions ********************************************************/
+
+VOID
+NTAPI
+ExInitializeCallBack(
+    IN PEX_CALLBACK Callback
+);
+
 /* Rundown Functions ********************************************************/
 
 VOID
@@ -312,6 +321,7 @@
 #define ExpSetRundown(x, y) InterlockedExchange64((PLONGLONG)x, y)
 #else
 #define ExpChangeRundown(x, y, z) InterlockedCompareExchange((PLONG)x, PtrToLong(y), PtrToLong(z))
+#define ExpChangePushlock(x, y, z) LongToPtr(InterlockedCompareExchange((PLONG)x, PtrToLong(y), PtrToLong(z)))
 #define ExpSetRundown(x, y) InterlockedExchange((PLONG)x, y)
 #endif
 
@@ -484,6 +494,28 @@
 /* PUSHLOCKS *****************************************************************/
 
 /*++
+ * @name ExInitializePushLock
+ * INTERNAL MACRO
+ *
+ *     The ExInitializePushLock macro initializes a PushLock.
+ *
+ * @params PushLock
+ *         Pointer to the pushlock which is to be initialized.
+ *
+ * @return None.
+ *
+ * @remarks None.
+ *
+ *--*/
+VOID
+FORCEINLINE
+ExInitializePushLock(IN PEX_PUSH_LOCK PushLock)
+{
+    /* Set the value to 0 */
+    PushLock->Value = 0;
+}
+
+/*++
  * @name ExAcquirePushLockExclusive
  * INTERNAL MACRO
  *
@@ -545,7 +577,7 @@
 
     /* Try acquiring the lock */
     NewValue.Value = EX_PUSH_LOCK_LOCK | EX_PUSH_LOCK_SHARE_INC;
-    if (InterlockedCompareExchangePointer(PushLock, NewValue.Ptr, 0))
+    if (ExpChangePushlock(PushLock, NewValue.Ptr, 0))
     {
         /* Someone changed it, use the slow path */
         DbgPrint("%s - Contention!\n", __FUNCTION__);
@@ -558,6 +590,44 @@
 }
 
 /*++
+ * @name ExConvertPushLockSharedToExclusive
+ * INTERNAL MACRO
+ *
+ *     The ExConvertPushLockSharedToExclusive macro converts an exclusive
+ *     pushlock to a shared pushlock.
+ *
+ * @params PushLock
+ *         Pointer to the pushlock which is to be converted.
+ *
+ * @return FALSE if conversion failed, TRUE otherwise.
+ *
+ * @remarks The function attempts the quickest route to convert the lock, which is
+ *          to simply set the lock bit and remove any other bits.
+ *
+ *--*/
+BOOLEAN
+FORCEINLINE
+ExConvertPushLockSharedToExclusive(IN PEX_PUSH_LOCK PushLock)
+{
+    EX_PUSH_LOCK OldValue;
+
+    /* Set the expected old value */
+    OldValue.Value = EX_PUSH_LOCK_LOCK | EX_PUSH_LOCK_SHARE_INC;
+
+    /* Try converting the lock */
+    if (ExpChangePushlock(PushLock, EX_PUSH_LOCK_LOCK, OldValue.Value) !=
+        OldValue.Ptr)
+    {
+        /* Conversion failed */
+        return FALSE;
+    }
+
+    /* Sanity check */
+    ASSERT(PushLock->Locked);
+    return TRUE;
+}
+
+/*++
  * @name ExWaitOnPushLock
  * INTERNAL MACRO
  *
@@ -617,8 +687,7 @@
 
     /* Try to clear the pushlock */
     OldValue.Value = EX_PUSH_LOCK_LOCK | EX_PUSH_LOCK_SHARE_INC;
-    if (InterlockedCompareExchangePointer(PushLock, 0, OldValue.Ptr) !=
-        OldValue.Ptr)
+    if (ExpChangePushlock(PushLock, 0, OldValue.Ptr) != OldValue.Ptr)
     {
         /* There are still other people waiting on it */
         DbgPrint("%s - Contention!\n", __FUNCTION__);
@@ -716,7 +785,7 @@
 
     /* Check if nobody is waiting on us and try clearing the lock here */
     if ((OldValue.Waiting) ||
-        (InterlockedCompareExchangePointer(PushLock, NewValue.Ptr, OldValue.Ptr) ==
+        (ExpChangePushlock(PushLock, NewValue.Ptr, OldValue.Ptr) ==
          OldValue.Ptr))
     {
         /* We have waiters, use the long path */




More information about the Ros-diffs mailing list