ReactOS 0.4.15-dev-5666-gc548b97
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 196 of file ipi.c.

198{
200 KIRQL OldIrql, OldIrql2;
201#ifdef CONFIG_SMP
203 ULONG Count;
204 PKPRCB Prcb = KeGetCurrentPrcb();
205#endif
206
207 /* Raise to DPC level if required */
210
211#ifdef CONFIG_SMP
212 /* Get current processor count and affinity */
215
216 /* Exclude ourselves */
217 Affinity &= ~Prcb->SetMember;
218#endif
219
220 /* Acquire the IPI lock */
222
223#ifdef CONFIG_SMP
224 /* Make sure this is MP */
225 if (Affinity)
226 {
227 /* Send an IPI */
230 Function,
231 Argument,
232 &Count);
233
234 /* Spin until the other processors are ready */
235 while (Count != 1)
236 {
239 }
240 }
241#endif
242
243 /* Raise to IPI level */
244 KeRaiseIrql(IPI_LEVEL, &OldIrql2);
245
246#ifdef CONFIG_SMP
247 /* Let the other processors know it is time */
248 Count = 0;
249#endif
250
251 /* Call the function */
252 Status = Function(Argument);
253
254#ifdef CONFIG_SMP
255 /* If this is MP, wait for the other processors to finish */
256 if (Affinity)
257 {
258 /* Sanity check */
259 ASSERT(Prcb == KeGetCurrentPrcb());
260
261 /* FIXME: TODO */
262 ASSERTMSG("Not yet implemented\n", FALSE);
263 }
264#endif
265
266 /* Release the lock */
268
269 /* Lower IRQL back */
271 return Status;
272}
_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
VOID NTAPI KiIpiGenericCallTarget(IN PKIPI_CONTEXT PacketContext, IN PVOID BroadcastFunction, IN PVOID Argument, IN PVOID Count)
Definition: ipi.c:23
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:43
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
unsigned int ULONG
Definition: retypes.h:1
#define ASSERT(a)
Definition: mode.c:44
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1080
int Count
Definition: noreturn.cpp:7
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
#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
_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:792

Referenced by KiInitMachineDependent(), KiRestoreFastSyscallReturnState(), MiFlushTlb(), PcipGetFunctionLimits(), and PciUpdateHardware().

◆ KiIpiGenericCallTarget()

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

Definition at line 23 of file ipi.c.

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

Referenced by KeIpiGenericCall().

◆ KiIpiSend()

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

Definition at line 34 of file ipi.c.

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

◆ 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 43 of file ipi.c.

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

Referenced by KeFlushEntireTb(), and KeIpiGenericCall().

◆ KiIpiServiceRoutine()

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

Definition at line 148 of file ipi.c.

150{
151#ifdef CONFIG_SMP
152 PKPRCB Prcb;
154
155 Prcb = KeGetCurrentPrcb();
156
158 {
160 }
161
163 {
166 }
167
169 {
170#if defined(_M_ARM) || defined(_M_AMD64)
172#else
173 (void)InterlockedDecrementUL(&Prcb->SignalDone->CurrentPacket[1]);
174 if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
175 {
176 while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[1], 0, 0));
177 }
178 ((VOID (NTAPI*)(PVOID))(Prcb->SignalDone->WorkerRoutine))(Prcb->SignalDone->CurrentPacket[0]);
180 if (InterlockedCompareExchangeUL(&Prcb->SignalDone->CurrentPacket[2], 0, 0))
181 {
182 while (0 != InterlockedCompareExchangeUL(&Prcb->SignalDone->TargetSet, 0, 0));
183 }
185#endif // _M_ARM
186 }
187#endif
188 return TRUE;
189}
#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:1523
#define InterlockedCompareExchangeUL(Destination, Exchange, Comperand)
Definition: ex.h:1535
VOID FASTCALL HalRequestSoftwareInterrupt(IN KIRQL Irql)
Definition: pic.c:271
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define InterlockedBitTestAndReset
Definition: interlocked.h:35
void * PVOID
Definition: retypes.h:9
signed int * PLONG
Definition: retypes.h:5
#define IPI_SYNCH_REQUEST
Definition: ketypes.h:240
#define IPI_DPC
Definition: ketypes.h:237
#define IPI_APC
Definition: ketypes.h:236
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:337
UCHAR DpcInterruptRequested
Definition: ketypes.h:691
volatile struct _KPRCB * SignalDone
Definition: ketypes.h:621
ULONG IpiFrozen
Definition: ketypes.h:676
#define NTAPI
Definition: typedefs.h:36

◆ KiIpiSignalPacketDone()

VOID FASTCALL KiIpiSignalPacketDone ( IN PKIPI_CONTEXT  PacketContext)

Definition at line 55 of file ipi.c.

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

Referenced by KiFlushTargetEntireTb().

◆ KiIpiSignalPacketDoneAndStall()

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

Definition at line 63 of file ipi.c.

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

Variable Documentation

◆ KiReverseStallIpiLock

KSPIN_LOCK KiReverseStallIpiLock
extern

Definition at line 64 of file krnlinit.c.

Referenced by KeIpiGenericCall(), and KiInitSpinLocks().