mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 18:35:41 +00:00
Fix some compilation errors in ntkrnlmp
(code has not been tested, so it is probably wrong) svn path=/trunk/; revision=30223
This commit is contained in:
parent
169a48594f
commit
082af2ff8a
4 changed files with 37 additions and 40 deletions
|
@ -24,17 +24,18 @@ KiIpiSendRequest(IN KAFFINITY TargetSet,
|
||||||
IN ULONG IpiRequest)
|
IN ULONG IpiRequest)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
#error VerifyMe!
|
|
||||||
LONG i;
|
LONG i;
|
||||||
PKPCR Pcr;
|
PKPRCB Prcb;
|
||||||
KAFFINITY Current;
|
KAFFINITY Current;
|
||||||
|
|
||||||
for (i = 0, Current = 1; i < KeNumberProcessors; i++, Current <<= 1)
|
for (i = 0, Current = 1; i < KeNumberProcessors; i++, Current <<= 1)
|
||||||
{
|
{
|
||||||
if (TargetSet & Current)
|
if (TargetSet & Current)
|
||||||
{
|
{
|
||||||
Pcr = (PKPCR)(KPCR_BASE + i * PAGE_SIZE);
|
/* Get the PRCB for this CPU */
|
||||||
Ke386TestAndSetBit(IpiRequest, (PULONG)&Pcr->Prcb->IpiFrozen);
|
Prcb = ((PKPCR)(KIP0PCRADDRESS + i * PAGE_SIZE))->Prcb;
|
||||||
|
|
||||||
|
InterlockedBitTestAndSet((PLONG)&Prcb->IpiFrozen, IpiRequest);
|
||||||
HalRequestIpi(i);
|
HalRequestIpi(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,13 +51,11 @@ KiIpiSendPacket(IN KAFFINITY TargetSet,
|
||||||
IN BOOLEAN Synchronize)
|
IN BOOLEAN Synchronize)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
#error VerifyMe!
|
|
||||||
KAFFINITY Processor;
|
KAFFINITY Processor;
|
||||||
LONG i;
|
LONG i;
|
||||||
PKPRCB Prcb, CurrentPrcb;
|
PKPRCB Prcb, CurrentPrcb;
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
|
||||||
|
|
||||||
ASSERT(KeGetCurrentIrql() == SYNCH_LEVEL);
|
ASSERT(KeGetCurrentIrql() == SYNCH_LEVEL);
|
||||||
|
|
||||||
CurrentPrcb = KeGetCurrentPrcb();
|
CurrentPrcb = KeGetCurrentPrcb();
|
||||||
|
@ -70,9 +69,9 @@ KiIpiSendPacket(IN KAFFINITY TargetSet,
|
||||||
{
|
{
|
||||||
if (TargetSet & Processor)
|
if (TargetSet & Processor)
|
||||||
{
|
{
|
||||||
Prcb = ((PKPCR)(KPCR_BASE + i * PAGE_SIZE))->Prcb;
|
Prcb = ((PKPCR)(KIP0PCRADDRESS + i * PAGE_SIZE))->Prcb;
|
||||||
while(0 != InterlockedCompareExchangeUL(&Prcb->SignalDone, (LONG)CurrentPrcb, 0));
|
while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone, (LONG)CurrentPrcb, 0));
|
||||||
Ke386TestAndSetBit(IPI_SYNCH_REQUEST, (PULONG)&Prcb->IpiFrozen);
|
InterlockedBitTestAndSet((PLONG)&Prcb->IpiFrozen, IPI_SYNCH_REQUEST);
|
||||||
if (Processor != CurrentPrcb->SetMember)
|
if (Processor != CurrentPrcb->SetMember)
|
||||||
{
|
{
|
||||||
HalRequestIpi(i);
|
HalRequestIpi(i);
|
||||||
|
@ -99,32 +98,31 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
|
||||||
IN PVOID ExceptionFrame)
|
IN PVOID ExceptionFrame)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
#error VerifyMe!
|
|
||||||
PKPRCB Prcb;
|
PKPRCB Prcb;
|
||||||
ASSERT(KeGetCurrentIrql() == IPI_LEVEL);
|
ASSERT(KeGetCurrentIrql() == IPI_LEVEL);
|
||||||
|
|
||||||
Prcb = KeGetCurrentPrcb();
|
Prcb = KeGetCurrentPrcb();
|
||||||
|
|
||||||
if (Ke386TestAndClearBit(IPI_APC, (PULONG)&Prcb->IpiFrozen))
|
if (InterlockedBitTestAndReset((PLONG)&Prcb->IpiFrozen, IPI_APC))
|
||||||
{
|
{
|
||||||
HalRequestSoftwareInterrupt(APC_LEVEL);
|
HalRequestSoftwareInterrupt(APC_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ke386TestAndClearBit(IPI_DPC, (PULONG)&Prcb->IpiFrozen))
|
if (InterlockedBitTestAndReset((PLONG)&Prcb->IpiFrozen, IPI_DPC))
|
||||||
{
|
{
|
||||||
Prcb->DpcInterruptRequested = TRUE;
|
Prcb->DpcInterruptRequested = TRUE;
|
||||||
HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
|
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]);
|
(void)InterlockedDecrementUL(&Prcb->SignalDone->CurrentPacket[1]);
|
||||||
if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
|
if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
|
||||||
{
|
{
|
||||||
while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[1], 0, 0));
|
while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[1], 0, 0));
|
||||||
}
|
}
|
||||||
((VOID (STDCALL*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]);
|
((VOID (NTAPI*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]);
|
||||||
Ke386TestAndClearBit(KeGetCurrentProcessorNumber(), (PULONG)&Prcb->SignalDone->TargetSet);
|
InterlockedBitTestAndReset((PLONG)&Prcb->SignalDone->TargetSet, KeGetCurrentProcessorNumber());
|
||||||
if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
|
if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
|
||||||
{
|
{
|
||||||
while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->TargetSet, 0, 0));
|
while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->TargetSet, 0, 0));
|
||||||
|
|
|
@ -26,24 +26,24 @@ KeAcquireQueuedSpinLockAtDpcLevel(IN PKSPIN_LOCK_QUEUE LockHandle)
|
||||||
|
|
||||||
/* Set the new lock */
|
/* Set the new lock */
|
||||||
Prev = (PKSPIN_LOCK_QUEUE)
|
Prev = (PKSPIN_LOCK_QUEUE)
|
||||||
InterlockedExchange((PLONG)LockHandle->LockQueue.Lock,
|
InterlockedExchange((PLONG)LockHandle->Next,
|
||||||
(LONG)LockHandle);
|
(LONG)LockHandle);
|
||||||
if (!Prev)
|
if (!Prev)
|
||||||
{
|
{
|
||||||
/* There was nothing there before. We now own it */
|
/* There was nothing there before. We now own it */
|
||||||
*(ULONG_PTR*)&LockHandle->LockQueue.Lock |= LQ_OWN;
|
*LockHandle->Lock |= LQ_OWN;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the wait flag */
|
/* Set the wait flag */
|
||||||
*(ULONG_PTR*)&LockHandle->LockQueue.Lock |= LQ_WAIT;
|
*LockHandle->Lock |= LQ_WAIT;
|
||||||
|
|
||||||
/* Link us */
|
/* Link us */
|
||||||
Prev->Next = (PKSPIN_LOCK_QUEUE)LockHandle;
|
Prev->Next = (PKSPIN_LOCK_QUEUE)LockHandle;
|
||||||
|
|
||||||
/* Loop and wait */
|
/* Loop and wait */
|
||||||
while ( *(ULONG_PTR*)&LockHandle->LockQueue.Lock & LQ_WAIT) YieldProcessor();
|
while (*LockHandle->Lock & LQ_WAIT)
|
||||||
return;
|
YieldProcessor();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,31 +56,31 @@ KeReleaseQueuedSpinLockFromDpcLevel(IN PKSPIN_LOCK_QUEUE LockHandle)
|
||||||
PKSPIN_LOCK_QUEUE Waiter;
|
PKSPIN_LOCK_QUEUE Waiter;
|
||||||
|
|
||||||
/* Remove own and wait flags */
|
/* Remove own and wait flags */
|
||||||
*(ULONG_PTR*)&LockHandle->LockQueue.Lock &= ~(LQ_OWN | LQ_WAIT);
|
*LockHandle->Lock &= ~(LQ_OWN | LQ_WAIT);
|
||||||
LockVal = *LockHandle->LockQueue.Lock;
|
LockVal = *LockHandle->Lock;
|
||||||
|
|
||||||
/* Check if we already own it */
|
/* Check if we already own it */
|
||||||
if (LockVal == (KSPIN_LOCK)LockHandle)
|
if (LockVal == (KSPIN_LOCK)LockHandle)
|
||||||
{
|
{
|
||||||
/* Disown it */
|
/* Disown it */
|
||||||
LockVal = (KSPIN_LOCK)
|
LockVal = (KSPIN_LOCK)
|
||||||
InterlockedCompareExchangePointer(LockHandle->LockQueue.Lock,
|
InterlockedCompareExchangePointer(LockHandle->Lock,
|
||||||
NULL,
|
NULL,
|
||||||
LockHandle);
|
LockHandle);
|
||||||
}
|
}
|
||||||
if (LockVal == (KSPIN_LOCK)LockHandle) return;
|
if (LockVal == (KSPIN_LOCK)LockHandle) return;
|
||||||
|
|
||||||
/* Need to wait for it */
|
/* Need to wait for it */
|
||||||
Waiter = LockHandle->LockQueue.Next;
|
Waiter = LockHandle->Next;
|
||||||
while (!Waiter)
|
while (!Waiter)
|
||||||
{
|
{
|
||||||
YieldProcessor();
|
YieldProcessor();
|
||||||
Waiter = LockHandle->LockQueue.Next;
|
Waiter = LockHandle->Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It's gone */
|
/* It's gone */
|
||||||
*(ULONG_PTR*)&Waiter->Lock ^= (LQ_OWN | LQ_WAIT);
|
*(ULONG_PTR*)&Waiter->Lock ^= (LQ_OWN | LQ_WAIT);
|
||||||
LockHandle->LockQueue.Next = NULL;
|
LockHandle->Next = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,8 +211,7 @@ KeAcquireInStackQueuedSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock,
|
||||||
/* Set it up properly */
|
/* Set it up properly */
|
||||||
LockHandle->LockQueue.Next = NULL;
|
LockHandle->LockQueue.Next = NULL;
|
||||||
LockHandle->LockQueue.Lock = SpinLock;
|
LockHandle->LockQueue.Lock = SpinLock;
|
||||||
KeAcquireQueuedSpinLockAtDpcLevel((PKLOCK_QUEUE_HANDLE)
|
KeAcquireQueuedSpinLockAtDpcLevel(LockHandle->LockQueue.Next);
|
||||||
&LockHandle->LockQueue.Next);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,8 +224,7 @@ KeReleaseInStackQueuedSpinLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE LockHandle)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
/* Call the internal function */
|
/* Call the internal function */
|
||||||
KeReleaseQueuedSpinLockFromDpcLevel((PKLOCK_QUEUE_HANDLE)
|
KeReleaseQueuedSpinLockFromDpcLevel(LockHandle->LockQueue.Next);
|
||||||
&LockHandle->LockQueue.Next);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -480,7 +480,7 @@ KeStartThread(IN OUT PKTHREAD Thread)
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
/* Get the KNODE and its PRCB */
|
/* Get the KNODE and its PRCB */
|
||||||
Node = KeNodeBlock[Process->IdealNode];
|
Node = KeNodeBlock[Process->IdealNode];
|
||||||
NodePrcb = (PKPRCB)(KPCR_BASE + (Process->ThreadSeed * PAGE_SIZE));
|
NodePrcb = ((PKPCR)(KIP0PCRADDRESS + Process->ThreadSeed * PAGE_SIZE))->Prcb;
|
||||||
|
|
||||||
/* Calculate affinity mask */
|
/* Calculate affinity mask */
|
||||||
Set = ~NodePrcb->MultiThreadProcessorSet;
|
Set = ~NodePrcb->MultiThreadProcessorSet;
|
||||||
|
|
|
@ -75,22 +75,23 @@ extern BOOLEAN Ke386NoExecute;
|
||||||
|
|
||||||
BOOLEAN MmUnmapPageTable(PULONG Pt);
|
BOOLEAN MmUnmapPageTable(PULONG Pt);
|
||||||
|
|
||||||
VOID
|
ULONG_PTR
|
||||||
STDCALL
|
NTAPI
|
||||||
MiFlushTlbIpiRoutine(PVOID Address)
|
MiFlushTlbIpiRoutine(ULONG_PTR Address)
|
||||||
{
|
{
|
||||||
if (Address == (PVOID)0xffffffff)
|
if (Address == (ULONG_PTR)-1)
|
||||||
{
|
{
|
||||||
KeFlushCurrentTb();
|
KeFlushCurrentTb();
|
||||||
}
|
}
|
||||||
else if (Address == (PVOID)0xfffffffe)
|
else if (Address == (ULONG_PTR)-2)
|
||||||
{
|
{
|
||||||
KeFlushCurrentTb();
|
KeFlushCurrentTb();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__invlpg(Address);
|
__invlpg((PVOID)Address);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -101,13 +102,13 @@ MiFlushTlb(PULONG Pt, PVOID Address)
|
||||||
{
|
{
|
||||||
MmUnmapPageTable(Pt);
|
MmUnmapPageTable(Pt);
|
||||||
}
|
}
|
||||||
if (KeNumberProcessors>1)
|
if (KeNumberProcessors > 1)
|
||||||
{
|
{
|
||||||
KeIpiGenericCall(MiFlushTlbIpiRoutine, Address);
|
KeIpiGenericCall(MiFlushTlbIpiRoutine, (ULONG_PTR)Address);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MiFlushTlbIpiRoutine(Address);
|
MiFlushTlbIpiRoutine((ULONG_PTR)Address);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((Pt && MmUnmapPageTable(Pt)) || Address >= MmSystemRangeStart)
|
if ((Pt && MmUnmapPageTable(Pt)) || Address >= MmSystemRangeStart)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue