https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2ed56fa79449ada4b1ccb8a2fcfa8c088928ed9f

commit 2ed56fa79449ada4b1ccb8a2fcfa8c088928ed9f
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Wed Jun 9 22:15:12 2021 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sat Jun 19 12:17:18 2021 +0200

    [NTOS] Fix build with CONFIG_SMP
---
 ntoskrnl/ex/lookas.c         |  2 +-
 ntoskrnl/ke/amd64/spinlock.c | 23 ++++++++++++-----------
 ntoskrnl/ke/ipi.c            |  2 +-
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/ntoskrnl/ex/lookas.c b/ntoskrnl/ex/lookas.c
index 89cdc49e554..9b1d456f563 100644
--- a/ntoskrnl/ex/lookas.c
+++ b/ntoskrnl/ex/lookas.c
@@ -63,7 +63,7 @@ ExInitPoolLookasidePointers(VOID)
     PGENERAL_LOOKASIDE Entry;
 
     /* Loop for all pool lists */
-    for (i = 0; i < MAXIMUM_PROCESSORS; i++)
+    for (i = 0; i < NUMBER_POOL_LOOKASIDE_LISTS; i++)
     {
         /* Initialize the non-paged list */
         Entry = &ExpSmallNPagedPoolLookasideLists[i];
diff --git a/ntoskrnl/ke/amd64/spinlock.c b/ntoskrnl/ke/amd64/spinlock.c
index 47a01b9e609..bf383958921 100644
--- a/ntoskrnl/ke/amd64/spinlock.c
+++ b/ntoskrnl/ke/amd64/spinlock.c
@@ -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
 }
 
diff --git a/ntoskrnl/ke/ipi.c b/ntoskrnl/ke/ipi.c
index 76f1b7388f5..841087d1daa 100644
--- a/ntoskrnl/ke/ipi.c
+++ b/ntoskrnl/ke/ipi.c
@@ -167,7 +167,7 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
 
     if (InterlockedBitTestAndReset((PLONG)&Prcb->IpiFrozen, IPI_SYNCH_REQUEST))
     {
-#ifdef _M_ARM
+#if defined(_M_ARM) || defined(_M_AMD64)
         DbgBreakPoint();
 #else
         (void)InterlockedDecrementUL(&Prcb->SignalDone->CurrentPacket[1]);

Reply via email to