ReactOS 0.4.16-dev-122-g325d74c
ipi.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for ipi.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI KiIpiGenericCallTarget (IN PKIPI_CONTEXT PacketContext, IN PVOID BroadcastFunction, IN PVOID Argument, IN PVOID Count)
 
VOID FASTCALL KiIpiSend (IN KAFFINITY TargetProcessors, IN ULONG IpiRequest)
 
VOID NTAPI KiIpiSendPacket (IN KAFFINITY TargetProcessors, IN PKIPI_WORKER WorkerFunction, IN PKIPI_BROADCAST_WORKER BroadcastFunction, IN ULONG_PTR Context, IN PULONG Count)
 
VOID FASTCALL KiIpiSignalPacketDone (IN PKIPI_CONTEXT PacketContext)
 
VOID FASTCALL KiIpiSignalPacketDoneAndStall (IN PKIPI_CONTEXT PacketContext, IN volatile PULONG ReverseStall)
 
BOOLEAN NTAPI KiIpiServiceRoutine (IN PKTRAP_FRAME TrapFrame, IN PKEXCEPTION_FRAME ExceptionFrame)
 
ULONG_PTR NTAPI KeIpiGenericCall (IN PKIPI_BROADCAST_WORKER Function, IN ULONG_PTR Argument)
 

Variables

KSPIN_LOCK KiReverseStallIpiLock
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file ipi.c.

Function Documentation

◆ KeIpiGenericCall()

ULONG_PTR NTAPI KeIpiGenericCall ( IN PKIPI_BROADCAST_WORKER  Function,
IN ULONG_PTR  Argument 
)

Definition at line 198 of file ipi.c.

200{
202 KIRQL OldIrql, OldIrql2;
203#ifdef CONFIG_SMP
205 ULONG Count;
206 PKPRCB Prcb = KeGetCurrentPrcb();
207#endif
208
209 /* Raise to DPC level if required */
212
213#ifdef CONFIG_SMP
214 /* Get current processor count and affinity */
217
218 /* Exclude ourselves */
219 Affinity &= ~Prcb->SetMember;
220#endif
221
222 /* Acquire the IPI lock */
224
225#ifdef CONFIG_SMP
226 /* Make sure this is MP */
227 if (Affinity)
228 {
229 /* Send an IPI */
232 Function,
233 Argument,
234 &Count);
235
236 /* Spin until the other processors are ready */
237 while (Count != 1)
238 {
241 }
242 }
243#endif
244
245 /* Raise to IPI level */
246 KeRaiseIrql(IPI_LEVEL, &OldIrql2);
247
248#ifdef CONFIG_SMP
249 /* Let the other processors know it is time */
250 Count = 0;
251#endif
252
253 /* Call the function */
254 Status = Function(Argument);
255
256#ifdef CONFIG_SMP
257 /* If this is MP, wait for the other processors to finish */
258 if (Affinity)
259 {
260 /* Sanity check */
261 ASSERT(Prcb == KeGetCurrentPrcb());
262
263 /* FIXME: TODO */
264 ASSERTMSG("Not yet implemented\n", FALSE);
265 }
266#endif
267
268 /* Release the lock */
270
271 /* Lower IRQL back */
273 return Status;
274}
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1156
#define FALSE
Definition: types.h:117
ULONG_PTR KAFFINITY
Definition: compat.h:85
#define IPI_LEVEL
Definition: env_spec_w32.h:701
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
Status
Definition: gdiplustypes.h:25
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
#define ASSERT(a)
Definition: mode.c:44
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1161
int Count
Definition: noreturn.cpp:7
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
VOID NTAPI KiIpiGenericCallTarget(IN PKIPI_CONTEXT PacketContext, IN PVOID BroadcastFunction, IN PVOID Argument, IN PVOID Count)
Definition: ipi.c:25
KSPIN_LOCK KiReverseStallIpiLock
Definition: krnlinit.c:64
VOID NTAPI KiIpiSendPacket(IN KAFFINITY TargetProcessors, IN PKIPI_WORKER WorkerFunction, IN PKIPI_BROADCAST_WORKER BroadcastFunction, IN ULONG_PTR Context, IN PULONG Count)
Definition: ipi.c:45
#define KeMemoryBarrierWithoutFence()
Definition: ke.h:66
#define YieldProcessor
Definition: ke.h:48
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
Definition: ke.h:125
#define KeReleaseSpinLockFromDpcLevel(SpinLock)
Definition: ke.h:135
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

◆ KiIpiGenericCallTarget()

VOID NTAPI KiIpiGenericCallTarget ( IN PKIPI_CONTEXT  PacketContext,
IN PVOID  BroadcastFunction,
IN PVOID  Argument,
IN PVOID  Count 
)

Definition at line 25 of file ipi.c.

29{
30 /* FIXME: TODO */
31 ASSERTMSG("Not yet implemented\n", FALSE);
32}

Referenced by KeIpiGenericCall().

◆ KiIpiSend()

VOID FASTCALL KiIpiSend ( IN KAFFINITY  TargetProcessors,
IN ULONG  IpiRequest 
)

Definition at line 36 of file ipi.c.

38{
39 /* FIXME: TODO */
40 ASSERTMSG("Not yet implemented\n", FALSE);
41}

◆ KiIpiSendPacket()

VOID NTAPI KiIpiSendPacket ( IN KAFFINITY  TargetProcessors,
IN PKIPI_WORKER  WorkerFunction,
IN PKIPI_BROADCAST_WORKER  BroadcastFunction,
IN ULONG_PTR  Context,
IN PULONG  Count 
)

Definition at line 45 of file ipi.c.

50{
51 /* FIXME: TODO */
52 ASSERTMSG("Not yet implemented\n", FALSE);
53}

Referenced by KeFlushEntireTb(), and KeIpiGenericCall().

◆ KiIpiServiceRoutine()

BOOLEAN NTAPI KiIpiServiceRoutine ( IN PKTRAP_FRAME  TrapFrame,
IN PKEXCEPTION_FRAME  ExceptionFrame 
)

Definition at line 150 of file ipi.c.

152{
153#ifdef CONFIG_SMP
154 PKPRCB Prcb;
156
157 Prcb = KeGetCurrentPrcb();
158
160 {
162 }
163
165 {
168 }
169
171 {
172#if defined(_M_ARM) || defined(_M_AMD64)
174#else
175 (void)InterlockedDecrementUL(&Prcb->SignalDone->CurrentPacket[1]);
176 if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
177 {
178 while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[1], 0, 0));
179 }
180 ((VOID (NTAPI*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]);
182 if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
183 {
184 while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->TargetSet, 0, 0));
185 }
187#endif // _M_ARM
188 }
189#endif
190 return TRUE;
191}
#define VOID
Definition: acefi.h:82
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define InterlockedDecrementUL(Addend)
Definition: ex.h:1524
#define InterlockedCompareExchangeUL(Destination, Exchange, Comperand)
Definition: ex.h:1536
VOID FASTCALL HalRequestSoftwareInterrupt(IN KIRQL Irql)
Definition: pic.c:271
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define InterlockedBitTestAndReset
Definition: interlocked.h:35
#define IPI_SYNCH_REQUEST
Definition: ketypes.h:301
#define IPI_DPC
Definition: ketypes.h:298
#define IPI_APC
Definition: ketypes.h:297
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:341
ULONG IpiFrozen
Definition: ketypes.h:755
UCHAR DpcInterruptRequested
Definition: ketypes.h:770
volatile struct _KPRCB * SignalDone
Definition: ketypes.h:674
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
int32_t * PLONG
Definition: typedefs.h:58

◆ KiIpiSignalPacketDone()

VOID FASTCALL KiIpiSignalPacketDone ( IN PKIPI_CONTEXT  PacketContext)

Definition at line 57 of file ipi.c.

58{
59 /* FIXME: TODO */
60 ASSERTMSG("Not yet implemented\n", FALSE);
61}

Referenced by KiFlushTargetEntireTb().

◆ KiIpiSignalPacketDoneAndStall()

VOID FASTCALL KiIpiSignalPacketDoneAndStall ( IN PKIPI_CONTEXT  PacketContext,
IN volatile PULONG  ReverseStall 
)

Definition at line 65 of file ipi.c.

67{
68 /* FIXME: TODO */
69 ASSERTMSG("Not yet implemented\n", FALSE);
70}

Variable Documentation

◆ KiReverseStallIpiLock

KSPIN_LOCK KiReverseStallIpiLock
extern

Definition at line 64 of file krnlinit.c.

Referenced by KeIpiGenericCall(), and KiInitSpinLocks().