本文整理汇总了C++中KeInsertQueueDpc函数的典型用法代码示例。如果您正苦于以下问题:C++ KeInsertQueueDpc函数的具体用法?C++ KeInsertQueueDpc怎么用?C++ KeInsertQueueDpc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KeInsertQueueDpc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rtTimerNtOmniMasterCallback
/**
* The timer callback for an omni-timer.
*
* This is responsible for queueing the DPCs for the other CPUs and
* perform the callback on the CPU on which it is called.
*
* @param pDpc The DPC object.
* @param pvUser Pointer to the sub-timer.
* @param SystemArgument1 Some system stuff.
* @param SystemArgument2 Some system stuff.
*/
static void _stdcall rtTimerNtOmniMasterCallback(IN PKDPC pDpc, IN PVOID pvUser, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
{
PRTTIMERNTSUBTIMER pSubTimer = (PRTTIMERNTSUBTIMER)pvUser;
PRTTIMER pTimer = pSubTimer->pParent;
int iCpuSelf = RTMpCpuIdToSetIndex(RTMpCpuId());
AssertPtr(pTimer);
#ifdef RT_STRICT
if (KeGetCurrentIrql() < DISPATCH_LEVEL)
RTAssertMsg2Weak("rtTimerNtOmniMasterCallback: Irql=%d expected >=%d\n", KeGetCurrentIrql(), DISPATCH_LEVEL);
if (pSubTimer - &pTimer->aSubTimers[0] != iCpuSelf)
RTAssertMsg2Weak("rtTimerNtOmniMasterCallback: iCpuSelf=%d pSubTimer=%p / %d\n", iCpuSelf, pSubTimer, pSubTimer - &pTimer->aSubTimers[0]);
#endif
/*
* Check that we haven't been suspended before scheduling the other DPCs
* and doing the callout.
*/
if ( !ASMAtomicUoReadBool(&pTimer->fSuspended)
&& pTimer->u32Magic == RTTIMER_MAGIC)
{
RTCPUSET OnlineSet;
RTMpGetOnlineSet(&OnlineSet);
for (int iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++)
if ( RTCpuSetIsMemberByIndex(&OnlineSet, iCpu)
&& iCpuSelf != iCpu)
KeInsertQueueDpc(&pTimer->aSubTimers[iCpu].NtDpc, 0, 0);
pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pSubTimer->iTick);
}
NOREF(pDpc); NOREF(SystemArgument1); NOREF(SystemArgument2);
}
示例2: XenPci_HighSync
VOID
XenPci_HighSync(PXENPCI_HIGHSYNC_FUNCTION function0, PXENPCI_HIGHSYNC_FUNCTION functionN, PVOID context)
{
ULONG ActiveProcessorCount;
ULONG i;
highsync_info_t *highsync_info;
KIRQL old_irql;
UNREFERENCED_PARAMETER(context);
FUNCTION_ENTER();
highsync_info = ExAllocatePoolWithTag(NonPagedPool, sizeof(highsync_info_t), XENPCI_POOL_TAG);
RtlZeroMemory(highsync_info, sizeof(highsync_info_t));
KeInitializeEvent(&highsync_info->highsync_complete_event, SynchronizationEvent, FALSE);
highsync_info->function0 = function0;
highsync_info->functionN = functionN;
highsync_info->context = context;
highsync_info->sync_level = HIGH_LEVEL;
#if (NTDDI_VERSION >= NTDDI_WINXP)
ActiveProcessorCount = (ULONG)KeNumberProcessors;
#else
ActiveProcessorCount = (ULONG)*KeNumberProcessors;
#endif
/* Go to HIGH_LEVEL to prevent any races with Dpc's on the current processor */
KeRaiseIrql(highsync_info->sync_level, &old_irql);
highsync_info->do_spin = TRUE;
for (i = 0; i < ActiveProcessorCount; i++)
{
if (i == 0)
KeInitializeDpc(&highsync_info->dpcs[i], XenPci_HighSyncCallFunction0, highsync_info);
else
KeInitializeDpc(&highsync_info->dpcs[i], XenPci_HighSyncCallFunctionN, highsync_info);
KeSetTargetProcessorDpc(&highsync_info->dpcs[i], (CCHAR)i);
KeSetImportanceDpc(&highsync_info->dpcs[i], HighImportance);
KdPrint((__DRIVER_NAME " queuing Dpc for CPU %d\n", i));
KeInsertQueueDpc(&highsync_info->dpcs[i], NULL, NULL);
}
KdPrint((__DRIVER_NAME " All Dpc's queued\n"));
KeMemoryBarrier();
KeLowerIrql(old_irql);
KdPrint((__DRIVER_NAME " Waiting for highsync_complete_event\n"));
KeWaitForSingleObject(&highsync_info->highsync_complete_event, Executive, KernelMode, FALSE, NULL);
#if (NTDDI_VERSION >= NTDDI_WINXP)
KeFlushQueuedDpcs();
#else
{
/* just wait 1 second until all DPC's finish - not ideal but it's only for W2K */
LARGE_INTEGER interval;
interval.QuadPart = -1 * 1000 * 1000 * 10; /* 1 second */
KeDelayExecutionThread(KernelMode, FALSE, &interval);
}
#endif
ExFreePoolWithTag(highsync_info, XENPCI_POOL_TAG);
FUNCTION_EXIT();
}
示例3: KeInsertQueueDpc
BOOLEAN
RosKmAdapter::InterruptRoutine(
IN_ULONG MessageNumber)
{
MessageNumber;
#if VC4_TODO
RosKmAdapter *pRosKmdAdapter = RosKmAdapter::Cast(MiniportDeviceContext);
if (!m_bReadyToHandleInterrupt)
{
return FALSE;
}
// Acknowledge the interrupt
// If the interrupt is for DMA buffer completion,
// queue the DPC to wake up the worker thread
KeInsertQueueDpc(&pRosKmAdapter->m_hwDmaBufCompletionDpc, NULL, NULL);
return TRUE;
#else
return FALSE;
#endif
}
示例4: EvtchnInterruptHandler
_IRQL_requires_same_
static DECLSPEC_NOINLINE
BOOLEAN
EvtchnInterruptHandler(
__in PKINTERRUPT Interrupt,
__in_opt PVOID Argument
)
{
PXENIFACE_EVTCHN_CONTEXT Context = Argument;
PROCESSOR_NUMBER ProcNumber;
ULONG ProcIndex;
UNREFERENCED_PARAMETER(Interrupt);
ASSERT(Context != NULL);
KeGetCurrentProcessorNumberEx(&ProcNumber);
ProcIndex = KeGetProcessorIndexFromNumber(&ProcNumber);
if (!KeInsertQueueDpc(&Context->Dpc, NULL, NULL)) {
XenIfaceDebugPrint(TRACE, "NOT INSERTED: Context %p, Port %lu, FO %p, Cpu %lu\n",
Context, Context->LocalPort, Context->FileObject, ProcIndex);
}
return TRUE;
}
示例5: KrnlHlprThreadedDPCQueue
NTSTATUS KrnlHlprThreadedDPCQueue(_In_ KDEFERRED_ROUTINE* pDPCFn,
_In_ CLASSIFY_DATA* pClassifyData,
_In_opt_ INJECTION_DATA* pInjectionData, /* 0 */
_In_opt_ VOID* pContext) /* 0 */
{
#if DBG
DbgPrintEx(DPFLTR_IHVNETWORK_ID,
DPFLTR_INFO_LEVEL,
" ---> KrnlHlprThreadedDPCQueue()\n");
#endif /// DBG
NT_ASSERT(pDPCFn);
NT_ASSERT(pClassifyData);
NTSTATUS status = STATUS_SUCCESS;
DPC_DATA* pDPCData = 0;
#pragma warning(push)
#pragma warning(disable: 6014) /// pDPCData will be freed by caller
status = KrnlHlprDPCDataCreate(&pDPCData,
pClassifyData,
pInjectionData,
pContext);
HLPR_BAIL_ON_FAILURE(status);
#pragma warning(pop)
KeInitializeThreadedDpc(&(pDPCData->kdpc),
pDPCFn,
0);
KeInsertQueueDpc(&(pDPCData->kdpc),
pDPCData,
0);
HLPR_BAIL_LABEL:
#pragma warning(push)
#pragma warning(disable: 6001) /// pDPCData initialized with call to KrnlHlprDPCDataCreate
if(status != STATUS_SUCCESS &&
pDPCData)
KrnlHlprDPCDataDestroy(&pDPCData);
#pragma warning(pop)
#if DBG
DbgPrintEx(DPFLTR_IHVNETWORK_ID,
DPFLTR_INFO_LEVEL,
" <--- KrnlHlprThreadedDPCQueue() [status: %#x]\n",
status);
#endif /// DBG
return status;
}
示例6: WDFEXPORT
BOOLEAN
WDFEXPORT(WdfDpcEnqueue)(
__in
PWDF_DRIVER_GLOBALS DriverGlobals,
__in
WDFDPC Dpc
)
/*++
Routine Description:
Enqueue the DPC to run at a system determined time
Arguments:
WDFDPC - Handle to WDFDPC object created with WdfDpcCreate.
Returns:
--*/
{
FxDpc* pFxDpc;
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals),
Dpc,
FX_TYPE_DPC,
(PVOID*)&pFxDpc);
return KeInsertQueueDpc(pFxDpc->GetDpcPtr(), NULL, NULL);
}
示例7: dtrace_hook_int
void dtrace_hook_int(UCHAR ivec, void (*InterruptHandler)( void ), uintptr_t *paddr)
{
INT_VECTOR OrgVec;
int i;
PRKDPC Dpc;
cpunos = 0;
if (paddr != 0) {
BackupInterrupt(ivec, &OrgVec);
#ifdef _AMD64_
*(ULONG64 *)paddr = VEC_OFFSET_TO_ADDR(OrgVec);
#else
*(ULONG32 *)paddr = VEC_OFFSET_TO_ADDR(OrgVec);
#endif
}
Dpc = (PRKDPC) ExAllocatePoolWithTag(NonPagedPool, sizeof(KDPC)*KeNumberProcessors, 'Tag1');
for (i = 0; i < KeNumberProcessors; i++) {
KeInitializeDpc(&Dpc[i], hook_init, NULL);
}
KeInitializeEvent(&SyncIDT, NotificationEvent, FALSE);
for (i=0; i < KeNumberProcessors; i++) {
KeSetTargetProcessorDpc(&Dpc[i], (char) i);
KeSetImportanceDpc(&Dpc[i], HighImportance);
KeInsertQueueDpc(&Dpc[i], (PVOID) ivec, (PVOID)InterruptHandler);
}
KeWaitForSingleObject(&SyncIDT,Executive,KernelMode,0,NULL);
KeClearEvent(&SyncIDT);
ExFreePoolWithTag(Dpc, 'Tag1');
}
示例8: SendEachProcessorDpc
VOID
SendEachProcessorDpc (
PKDEFERRED_ROUTINE Routine,
PVOID Context,
PVOID SysArg1,
PVOID SysArg2
)
/*++
Routine Description
This routine sends DPC to each processor in multiprocessor system
Arguments
Routine
Deferred routine
Context, SysArg1, SysArg2
Parameters, see MSDN doc for KeInitializeDpc, KeInsertQueueDpc
Return Value
None
--*/
{
UNICODE_STRING u;
RtlInitUnicodeString (&u, L"KeFlushQueuedDpcs");
*(PVOID*)&pKeFlushQueuedDpcs = MmGetSystemRoutineAddress (&u);
for (CCHAR i=0; i<KeNumberProcessors; i++)
{
KDPC Dpc;
KdPrint(("SendEachProcessorDpc: processor [%d] in queue\n", i));
KeInitializeDpc (&Dpc, Routine, Context);
KeSetTargetProcessorDpc (&Dpc, i);
KeInsertQueueDpc (&Dpc, SysArg1, SysArg2);
KdPrint(("SendEachProcessorDpc: processor [%d] completed its DPC\n", i));
}
if (pKeFlushQueuedDpcs)
{
// Ensure that all DPCs are delivered.
pKeFlushQueuedDpcs ();
}
else
{
KdPrint(("pKeFlushQueuedDpcs = NULL!!!\n"));
}
KdPrint(("SendEachProcessorDpc: all completed\n"));
}
示例9: InterruptService
BOOLEAN NTAPI
InterruptService(PKINTERRUPT Interrupt, PVOID ServiceContext)
{
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT) ServiceContext;
PEHCI_HOST_CONTROLLER hcd;
ULONG CStatus = 0;
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
hcd = &FdoDeviceExtension->hcd;
/* Read device status */
CStatus = ReadControllerStatus(hcd);
CStatus &= (EHCI_ERROR_INT | EHCI_STS_INT | EHCI_STS_IAA | EHCI_STS_PCD | EHCI_STS_FLR | EHCI_STS_RECL);
if ((!CStatus) || (FdoDeviceExtension->DeviceState == 0))
{
/* This interrupt isnt for us or not ready for it. */
return FALSE;
}
/* Clear status */
ClearControllerStatus(hcd, CStatus);
if (CStatus & EHCI_STS_RECL)
{
DPRINT("Reclamation\n");
}
if (CStatus & EHCI_ERROR_INT)
{
DPRINT1("EHCI Status=0x%x\n", CStatus);
/* This check added in case the NT USB Driver is still loading.
It will cause this error condition at every device connect. */
if(CStatus & EHCI_STS_PCD)
{
DPRINT1("EHCI Error: Another driver may be interfering with proper operation of this driver\n");
DPRINT1(" Hint: Ensure that the old NT Usb Driver has been removed!\n");
ASSERT(FALSE);
}
}
if (CStatus & EHCI_STS_FATAL)
{
DPRINT1("EHCI: Host System Error. Possible PCI problems.\n");
ASSERT(FALSE);
}
if (CStatus & EHCI_STS_HALT)
{
DPRINT1("EHCI: Host Controller unexpected halt.\n");
/* FIXME: Reset the controller */
}
KeInsertQueueDpc(&FdoDeviceExtension->DpcObject, FdoDeviceExtension, (PVOID)CStatus);
return TRUE;
}
示例10: V4vVirqNotifyIsr
static VOID
V4vVirqNotifyIsr(VOID *ctx)
{
XENV4V_EXTENSION *pde = V4vGetDeviceExtension((DEVICE_OBJECT*)ctx);
// Just drop out of ISR context
KeInsertQueueDpc(&pde->virqDpc, NULL, NULL);
}
示例11: MPCreateThread
VOID MPCreateThread(VOID (*FunctionPointer)(IN PKDPC, IN PVOID, IN PVOID, IN PVOID))
{
/*
*
* Multi-Processor Consideration ::
*
* Each processor has it's own IDT.
*
*/
CCHAR i;
long currentProcessor =0;
PKDPC pkDpc =NULL;
KIRQL oldIrql, currentIrql;
allProcessorDone =0;
currentIrql = KeGetCurrentIrql();
if (currentIrql < DISPATCH_LEVEL)
KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);
InterlockedAnd(&allProcessorDone, 0);
pkDpc = (PKDPC)ExAllocatePoolWithTag(NonPagedPool, KeNumberProcessors * sizeof(KDPC), (ULONG)' pni');
if (!pkDpc)
{
DbgPrint("Insufficient Resource error\n");
return;
}
currentProcessor = KeGetCurrentProcessorNumber();
for (i = 0; i < KeNumberProcessors; i++)
{
cpuNum[i] =i;
KeInitializeDpc(&pkDpc[i],
FunctionPointer,
&cpuNum[i]);
KeSetTargetProcessorDpc(&pkDpc[i], i);
KeInsertQueueDpc(&pkDpc[i], NULL, NULL);
}
// wait for all of the processor's hooking initialization.
while(InterlockedCompareExchange(&allProcessorDone, KeNumberProcessors - 1, KeNumberProcessors - 1) != KeNumberProcessors - 1)
{
_asm pause;
}
if (currentIrql < DISPATCH_LEVEL)
KeLowerIrql(oldIrql);
if (pkDpc)
{
ExFreePool(pkDpc);
pkDpc = NULL;
}
}
示例12: RXScheduleTheReceiveIndication
VOID
RXScheduleTheReceiveIndication(
_In_ PMP_ADAPTER Adapter,
_In_ PRCB Rcb)
/*++
Routine Description:
This function schedules the receive DPC on the receiving miniport.
Arguments:
FunctionContext Pointer to the adapter that is receiving frames
Return Value:
None.
--*/
{
//
// Use default DPC unless VMQ is enabled, in which case you use the Queue's DPC
//
PMP_ADAPTER_RECEIVE_DPC AdapterDpc = Adapter->DefaultRecvDpc;
if(VMQ_ENABLED(Adapter))
{
//
// Add Rcb to owner Queue's pending List
//
AdapterDpc = GetRxQueueDpc(Adapter, NET_BUFFER_LIST_RECEIVE_QUEUE_ID(Rcb->Nbl));
}
else
{
UNREFERENCED_PARAMETER(Rcb);
}
//
// Schedule DPC
//
if(AdapterDpc->WorkItemQueued)
{
//
// We've queued up receive work item to avoid DPC watchdog timeout. Let's wait for it to start rather
// than queue up the DPC.
//
DEBUGP(MP_TRACE, "[%p] Receive DPC not scheduled, receive work item is pending. Processor: %i\n", Adapter, AdapterDpc->ProcessorNumber);
}
else
{
KeInsertQueueDpc(&AdapterDpc->Dpc, AdapterDpc, NULL);
DEBUGP(MP_TRACE, "[%p] Scheduled Receive DPC. Processor: %i\n", Adapter, AdapterDpc->ProcessorNumber);
}
}
示例13: XenUsb_HandleEvent_DIRQL
static BOOLEAN
XenUsb_HandleEvent_DIRQL(PVOID context) {
PXENUSB_DEVICE_DATA xudd = context;
//FUNCTION_ENTER();
if (xudd->device_state == DEVICE_STATE_ACTIVE || xudd->device_state == DEVICE_STATE_DISCONNECTING) {
KeInsertQueueDpc(&xudd->event_dpc, NULL, NULL);
}
//FUNCTION_EXIT();
return TRUE;
}
示例14: KiSignalTimer
BOOLEAN
FASTCALL
KiSignalTimer(IN PKTIMER Timer)
{
BOOLEAN RequestInterrupt = FALSE;
PKDPC Dpc = Timer->Dpc;
ULONG Period = Timer->Period;
LARGE_INTEGER Interval, SystemTime;
DPRINT("KiSignalTimer(): Timer %p\n", Timer);
/* Set default values */
Timer->Header.Inserted = FALSE;
Timer->Header.SignalState = TRUE;
/* Check if the timer has waiters */
if (!IsListEmpty(&Timer->Header.WaitListHead))
{
/* Check the type of event */
if (Timer->Header.Type == TimerNotificationObject)
{
/* Unwait the thread */
KxUnwaitThread(&Timer->Header, IO_NO_INCREMENT);
}
else
{
/* Otherwise unwait the thread and signal the timer */
KxUnwaitThreadForEvent((PKEVENT)Timer, IO_NO_INCREMENT);
}
}
/* Check if we have a period */
if (Period)
{
/* Calculate the interval and insert the timer */
Interval.QuadPart = Int32x32To64(Period, -10000);
while (!KiInsertTreeTimer(Timer, Interval));
}
/* Check if we have a DPC */
if (Dpc)
{
/* Insert it in the queue */
KeQuerySystemTime(&SystemTime);
KeInsertQueueDpc(Dpc,
ULongToPtr(SystemTime.LowPart),
ULongToPtr(SystemTime.HighPart));
RequestInterrupt = TRUE;
}
/* Return whether we need to request a DPC interrupt or not */
return RequestInterrupt;
}
示例15: ServiceRoutine
BOOLEAN NTAPI ServiceRoutine(
IN PKINTERRUPT Interrupt,
IN PVOID ServiceContext)
/*
* FUNCTION: Interrupt service routine
* ARGUMENTS:
* Interrupt = Pointer to interrupt object
* ServiceContext = Pointer to context information (PNDIS_MINIPORT_INTERRUPT)
* RETURNS
* TRUE if a miniport controlled device generated the interrupt
*/
{
BOOLEAN InterruptRecognized = FALSE;
BOOLEAN QueueMiniportHandleInterrupt = FALSE;
PNDIS_MINIPORT_INTERRUPT NdisInterrupt = ServiceContext;
PNDIS_MINIPORT_BLOCK NdisMiniportBlock = NdisInterrupt->Miniport;
BOOLEAN Initializing;
NDIS_DbgPrint(MAX_TRACE, ("Called. Interrupt (0x%X)\n", NdisInterrupt));
/* Certain behavior differs if MiniportInitialize is executing when the interrupt is generated */
Initializing = (NdisMiniportBlock->PnPDeviceState != NdisPnPDeviceStarted);
NDIS_DbgPrint(MAX_TRACE, ("MiniportInitialize executing: %s\n", (Initializing ? "yes" : "no")));
/* MiniportISR is always called for interrupts during MiniportInitialize */
if ((Initializing) || (NdisInterrupt->IsrRequested) || (NdisInterrupt->SharedInterrupt)) {
NDIS_DbgPrint(MAX_TRACE, ("Calling MiniportISR\n"));
(*NdisMiniportBlock->DriverHandle->MiniportCharacteristics.ISRHandler)(
&InterruptRecognized,
&QueueMiniportHandleInterrupt,
NdisMiniportBlock->MiniportAdapterContext);
} else if (NdisMiniportBlock->DriverHandle->MiniportCharacteristics.DisableInterruptHandler) {
NDIS_DbgPrint(MAX_TRACE, ("Calling MiniportDisableInterrupt\n"));
(*NdisMiniportBlock->DriverHandle->MiniportCharacteristics.DisableInterruptHandler)(
NdisMiniportBlock->MiniportAdapterContext);
QueueMiniportHandleInterrupt = TRUE;
InterruptRecognized = TRUE;
}
/* TODO: Figure out if we should call this or not if Initializing is true. It appears
* that calling it fixes some NICs, but documentation is contradictory on it. */
if (QueueMiniportHandleInterrupt)
{
NDIS_DbgPrint(MAX_TRACE, ("Queuing DPC.\n"));
KeInsertQueueDpc(&NdisInterrupt->InterruptDpc, NULL, NULL);
}
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
return InterruptRecognized;
}