Author: sir_richard
Date: Mon Jan 25 00:57:09 2010
New Revision: 45239
URL:
http://svn.reactos.org/svn/reactos?rev=45239&view=rev
Log:
[HAL]: Okay, this one was my fault, forgot to built the nasty-ass HALMPS. Move the CMOS
lock routines to the shared CMOS file.
Modified:
trunk/reactos/hal/halx86/generic/cmos.c
trunk/reactos/hal/halx86/generic/spinlock.c
trunk/reactos/hal/halx86/include/halp.h
Modified: trunk/reactos/hal/halx86/generic/cmos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/cmos.c?…
==============================================================================
--- trunk/reactos/hal/halx86/generic/cmos.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/cmos.c [iso-8859-1] Mon Jan 25 00:57:09 2010
@@ -17,8 +17,42 @@
KSPIN_LOCK HalpSystemHardwareLock;
UCHAR HalpCmosCenturyOffset;
-
-/* PRIVATE FUNCTIONS *********************************************************/
+ULONG HalpSystemHardwareFlags;
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+VOID
+NTAPI
+HalpAcquireSystemHardwareSpinLock(VOID)
+{
+ ULONG Flags;
+
+ /* Get flags and disable interrupts */
+ Flags = __readeflags();
+ _disable();
+
+ /* Acquire the lock */
+ KxAcquireSpinLock(&HalpSystemHardwareLock);
+
+ /* We have the lock, save the flags now */
+ HalpSystemHardwareFlags = Flags;
+}
+
+VOID
+NTAPI
+HalpReleaseCmosSpinLock(VOID)
+{
+ ULONG Flags;
+
+ /* Get the flags */
+ Flags = HalpSystemHardwareFlags;
+
+ /* Release the lock */
+ KxReleaseSpinLock(&HalpSystemHardwareLock);
+
+ /* Restore the flags */
+ __writeeflags(Flags);
+}
FORCEINLINE
UCHAR
Modified: trunk/reactos/hal/halx86/generic/spinlock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/spinloc…
==============================================================================
--- trunk/reactos/hal/halx86/generic/spinlock.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/spinlock.c [iso-8859-1] Mon Jan 25 00:57:09 2010
@@ -18,141 +18,6 @@
#undef KeAcquireSpinLock
#undef KeReleaseSpinLock
-//
-// This is duplicated from ke_x.h
-//
-#ifdef CONFIG_SMP
-//
-// Spinlock Acquisition at IRQL >= DISPATCH_LEVEL
-//
-FORCEINLINE
-VOID
-KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
-{
- /* Make sure that we don't own the lock already */
- if (((KSPIN_LOCK)KeGetCurrentThread() | 1) == *SpinLock)
- {
- /* We do, bugcheck! */
- KeBugCheckEx(SPIN_LOCK_ALREADY_OWNED, (ULONG_PTR)SpinLock, 0, 0, 0);
- }
-
- for (;;)
- {
- /* Try to acquire it */
- if (InterlockedBitTestAndSet((PLONG)SpinLock, 0))
- {
- /* Value changed... wait until it's locked */
- while (*(volatile KSPIN_LOCK *)SpinLock == 1)
- {
-#ifdef DBG
- /* On debug builds, we use a much slower but useful routine */
- //Kii386SpinOnSpinLock(SpinLock, 5);
-
- /* FIXME: Do normal yield for now */
- YieldProcessor();
-#else
- /* Otherwise, just yield and keep looping */
- YieldProcessor();
-#endif
- }
- }
- else
- {
-#ifdef DBG
- /* On debug builds, we OR in the KTHREAD */
- *SpinLock = (KSPIN_LOCK)KeGetCurrentThread() | 1;
-#endif
- /* All is well, break out */
- break;
- }
- }
-}
-
-//
-// Spinlock Release at IRQL >= DISPATCH_LEVEL
-//
-FORCEINLINE
-VOID
-KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
-{
-#ifdef DBG
- /* Make sure that the threads match */
- if (((KSPIN_LOCK)KeGetCurrentThread() | 1) != *SpinLock)
- {
- /* They don't, bugcheck */
- KeBugCheckEx(SPIN_LOCK_NOT_OWNED, (ULONG_PTR)SpinLock, 0, 0, 0);
- }
-#endif
- /* Clear the lock */
- InterlockedAnd((PLONG)SpinLock, 0);
-}
-
-#else
-
-//
-// Spinlock Acquire at IRQL >= DISPATCH_LEVEL
-//
-FORCEINLINE
-VOID
-KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
-{
- /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
- UNREFERENCED_PARAMETER(SpinLock);
-}
-
-//
-// Spinlock Release at IRQL >= DISPATCH_LEVEL
-//
-FORCEINLINE
-VOID
-KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
-{
- /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
- UNREFERENCED_PARAMETER(SpinLock);
-}
-
-#endif
-
-/* GLOBALS ********************************************************************/
-
-ULONG HalpSystemHardwareFlags;
-KSPIN_LOCK HalpSystemHardwareLock;
-
-/* PRIVATE FUNCTIONS **********************************************************/
-
-VOID
-NTAPI
-HalpAcquireSystemHardwareSpinLock(VOID)
-{
- ULONG Flags;
-
- /* Get flags and disable interrupts */
- Flags = __readeflags();
- _disable();
-
- /* Acquire the lock */
- KxAcquireSpinLock(&HalpSystemHardwareLock);
-
- /* We have the lock, save the flags now */
- HalpSystemHardwareFlags = Flags;
-}
-
-VOID
-NTAPI
-HalpReleaseCmosSpinLock(VOID)
-{
- ULONG Flags;
-
- /* Get the flags */
- Flags = HalpSystemHardwareFlags;
-
- /* Release the lock */
- KxReleaseSpinLock(&HalpSystemHardwareLock);
-
- /* Restore the flags */
- __writeeflags(Flags);
-}
-
/* FUNCTIONS *****************************************************************/
/*
Modified: trunk/reactos/hal/halx86/include/halp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halp.h?…
==============================================================================
--- trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/halp.h [iso-8859-1] Mon Jan 25 00:57:09 2010
@@ -606,6 +606,101 @@
VOID
);
+//
+// This is duplicated from ke_x.h
+//
+#ifdef CONFIG_SMP
+//
+// Spinlock Acquisition at IRQL >= DISPATCH_LEVEL
+//
+FORCEINLINE
+VOID
+KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
+{
+ /* Make sure that we don't own the lock already */
+ if (((KSPIN_LOCK)KeGetCurrentThread() | 1) == *SpinLock)
+ {
+ /* We do, bugcheck! */
+ KeBugCheckEx(SPIN_LOCK_ALREADY_OWNED, (ULONG_PTR)SpinLock, 0, 0, 0);
+ }
+
+ for (;;)
+ {
+ /* Try to acquire it */
+ if (InterlockedBitTestAndSet((PLONG)SpinLock, 0))
+ {
+ /* Value changed... wait until it's locked */
+ while (*(volatile KSPIN_LOCK *)SpinLock == 1)
+ {
+#ifdef DBG
+ /* On debug builds, we use a much slower but useful routine */
+ //Kii386SpinOnSpinLock(SpinLock, 5);
+
+ /* FIXME: Do normal yield for now */
+ YieldProcessor();
+#else
+ /* Otherwise, just yield and keep looping */
+ YieldProcessor();
+#endif
+ }
+ }
+ else
+ {
+#ifdef DBG
+ /* On debug builds, we OR in the KTHREAD */
+ *SpinLock = (KSPIN_LOCK)KeGetCurrentThread() | 1;
+#endif
+ /* All is well, break out */
+ break;
+ }
+ }
+}
+
+//
+// Spinlock Release at IRQL >= DISPATCH_LEVEL
+//
+FORCEINLINE
+VOID
+KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
+{
+#ifdef DBG
+ /* Make sure that the threads match */
+ if (((KSPIN_LOCK)KeGetCurrentThread() | 1) != *SpinLock)
+ {
+ /* They don't, bugcheck */
+ KeBugCheckEx(SPIN_LOCK_NOT_OWNED, (ULONG_PTR)SpinLock, 0, 0, 0);
+ }
+#endif
+ /* Clear the lock */
+ InterlockedAnd((PLONG)SpinLock, 0);
+}
+
+#else
+
+//
+// Spinlock Acquire at IRQL >= DISPATCH_LEVEL
+//
+FORCEINLINE
+VOID
+KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
+{
+ /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
+ UNREFERENCED_PARAMETER(SpinLock);
+}
+
+//
+// Spinlock Release at IRQL >= DISPATCH_LEVEL
+//
+FORCEINLINE
+VOID
+KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
+{
+ /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
+ UNREFERENCED_PARAMETER(SpinLock);
+}
+
+#endif
+
#ifdef _M_AMD64
#define KfLowerIrql KeLowerIrql
#ifndef CONFIG_SMP