Author: hpoussin Date: Tue Nov 6 17:34:32 2007 New Revision: 30223
URL: http://svn.reactos.org/svn/reactos?rev=30223&view=rev Log: Fix some compilation errors in ntkrnlmp (code has not been tested, so it is probably wrong)
Modified: trunk/reactos/ntoskrnl/ke/ipi.c trunk/reactos/ntoskrnl/ke/spinlock.c trunk/reactos/ntoskrnl/ke/thrdobj.c trunk/reactos/ntoskrnl/mm/i386/page.c
Modified: trunk/reactos/ntoskrnl/ke/ipi.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/ipi.c?rev=30223... ============================================================================== --- trunk/reactos/ntoskrnl/ke/ipi.c (original) +++ trunk/reactos/ntoskrnl/ke/ipi.c Tue Nov 6 17:34:32 2007 @@ -24,17 +24,18 @@ IN ULONG IpiRequest) { #ifdef CONFIG_SMP -#error VerifyMe! LONG i; - PKPCR Pcr; + PKPRCB Prcb; KAFFINITY Current;
for (i = 0, Current = 1; i < KeNumberProcessors; i++, Current <<= 1) { if (TargetSet & Current) { - Pcr = (PKPCR)(KPCR_BASE + i * PAGE_SIZE); - Ke386TestAndSetBit(IpiRequest, (PULONG)&Pcr->Prcb->IpiFrozen); + /* Get the PRCB for this CPU */ + Prcb = ((PKPCR)(KIP0PCRADDRESS + i * PAGE_SIZE))->Prcb; + + InterlockedBitTestAndSet((PLONG)&Prcb->IpiFrozen, IpiRequest); HalRequestIpi(i); } } @@ -50,12 +51,10 @@ IN BOOLEAN Synchronize) { #ifdef CONFIG_SMP -#error VerifyMe! KAFFINITY Processor; LONG i; PKPRCB Prcb, CurrentPrcb; KIRQL oldIrql; -
ASSERT(KeGetCurrentIrql() == SYNCH_LEVEL);
@@ -70,9 +69,9 @@ { if (TargetSet & Processor) { - Prcb = ((PKPCR)(KPCR_BASE + i * PAGE_SIZE))->Prcb; - while(0 != InterlockedCompareExchangeUL(&Prcb->SignalDone, (LONG)CurrentPrcb, 0)); - Ke386TestAndSetBit(IPI_SYNCH_REQUEST, (PULONG)&Prcb->IpiFrozen); + Prcb = ((PKPCR)(KIP0PCRADDRESS + i * PAGE_SIZE))->Prcb; + while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone, (LONG)CurrentPrcb, 0)); + InterlockedBitTestAndSet((PLONG)&Prcb->IpiFrozen, IPI_SYNCH_REQUEST); if (Processor != CurrentPrcb->SetMember) { HalRequestIpi(i); @@ -99,32 +98,31 @@ IN PVOID ExceptionFrame) { #ifdef CONFIG_SMP -#error VerifyMe! PKPRCB Prcb; ASSERT(KeGetCurrentIrql() == IPI_LEVEL);
Prcb = KeGetCurrentPrcb();
- if (Ke386TestAndClearBit(IPI_APC, (PULONG)&Prcb->IpiFrozen)) + if (InterlockedBitTestAndReset((PLONG)&Prcb->IpiFrozen, IPI_APC)) { HalRequestSoftwareInterrupt(APC_LEVEL); }
- if (Ke386TestAndClearBit(IPI_DPC, (PULONG)&Prcb->IpiFrozen)) + if (InterlockedBitTestAndReset((PLONG)&Prcb->IpiFrozen, IPI_DPC)) { Prcb->DpcInterruptRequested = TRUE; HalRequestSoftwareInterrupt(DISPATCH_LEVEL); }
- if (Ke386TestAndClearBit(IPI_SYNCH_REQUEST, (PULONG)&Prcb->IpiFrozen)) + if (InterlockedBitTestAndReset((PLONG)&Prcb->IpiFrozen, IPI_SYNCH_REQUEST)) { (void)InterlockedDecrementUL(&Prcb->SignalDone->CurrentPacket[1]); if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0)) { while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[1], 0, 0)); } - ((VOID (STDCALL*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]); - Ke386TestAndClearBit(KeGetCurrentProcessorNumber(), (PULONG)&Prcb->SignalDone->TargetSet); + ((VOID (NTAPI*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]); + InterlockedBitTestAndReset((PLONG)&Prcb->SignalDone->TargetSet, KeGetCurrentProcessorNumber()); if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0)) { while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->TargetSet, 0, 0));
Modified: trunk/reactos/ntoskrnl/ke/spinlock.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/spinlock.c?rev=... ============================================================================== --- trunk/reactos/ntoskrnl/ke/spinlock.c (original) +++ trunk/reactos/ntoskrnl/ke/spinlock.c Tue Nov 6 17:34:32 2007 @@ -26,24 +26,24 @@
/* Set the new lock */ Prev = (PKSPIN_LOCK_QUEUE) - InterlockedExchange((PLONG)LockHandle->LockQueue.Lock, + InterlockedExchange((PLONG)LockHandle->Next, (LONG)LockHandle); if (!Prev) { /* There was nothing there before. We now own it */ - *(ULONG_PTR*)&LockHandle->LockQueue.Lock |= LQ_OWN; + *LockHandle->Lock |= LQ_OWN; return; }
/* Set the wait flag */ - *(ULONG_PTR*)&LockHandle->LockQueue.Lock |= LQ_WAIT; + *LockHandle->Lock |= LQ_WAIT;
/* Link us */ Prev->Next = (PKSPIN_LOCK_QUEUE)LockHandle;
/* Loop and wait */ - while ( *(ULONG_PTR*)&LockHandle->LockQueue.Lock & LQ_WAIT) YieldProcessor(); - return; + while (*LockHandle->Lock & LQ_WAIT) + YieldProcessor(); #endif }
@@ -56,31 +56,31 @@ PKSPIN_LOCK_QUEUE Waiter;
/* Remove own and wait flags */ - *(ULONG_PTR*)&LockHandle->LockQueue.Lock &= ~(LQ_OWN | LQ_WAIT); - LockVal = *LockHandle->LockQueue.Lock; + *LockHandle->Lock &= ~(LQ_OWN | LQ_WAIT); + LockVal = *LockHandle->Lock;
/* Check if we already own it */ if (LockVal == (KSPIN_LOCK)LockHandle) { /* Disown it */ LockVal = (KSPIN_LOCK) - InterlockedCompareExchangePointer(LockHandle->LockQueue.Lock, + InterlockedCompareExchangePointer(LockHandle->Lock, NULL, LockHandle); } if (LockVal == (KSPIN_LOCK)LockHandle) return;
/* Need to wait for it */ - Waiter = LockHandle->LockQueue.Next; + Waiter = LockHandle->Next; while (!Waiter) { YieldProcessor(); - Waiter = LockHandle->LockQueue.Next; + Waiter = LockHandle->Next; }
/* It's gone */ *(ULONG_PTR*)&Waiter->Lock ^= (LQ_OWN | LQ_WAIT); - LockHandle->LockQueue.Next = NULL; + LockHandle->Next = NULL; #endif }
@@ -211,8 +211,7 @@ /* Set it up properly */ LockHandle->LockQueue.Next = NULL; LockHandle->LockQueue.Lock = SpinLock; - KeAcquireQueuedSpinLockAtDpcLevel((PKLOCK_QUEUE_HANDLE) - &LockHandle->LockQueue.Next); + KeAcquireQueuedSpinLockAtDpcLevel(LockHandle->LockQueue.Next); #endif }
@@ -225,8 +224,7 @@ { #ifdef CONFIG_SMP /* Call the internal function */ - KeReleaseQueuedSpinLockFromDpcLevel((PKLOCK_QUEUE_HANDLE) - &LockHandle->LockQueue.Next); + KeReleaseQueuedSpinLockFromDpcLevel(LockHandle->LockQueue.Next); #endif }
Modified: trunk/reactos/ntoskrnl/ke/thrdobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdobj.c?rev=3... ============================================================================== --- trunk/reactos/ntoskrnl/ke/thrdobj.c (original) +++ trunk/reactos/ntoskrnl/ke/thrdobj.c Tue Nov 6 17:34:32 2007 @@ -480,7 +480,7 @@ #ifdef CONFIG_SMP /* Get the KNODE and its PRCB */ Node = KeNodeBlock[Process->IdealNode]; - NodePrcb = (PKPRCB)(KPCR_BASE + (Process->ThreadSeed * PAGE_SIZE)); + NodePrcb = ((PKPCR)(KIP0PCRADDRESS + Process->ThreadSeed * PAGE_SIZE))->Prcb;
/* Calculate affinity mask */ Set = ~NodePrcb->MultiThreadProcessorSet;
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/i386/page.c?rev... ============================================================================== --- trunk/reactos/ntoskrnl/mm/i386/page.c (original) +++ trunk/reactos/ntoskrnl/mm/i386/page.c Tue Nov 6 17:34:32 2007 @@ -75,22 +75,23 @@
BOOLEAN MmUnmapPageTable(PULONG Pt);
-VOID -STDCALL -MiFlushTlbIpiRoutine(PVOID Address) -{ - if (Address == (PVOID)0xffffffff) +ULONG_PTR +NTAPI +MiFlushTlbIpiRoutine(ULONG_PTR Address) +{ + if (Address == (ULONG_PTR)-1) { KeFlushCurrentTb(); } - else if (Address == (PVOID)0xfffffffe) + else if (Address == (ULONG_PTR)-2) { KeFlushCurrentTb(); } else { - __invlpg(Address); - } + __invlpg((PVOID)Address); + } + return 0; }
VOID @@ -101,13 +102,13 @@ { MmUnmapPageTable(Pt); } - if (KeNumberProcessors>1) - { - KeIpiGenericCall(MiFlushTlbIpiRoutine, Address); - } - else - { - MiFlushTlbIpiRoutine(Address); + if (KeNumberProcessors > 1) + { + KeIpiGenericCall(MiFlushTlbIpiRoutine, (ULONG_PTR)Address); + } + else + { + MiFlushTlbIpiRoutine((ULONG_PTR)Address); } #else if ((Pt && MmUnmapPageTable(Pt)) || Address >= MmSystemRangeStart)