ReactOS  0.4.14-dev-41-g31d7680
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  {
237  YieldProcessor();
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 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
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
VOID NTAPI KeAcquireSpinLockAtDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:192
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
KSPIN_LOCK KiReverseStallIpiLock
Definition: krnlinit.c:64
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
uint32_t ULONG_PTR
Definition: typedefs.h:63
FORCEINLINE VOID YieldProcessor(VOID)
Definition: ke.h:32
UCHAR KIRQL
Definition: env_spec_w32.h:591
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
#define KeMemoryBarrierWithoutFence()
Definition: ke.h:66
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define IPI_LEVEL
Definition: env_spec_w32.h:701
VOID NTAPI KeReleaseSpinLockFromDpcLevel(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.c:215
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
Status
Definition: gdiplustypes.h:24
UINT64 SetMember
Definition: ketypes.h:578
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
ULONG_PTR KAFFINITY
Definition: compat.h:75
VOID NTAPI KiIpiGenericCallTarget(IN PKIPI_CONTEXT PacketContext, IN PVOID BroadcastFunction, IN PVOID Argument, IN PVOID Count)
Definition: ipi.c:23
unsigned int ULONG
Definition: retypes.h:1

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 }
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431

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 }
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431

◆ 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 }
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431

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  {
164  Prcb->DpcInterruptRequested = TRUE;
166  }
167 
169  {
170 #ifdef _M_ARM
171  DbgBreakPoint();
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 KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define TRUE
Definition: types.h:120
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
ULONG IpiFrozen
Definition: ketypes.h:671
void DbgBreakPoint()
Definition: mach.c:553
#define InterlockedCompareExchangeUL(Destination, Exchange, Comperand)
Definition: ex.h:1522
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:325
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define InterlockedBitTestAndReset
Definition: interlocked.h:35
smooth NULL
Definition: ftsmooth.c:416
#define IPI_DPC
Definition: ketypes.h:233
#define IPI_SYNCH_REQUEST
Definition: ketypes.h:236
void * PVOID
Definition: retypes.h:9
#define IPI_LEVEL
Definition: env_spec_w32.h:701
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
UCHAR DpcInterruptRequested
Definition: ketypes.h:686
#define VOID
Definition: acefi.h:82
#define InterlockedDecrementUL(Addend)
Definition: ex.h:1510
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
volatile struct _KPRCB * SignalDone
Definition: ketypes.h:618
VOID FASTCALL HalRequestSoftwareInterrupt(IN KIRQL Irql)
Definition: pic.c:271
#define IPI_APC
Definition: ketypes.h:232
signed int * PLONG
Definition: retypes.h:5
#define APC_LEVEL
Definition: env_spec_w32.h:695

◆ 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 }
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431

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 }
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431

Variable Documentation

◆ KiReverseStallIpiLock

KSPIN_LOCK KiReverseStallIpiLock

Definition at line 64 of file krnlinit.c.

Referenced by KeIpiGenericCall(), and KiInitSpinLocks().