[FREELDR] Allow Freeloader to boot Vista revamp of PR #1905 (#6479)
[reactos.git] / ntoskrnl / ke / amd64 / spinlock.c
index ae19862..bf38395 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * PROJECT:         ReactOS HAL
  * LICENSE:         GPL - See COPYING in the top level directory
- * FILE:            hal/halx86/up/spinlock.c
+ * FILE:            ntoskrnl/ke/amd64/spinlock.c
  * PURPOSE:         Spinlock and Queued Spinlock Support
  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
  */
@@ -167,19 +167,19 @@ BOOLEAN
 KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
                                          IN PKIRQL OldIrql)
 {
-#ifndef CONFIG_SMP
-    /* Simply raise to dispatch */
-    KeRaiseIrql(DISPATCH_LEVEL, OldIrql);
+    /* Raise to synch level */
+    KeRaiseIrql(SYNCH_LEVEL, OldIrql);
 
+#ifdef CONFIG_SMP
+    // HACK
+    return KeTryToAcquireSpinLockAtDpcLevel(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock);
+#else
     /* Add an explicit memory barrier to prevent the compiler from reordering
        memory accesses across the borders of spinlocks */
     KeMemoryBarrierWithoutFence();
 
     /* Always return true on UP Machines */
     return TRUE;
-#else
-    UNIMPLEMENTED;
-    ASSERT(FALSE);
 #endif
 }
 
@@ -190,19 +190,20 @@ LOGICAL
 KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber,
                              OUT PKIRQL OldIrql)
 {
-#ifndef CONFIG_SMP
-    /* Simply raise to dispatch */
+    /* Raise to dispatch level */
     KeRaiseIrql(DISPATCH_LEVEL, OldIrql);
 
+#ifdef CONFIG_SMP
+    // HACK
+    return KeTryToAcquireSpinLockAtDpcLevel(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock);
+#else
+
     /* Add an explicit memory barrier to prevent the compiler from reordering
        memory accesses across the borders of spinlocks */
     KeMemoryBarrierWithoutFence();
 
     /* Always return true on UP Machines */
     return TRUE;
-#else
-    UNIMPLEMENTED;
-    ASSERT(FALSE);
 #endif
 }