[ros-diffs] [tkreuzer] 44894: [HAL] - Use spinlock.h from ntoskrnl, instead of duplicating the definitions - Use one spinlock.c, but compiled for 2 static libs (hal_generic_up and hal_generic_mp) - Move HalpAcquireSystemHardwareSpinLock and HalpReleaseCmosSpinLock to spinlock.c and use the inline functions for the kernel to make Arch happy.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sat Jan 2 21:03:49 CET 2010


Author: tkreuzer
Date: Sat Jan  2 21:03:49 2010
New Revision: 44894

URL: http://svn.reactos.org/svn/reactos?rev=44894&view=rev
Log:
[HAL]
- Use spinlock.h from ntoskrnl, instead of duplicating the definitions
- Use one spinlock.c, but compiled for 2 static libs (hal_generic_up and hal_generic_mp)
- Move HalpAcquireSystemHardwareSpinLock and HalpReleaseCmosSpinLock to spinlock.c and use the inline functions for the kernel to make Arch happy.

Added:
    branches/ros-amd64-bringup/reactos/hal/halx86/generic/spinlock.c
      - copied, changed from r44834, branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c
    branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_mp.rbuild   (with props)
Removed:
    branches/ros-amd64-bringup/reactos/hal/halx86/mp/i386/spinlock.c
    branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c
Modified:
    branches/ros-amd64-bringup/reactos/hal/halx86/directory.rbuild
    branches/ros-amd64-bringup/reactos/hal/halx86/generic/cmos.c
    branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_up.rbuild
    branches/ros-amd64-bringup/reactos/hal/halx86/halmps.rbuild

Modified: branches/ros-amd64-bringup/reactos/hal/halx86/directory.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/hal/halx86/directory.rbuild?rev=44894&r1=44893&r2=44894&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/directory.rbuild [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/hal/halx86/directory.rbuild [iso-8859-1] Sat Jan  2 21:03:49 2010
@@ -4,6 +4,7 @@
 
 	<xi:include href="hal_generic.rbuild" />
 	<xi:include href="hal_generic_up.rbuild" />
+	<xi:include href="hal_generic_mp.rbuild" />
 
 	<if property="ARCH" value="i386">
 		<xi:include href="hal.rbuild" />

Modified: branches/ros-amd64-bringup/reactos/hal/halx86/generic/cmos.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/hal/halx86/generic/cmos.c?rev=44894&r1=44893&r2=44894&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/generic/cmos.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/hal/halx86/generic/cmos.c [iso-8859-1] Sat Jan  2 21:03:49 2010
@@ -16,53 +16,9 @@
 
 /* GLOBALS *******************************************************************/
 
-KSPIN_LOCK HalpSystemHardwareLock;
 UCHAR HalpCmosCenturyOffset;
-ULONG HalpSystemHardwareFlags;
 
 /* PRIVATE FUNCTIONS *********************************************************/
-
-VOID
-NTAPI
-HalpAcquireSystemHardwareSpinLock(VOID)
-{
-    ULONG Flags;
-
-    /* Get flags and disable interrupts */
-    Flags = __readeflags();
-    _disable();
-
-    /* Try to acquire the lock */
-    while (InterlockedBitTestAndSet((PLONG)&HalpSystemHardwareLock, 0))
-    {
-        /* Lock is held, spin until it's free */
-        while (*(volatile ULONG*)HalpSystemHardwareLock & 1)
-            YieldProcessor();
-    }
-
-    /* We have the lock, save the flags now */
-    HalpSystemHardwareFlags = Flags;
-}
-
-VOID
-NTAPI
-HalpReleaseCmosSpinLock(VOID)
-{
-    ULONG Flags;
-
-    /* Get the flags */
-    Flags = HalpSystemHardwareFlags;
-
-    /* Release lock and check if we owned it */
-    if (!InterlockedBitTestAndReset((PLONG)&HalpSystemHardwareLock, 0))
-    {
-        /* The spin lock was not owned! */
-        KeBugCheckEx(SPIN_LOCK_NOT_OWNED, 0, 0, 0, 0);
-    }
-
-    /* Restore the flags */
-    __writeeflags(Flags);
-}
 
 FORCEINLINE
 UCHAR

Copied: branches/ros-amd64-bringup/reactos/hal/halx86/generic/spinlock.c (from r44834, branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c)
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/hal/halx86/generic/spinlock.c?p2=branches/ros-amd64-bringup/reactos/hal/halx86/generic/spinlock.c&p1=branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c&r1=44834&r2=44894&rev=44894&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/hal/halx86/generic/spinlock.c [iso-8859-1] Sat Jan  2 21:03:49 2010
@@ -4,6 +4,7 @@
  * FILE:            hal/halx86/up/spinlock.c
  * PURPOSE:         Spinlock and Queued Spinlock Support
  * PROGRAMMERS:     Alex Ionescu (alex.ionescu at reactos.org)
+ *                  Timo Kreuzer (timo.kreuzer at reactos.org)
  */
 
 /* INCLUDES ******************************************************************/
@@ -15,105 +16,19 @@
 #define NDEBUG
 #include <debug.h>
 
+#include <internal/spinlock.h>
+
 #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;
 
 /* FUNCTIONS *****************************************************************/
+
+#ifdef _M_IX86
 
 /*
  * @implemented
@@ -347,3 +262,39 @@
     /* Call the fastcall function */
     KfLowerIrql(NewIrql);
 }
+
+#endif
+
+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);
+}
+

Added: branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_mp.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_mp.rbuild?rev=44894&view=auto
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_mp.rbuild (added)
+++ branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_mp.rbuild [iso-8859-1] Sat Jan  2 21:03:49 2010
@@ -1,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
+<group>
+	<module name="hal_generic_mp" type="objectlibrary">
+		<include>include</include>
+		<include base="ntoskrnl">include</include>
+		<define name="_NTHAL_" />
+		<define name="CONFIG_SMP" />
+		<directory name="generic">
+			<file>spinlock.c</file>
+		</directory>
+		<directory name="mp">
+			<if property="ARCH" value="i386">
+				<file>irq.S</file>
+			</if>
+		</directory>
+	</module>
+</group>

Propchange: branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_mp.rbuild
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_up.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_up.rbuild?rev=44894&r1=44893&r2=44894&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_up.rbuild [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/hal/halx86/hal_generic_up.rbuild [iso-8859-1] Sat Jan  2 21:03:49 2010
@@ -5,11 +5,13 @@
 		<include>include</include>
 		<include base="ntoskrnl">include</include>
 		<define name="_NTHAL_" />
+		<directory name="generic">
+			<file>spinlock.c</file>
+		</directory>
 		<directory name="up">
 			<file>processor.c</file>
 			<if property="ARCH" value="i386">
 				<file>irq.S</file>
-				<file>spinlock.c</file>
 			</if>
 		</directory>
 	</module>

Modified: branches/ros-amd64-bringup/reactos/hal/halx86/halmps.rbuild
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/hal/halx86/halmps.rbuild?rev=44894&r1=44893&r2=44894&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/halmps.rbuild [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/hal/halx86/halmps.rbuild [iso-8859-1] Sat Jan  2 21:03:49 2010
@@ -9,6 +9,7 @@
 		<define name="CONFIG_SMP" />
 		<define name="_NTHAL_" />
 		<library>hal_generic</library>
+		<library>hal_generic_mp</library>
 		<library>ntoskrnl</library>
 		<directory name="mp">
 			<file>apic.c</file>
@@ -22,7 +23,6 @@
 			<directory name="i386">
 				<file>mps.S</file>
 				<file>mpsboot.asm</file>
-				<file>spinlock.c</file>
 			</directory>
 		</directory>
 	</module>

Removed: branches/ros-amd64-bringup/reactos/hal/halx86/mp/i386/spinlock.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/hal/halx86/mp/i386/spinlock.c?rev=44893&view=auto
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/mp/i386/spinlock.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/hal/halx86/mp/i386/spinlock.c (removed)
@@ -1,201 +1,0 @@
-/*
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS kernel
- * FILE:            ntoskrnl/hal/x86/spinlock.c
- * PURPOSE:         Implements spinlocks
- * PROGRAMMER:      David Welch (welch at cwcom.net)
- *                  Eric Kohl (ekohl at 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 NTAPI
-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(CLOCK2_LEVEL);
-  KiAcquireSpinLock(SpinLock);
-
-  return OldIrql;
-}
-
-#undef KeReleaseSpinLock
-VOID NTAPI
-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);
-}
-
-LOGICAL
-FASTCALL
-KeTryToAcquireQueuedSpinLock(
-  KSPIN_LOCK_QUEUE_NUMBER LockNumber,
-  PKIRQL OldIrql)
-{
-  UNIMPLEMENTED;
-
-  return FALSE;
-}
-
-
-BOOLEAN
-FASTCALL
-KeTryToAcquireQueuedSpinLockRaiseToSynch(
-  KSPIN_LOCK_QUEUE_NUMBER LockNumber,
-  PKIRQL OldIrql)
-{
-  UNIMPLEMENTED;
-
-  return FALSE;
-}
-
-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
-KeAcquireInStackQueuedSpinLockRaiseToSynch(
-    IN PKSPIN_LOCK SpinLock,
-    IN PKLOCK_QUEUE_HANDLE LockHandle
-    )
-{
-   UNIMPLEMENTED;
-}
-
-
-/*
- * @unimplemented
- */
-VOID
-FASTCALL
-KeReleaseInStackQueuedSpinLock(
-    IN PKLOCK_QUEUE_HANDLE LockHandle
-    )
-{
-   UNIMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-KIRQL
-FASTCALL
-KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER Number)
-{
-   UNIMPLEMENTED;
-   return 0;
-}
-
-/*
- * @unimplemented
- */
-KIRQL
-FASTCALL
-KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
-{
-    UNIMPLEMENTED;
-    return 0;
-}
-
-/*
- * @unimplemented
- */
-VOID
-FASTCALL
-KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER Number,
-                        IN KIRQL OldIrql)
-{
-   UNIMPLEMENTED;
-}
-
-/* EOF */

Removed: branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c?rev=44893&view=auto
==============================================================================
--- branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/hal/halx86/up/spinlock.c (removed)
@@ -1,349 +1,0 @@
-/*
- * PROJECT:         ReactOS HAL
- * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            hal/halx86/up/spinlock.c
- * PURPOSE:         Spinlock and Queued Spinlock Support
- * PROGRAMMERS:     Alex Ionescu (alex.ionescu at reactos.org)
- */
-
-/* INCLUDES ******************************************************************/
-
-/* Enable this (and the define in irq.S) to make UP HAL work for MP Kernel */
-/* #define CONFIG_SMP */
-
-#include <hal.h>
-#define NDEBUG
-#include <debug.h>
-
-#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
-
-/* FUNCTIONS *****************************************************************/
-
-/*
- * @implemented
- */
-VOID
-NTAPI
-KeAcquireSpinLock(PKSPIN_LOCK SpinLock,
-                  PKIRQL OldIrql)
-{
-    /* Call the fastcall function */
-    *OldIrql = KfAcquireSpinLock(SpinLock);
-}
-
-/*
- * @implemented
- */
-KIRQL
-FASTCALL
-KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock)
-{
-    KIRQL OldIrql;
-
-    /* Raise to sync */
-    KeRaiseIrql(SYNCH_LEVEL, &OldIrql);
-
-    /* Acquire the lock and return */
-    KxAcquireSpinLock(SpinLock);
-    return OldIrql;
-}
-
-/*
- * @implemented
- */
-VOID
-NTAPI
-KeReleaseSpinLock(PKSPIN_LOCK SpinLock,
-                  KIRQL NewIrql)
-{
-    /* Call the fastcall function */
-    KfReleaseSpinLock(SpinLock, NewIrql);
-}
-
-/*
- * @implemented
- */
-KIRQL
-FASTCALL
-KfAcquireSpinLock(PKSPIN_LOCK SpinLock)
-{
-    KIRQL OldIrql;
-
-    /* Raise to dispatch and acquire the lock */
-    KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
-    KxAcquireSpinLock(SpinLock);
-    return OldIrql;
-}
-
-/*
- * @implemented
- */
-VOID
-FASTCALL
-KfReleaseSpinLock(PKSPIN_LOCK SpinLock,
-                  KIRQL OldIrql)
-{
-    /* Release the lock and lower IRQL back */
-    KxReleaseSpinLock(SpinLock);
-    KeLowerIrql(OldIrql);
-}
-
-/*
- * @implemented
- */
-KIRQL
-FASTCALL
-KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
-{
-    KIRQL OldIrql;
-
-    /* Raise to dispatch */
-    KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
-
-    /* Acquire the lock */
-    KxAcquireSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK
-    return OldIrql;
-}
-
-/*
- * @implemented
- */
-KIRQL
-FASTCALL
-KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
-{
-    KIRQL OldIrql;
-
-    /* Raise to synch */
-    KeRaiseIrql(SYNCH_LEVEL, &OldIrql);
-
-    /* Acquire the lock */
-    KxAcquireSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK
-    return OldIrql;
-}
-
-/*
- * @implemented
- */
-VOID
-FASTCALL
-KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock,
-                               IN PKLOCK_QUEUE_HANDLE LockHandle)
-{
-    /* Set up the lock */
-    LockHandle->LockQueue.Next = NULL;
-    LockHandle->LockQueue.Lock = SpinLock;
-
-    /* Raise to dispatch */
-    KeRaiseIrql(DISPATCH_LEVEL, &LockHandle->OldIrql);
-
-    /* Acquire the lock */
-    KxAcquireSpinLock(LockHandle->LockQueue.Lock); // HACK
-}
-
-/*
- * @implemented
- */
-VOID
-FASTCALL
-KeAcquireInStackQueuedSpinLockRaiseToSynch(IN PKSPIN_LOCK SpinLock,
-                                           IN PKLOCK_QUEUE_HANDLE LockHandle)
-{
-    /* Set up the lock */
-    LockHandle->LockQueue.Next = NULL;
-    LockHandle->LockQueue.Lock = SpinLock;
-
-    /* Raise to synch */
-    KeRaiseIrql(SYNCH_LEVEL, &LockHandle->OldIrql);
-
-    /* Acquire the lock */
-    KxAcquireSpinLock(LockHandle->LockQueue.Lock); // HACK
-}
-
-/*
- * @implemented
- */
-VOID
-FASTCALL
-KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
-                        IN KIRQL OldIrql)
-{
-    /* Release the lock */
-    KxReleaseSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK
-
-    /* Lower IRQL back */
-    KeLowerIrql(OldIrql);
-}
-
-/*
- * @implemented
- */
-VOID
-FASTCALL
-KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
-{
-    /* Simply lower IRQL back */
-    KxReleaseSpinLock(LockHandle->LockQueue.Lock); // HACK
-    KeLowerIrql(LockHandle->OldIrql);
-}
-
-/*
- * @implemented
- */
-BOOLEAN
-FASTCALL
-KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
-                                         IN PKIRQL OldIrql)
-{
-#ifdef CONFIG_SMP
-    ASSERT(FALSE); // FIXME: Unused
-    while (TRUE);
-#endif
-
-    /* Simply raise to synch */
-    KeRaiseIrql(SYNCH_LEVEL, OldIrql);
-
-    /* Always return true on UP Machines */
-    return TRUE;
-}
-
-/*
- * @implemented
- */
-LOGICAL
-FASTCALL
-KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
-                             OUT PKIRQL OldIrql)
-{
-#ifdef CONFIG_SMP
-    ASSERT(FALSE); // FIXME: Unused
-    while (TRUE);
-#endif
-
-    /* Simply raise to dispatch */
-    KeRaiseIrql(DISPATCH_LEVEL, OldIrql);
-
-    /* Always return true on UP Machines */
-    return TRUE;
-}
-
-#undef KeRaiseIrql
-/*
- * @implemented
- */
-VOID
-NTAPI
-KeRaiseIrql(KIRQL NewIrql,
-            PKIRQL OldIrql)
-{
-    /* Call the fastcall function */
-    *OldIrql = KfRaiseIrql(NewIrql);
-}
-
-#undef KeLowerIrql
-/*
- * @implemented
- */
-VOID
-NTAPI
-KeLowerIrql(KIRQL NewIrql)
-{
-    /* Call the fastcall function */
-    KfLowerIrql(NewIrql);
-}




More information about the Ros-diffs mailing list