- Separate UP and MP spinlock functions.
- Optimize UP spinlock functions so they don't call ntoskrnl anymore and
only raise/lower irql.
- Implemented Queued Spinlocks and In-Stack Queued Spinlocks for UP
machines.
* Implemented KeAcquireInStackQueuedSpinLock,
KeReleaseInStackQueuedSpinLock, KeAcquireQueuedSpinLock,
KeReleaseQueuedSpinLock, KeTryToAcquireQueuedSpinLock,
KeTryToAcquireQueuedSpinLockRaiseToSynch,
KeAcquireQueuedSpinLockRaisetoSynch.
Modified: trunk/reactos/hal/halx86/generic/generic.xml
Deleted: trunk/reactos/hal/halx86/generic/spinlock.c
Modified: trunk/reactos/hal/halx86/mp/halmp.xml
Added: trunk/reactos/hal/halx86/mp/spinlock.c
Modified: trunk/reactos/hal/halx86/up/halup.xml
Added: trunk/reactos/hal/halx86/up/spinlock.c
_____
Modified: trunk/reactos/hal/halx86/generic/generic.xml
--- trunk/reactos/hal/halx86/generic/generic.xml 2006-01-05
13:40:05 UTC (rev 20574)
+++ trunk/reactos/hal/halx86/generic/generic.xml 2006-01-05
13:51:06 UTC (rev 20575)
@@ -18,7 +18,6 @@
<file>pci.c</file>
<file>portio.c</file>
<file>reboot.c</file>
- <file>spinlock.c</file>
<file>sysbus.c</file>
<file>sysinfo.c</file>
<file>time.c</file>
_____
Deleted: trunk/reactos/hal/halx86/generic/spinlock.c
--- trunk/reactos/hal/halx86/generic/spinlock.c 2006-01-05 13:40:05 UTC
(rev 20574)
+++ trunk/reactos/hal/halx86/generic/spinlock.c 2006-01-05 13:51:06 UTC
(rev 20575)
@@ -1,133 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS kernel
- * FILE: ntoskrnl/hal/x86/spinlock.c
- * PURPOSE: Implements spinlocks
- * PROGRAMMER: David Welch (welch(a)cwcom.net)
- * Eric Kohl (ekohl(a)rz-online.de)
- * UPDATE HISTORY:
- * 09/06/2000 Created
- */
-
-/*
- * NOTE: On a uniprocessor machine spinlocks are implemented by raising
- * the irq level
- */
-
-/* INCLUDES
****************************************************************/
-
-#include <hal.h>
-#define NDEBUG
-#include <debug.h>
-
-/* Hmm, needed for KDBG := 1. Why? */
-#undef KeGetCurrentIrql
-
-/* FUNCTIONS
***************************************************************/
-
-#undef KeAcquireSpinLock
-VOID STDCALL
-KeAcquireSpinLock (
- PKSPIN_LOCK SpinLock,
- PKIRQL OldIrql
- )
-/*
- * FUNCTION: Acquires a spinlock
- * ARGUMENTS:
- * SpinLock = Spinlock to acquire
- * OldIrql (OUT) = Caller supplied storage for the previous
irql
- */
-{
- *OldIrql = KfAcquireSpinLock(SpinLock);
-}
-
-KIRQL FASTCALL
-KeAcquireSpinLockRaiseToSynch (
- PKSPIN_LOCK SpinLock
- )
-{
- KIRQL OldIrql;
-
- OldIrql = KfRaiseIrql(SYNCH_LEVEL);
- KiAcquireSpinLock(SpinLock);
-
- return OldIrql;
-}
-
-#undef KeReleaseSpinLock
-VOID STDCALL
-KeReleaseSpinLock (
- PKSPIN_LOCK SpinLock,
- KIRQL NewIrql
- )
-/*
- * FUNCTION: Releases a spinlock
- * ARGUMENTS:
- * SpinLock = Spinlock to release
- * NewIrql = Irql level before acquiring the spinlock
- */
-{
- KfReleaseSpinLock(SpinLock, NewIrql);
-}
-
-KIRQL FASTCALL
-KfAcquireSpinLock (
- PKSPIN_LOCK SpinLock
- )
-{
- KIRQL OldIrql;
-
- ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
-
- OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
- KiAcquireSpinLock(SpinLock);
-
- return OldIrql;
-}
-
-VOID FASTCALL
-KfReleaseSpinLock (
- PKSPIN_LOCK SpinLock,
- KIRQL NewIrql
- )
-/*
- * FUNCTION: Releases a spinlock
- * ARGUMENTS:
- * SpinLock = Spinlock to release
- * NewIrql = Irql level before acquiring the spinlock
- */
-{
- ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL || KeGetCurrentIrql() ==
SYNCH_LEVEL);
- KiReleaseSpinLock(SpinLock);
- KfLowerIrql(NewIrql);
-}
-
-
-/*
- * @unimplemented
- */
-VOID
-FASTCALL
-KeAcquireInStackQueuedSpinLock(
- IN PKSPIN_LOCK SpinLock,
- IN PKLOCK_QUEUE_HANDLE LockHandle
- )
-{
- UNIMPLEMENTED;
-}
-
-
-/*
- * @unimplemented
- */
-VOID
-FASTCALL
-KeReleaseInStackQueuedSpinLock(
- IN PKLOCK_QUEUE_HANDLE LockHandle
- )
-{
- UNIMPLEMENTED;
-}
-
-/* EOF */
_____
Modified: trunk/reactos/hal/halx86/mp/halmp.xml
--- trunk/reactos/hal/halx86/mp/halmp.xml 2006-01-05 13:40:05 UTC
(rev 20574)
+++ trunk/reactos/hal/halx86/mp/halmp.xml 2006-01-05 13:51:06 UTC
(rev 20575)
@@ -20,5 +20,6 @@
<file>mpsirql.c</file>
<file>processor_mp.c</file>
<file>resource_mp.c</file>
+ <file>spinlock.c</file>
<file>halmp.rc</file>
</module>
_____
Copied: trunk/reactos/hal/halx86/mp/spinlock.c (from rev 20568,
trunk/reactos/hal/halx86/generic/spinlock.c)
_____
Modified: trunk/reactos/hal/halx86/up/halup.xml
--- trunk/reactos/hal/halx86/up/halup.xml 2006-01-05 13:40:05 UTC
(rev 20574)
+++ trunk/reactos/hal/halx86/up/halup.xml 2006-01-05 13:51:06 UTC
(rev 20575)
@@ -11,5 +11,6 @@
<library>hal_generic_pc</library>
<library>ntoskrnl</library>
<file>halinit_up.c</file>
+ <file>spinlock.c</file>
<file>halup.rc</file>
</module>
_____
Copied: trunk/reactos/hal/halx86/up/spinlock.c (from rev 20568,
trunk/reactos/hal/halx86/generic/spinlock.c)
--- trunk/reactos/hal/halx86/generic/spinlock.c 2006-01-05 04:26:55 UTC
(rev 20568)
+++ trunk/reactos/hal/halx86/up/spinlock.c 2006-01-05 13:51:06 UTC
(rev 20575)
@@ -0,0 +1,166 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * FILE: ntoskrnl/hal/halx86/up/spinlock.c
+ * PURPOSE: Implements spinlocks
+ * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net)
+ */
+
+/* INCLUDES
****************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+#undef KeAcquireSpinLock
+#undef KeReleaseSpinLock
+
+/* FUNCTIONS
***************************************************************/
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+KeAcquireSpinLock(PKSPIN_LOCK SpinLock,
+ PKIRQL OldIrql)
+{
+ /* Call the fastcall function */
+ *OldIrql = KfAcquireSpinLock(SpinLock);
+}
+
+/*
+ * @implemented
+ */
+KIRQL
+FASTCALL
+KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock)
+{
+ /* Simply raise to dispatch */
+ return KfRaiseIrql(DISPATCH_LEVEL);
+}
+
+/*
+ * @implemented
+ */
+VOID
+NTAPI
+KeReleaseSpinLock(PKSPIN_LOCK SpinLock,
+ KIRQL NewIrql)
+{
+ /* Call the fastcall function */
+ KfReleaseSpinLock(SpinLock, NewIrql);
+}
+
+/*
+ * @implemented
+ */
+KIRQL
+FASTCALL
+KfAcquireSpinLock(PKSPIN_LOCK SpinLock)
+{
+ /* Simply raise to dispatch */
+ return KfRaiseIrql(DISPATCH_LEVEL);
+}
+
+/*
+ * @implemented
+ */
+VOID
+FASTCALL
+KfReleaseSpinLock(PKSPIN_LOCK SpinLock,
+ KIRQL OldIrql)
+{
+ /* Simply lower IRQL back */
+ KfLowerIrql(OldIrql);
+}
+
+/*
+ * @implemented
+ */
+KIRQL
+FASTCALL
+KeAcquireQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
+{
+ /* Simply raise to dispatch */
+ return KfRaiseIrql(DISPATCH_LEVEL);
+}
+
+/*
+ * @implemented
+ */
+KIRQL
+FASTCALL
+KeAcquireQueuedSpinLockRaiseToSynch(IN PKLOCK_QUEUE_HANDLE LockHandle)
+{
+ /* Simply raise to dispatch */
+ return KfRaiseIrql(DISPATCH_LEVEL);
+}
+
+/*
+ * @implemented
+ */
+VOID
+FASTCALL
+KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock,
+ IN PKLOCK_QUEUE_HANDLE LockHandle)
+{
+ /* Simply raise to dispatch */
+ LockHandle->OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
+}
+
+/*
+ * @implemented
+ */
+VOID
+FASTCALL
+KeReleaseQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle,
+ IN KIRQL OldIrql)
+{
+ /* Simply lower IRQL back */
+ KfLowerIrql(OldIrql);
+}
+
+/*
+ * @implemented
+ */
+VOID
+FASTCALL
+KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
+{
+ /* Simply lower IRQL back */
+ KfLowerIrql(LockHandle->OldIrql);
+}
+
+/*
+ * @implemented
+ */
+BOOLEAN
+FASTCALL
+KeTryToAcquireQueuedSpinLockRaiseToSynch(IN PKLOCK_QUEUE_HANDLE
LockHandle,
+ IN PKIRQL OldIrql)
+{
+ /* Simply raise to dispatch */
+ *OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
+
+ /* Always return true on UP Machines */
+ return TRUE;
+}
+
+/*
+ * @implemented
+ */
+BOOLEAN
+FASTCALL
+KeTryToAcquireQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle,
+ IN PKIRQL OldIrql)
+{
+ /* Simply raise to dispatch */
+ *OldIrql = KfRaiseIrql(DISPATCH_LEVEL);
+
+ /* Always return true on UP Machines */
+ return TRUE;
+}
+
+
+/* EOF */
Show replies by date