本文整理汇总了C++中KeBugCheck函数的典型用法代码示例。如果您正苦于以下问题:C++ KeBugCheck函数的具体用法?C++ KeBugCheck怎么用?C++ KeBugCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KeBugCheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KeStopSchedulingProcess
///////////////////////////////////////////////////////////////////////////////
//
// KeStopSchedulingProcess
//
// Stops scheduling specified process.
//
STATUS
KeStopSchedulingProcess(
PPROCESS Process
)
{
ASSERT(Process);
//
// determine in which list the process is located
//
switch (Process->State) {
case running:
//
// mark as blocked so that it won't get scheduled again
//
Process->State = blocked;
//
// choose a different process to run
//
KepReschedule();
break;
case ready:
// in a ready queue
KepDequeueProcess(Process);
break;
case blocked:
// in a blocked list
if (!KepRemoveFromProcessList(&KepTimerList, Process)
&& !KepRemoveFromProcessList(&KepBlockedList, Process)) {
KeBugCheck("KeStopSchedulingProcess: process blocked, but in no blocked queue");
}
break;
default:
KeBugCheck("KeStopSchedulingProcess: unhandled process state");
}
//
// object no longer in our queues -> dereference
//
ObDereferenceObject(Process);
return STATUS_SUCCESS;
}
示例2: co_os_free_pages
void co_os_free_pages(void *ptr, unsigned int pages)
{
if (ptr == 0)
KeBugCheck(0x11117777 + 1);
if (pages == 0)
KeBugCheck(0x11117777 + 2);
#ifdef DEBUG_CO_OS_ALLOC
co_debug_allocations("PAGE FREE %d(%u) - %p", allocs, pages, ptr);
allocs--;
#endif
MmFreeNonCachedMemory(ptr, pages * CO_ARCH_PAGE_SIZE);
}
示例3: WRITE_REGISTER_ULONG
VOID
WRITE_REGISTER_ULONG(
volatile PULONG Register,
ULONG Value
)
/*++
Routine Description:
Write to the specified register address.
Arguments:
Register - Supplies a pointer to the register in EISA I/O space.
Value - The value to be written to the register.
Return Value:
None
--*/
{
//
// We are assuming that the longword is aligned
//
ASSERT(((ULONG)Register & 0x3) == 0x0);
if (IS_EISA_QVA(Register)) {
*(volatile PULONG)(EISA_LONG_LEN |
((ULONG)Register << EISA_BIT_SHIFT)) = Value;
HalpMb;
return;
}
//
// ULONG operations are not supported on the combo chip
//
if (IS_COMBO_QVA(Register)) {
KeBugCheck("Invalid Combo QVA in WRITE_REGISTER_ULONG\n");
}
KeBugCheck("Invalid QVA in WRITE_REGISTER_ULONG\n");
}
示例4: StackedMemoryAllFree
/** Reverses all operations recorded in the stacked memory object.
*
* Reversing an operation means freeing memory the operation had allocated.
*
* @param StackedMemory Stacked memory object.
*
* @remark
* If the stacked memory object contains no operation records, nothing happens.
*/
VOID StackedMemoryAllFree(PUTILS_STACK StackedMemory)
{
PUTILS_STACK_ITEM stackItem = NULL;
PUTILS_STACKED_MEMORY_RECORD stackRecord = NULL;
DEBUG_ENTER_FUNCTION("StackedMemory=0x%p", StackedMemory);
while (!StackEmpty(StackedMemory)) {
stackItem = StackPopNoFree(StackedMemory);
stackRecord = CONTAINING_RECORD(stackItem, UTILS_STACKED_MEMORY_RECORD, StackItem);
switch (stackRecord->AllocType) {
case smatHeap:
HeapMemoryFree(stackRecord->Address);
break;
case smatVirtual:
VirtualMemoryFreeUser(stackRecord->Address);
break;
default:
DEBUG_ERROR("Invalid stacked memory record type (%u)", stackRecord->AllocType);
KeBugCheck(0);
break;
}
HeapMemoryFree(stackRecord);
}
DEBUG_EXIT_FUNCTION_VOID();
return;
}
示例5: MmMpwThreadMain
NTSTATUS NTAPI
MmMpwThreadMain(PVOID Ignored)
{
NTSTATUS Status;
ULONG PagesWritten;
LARGE_INTEGER Timeout;
Timeout.QuadPart = -50000000;
for(;;)
{
Status = KeWaitForSingleObject(&MpwThreadEvent,
0,
KernelMode,
FALSE,
&Timeout);
if (!NT_SUCCESS(Status))
{
DbgPrint("MpwThread: Wait failed\n");
KeBugCheck(MEMORY_MANAGEMENT);
return(STATUS_UNSUCCESSFUL);
}
PagesWritten = 0;
#ifndef NEWCC
// XXX arty -- we flush when evicting pages or destorying cache
// sections.
CcRosFlushDirtyPages(128, &PagesWritten);
#endif
}
}
示例6: MmRebalanceMemoryConsumers
VOID
NTAPI
MmRebalanceMemoryConsumers(VOID)
{
LONG Target;
ULONG i;
ULONG NrFreedPages;
NTSTATUS Status;
Target = (MiMinimumAvailablePages - MmAvailablePages) + MiPagesRequired;
Target = max(Target, (LONG) MiMinimumPagesPerRun);
for (i = 0; i < MC_MAXIMUM && Target > 0; i++)
{
if (MiMemoryConsumers[i].Trim != NULL)
{
Status = MiMemoryConsumers[i].Trim(Target, 0, &NrFreedPages);
if (!NT_SUCCESS(Status))
{
KeBugCheck(MEMORY_MANAGEMENT);
}
Target = Target - NrFreedPages;
}
}
}
示例7: KiSetAffinityThread
KAFFINITY
FASTCALL
KiSetAffinityThread(IN PKTHREAD Thread,
IN KAFFINITY Affinity)
{
KAFFINITY OldAffinity;
/* Get the current affinity */
OldAffinity = Thread->UserAffinity;
/* Make sure that the affinity is valid */
if (((Affinity & Thread->ApcState.Process->Affinity) != (Affinity)) ||
(!Affinity))
{
/* Bugcheck the system */
KeBugCheck(INVALID_AFFINITY_SET);
}
/* Update the new affinity */
Thread->UserAffinity = Affinity;
/* Check if system affinity is disabled */
if (!Thread->SystemAffinityActive)
{
#ifdef CONFIG_SMP
/* FIXME: TODO */
DPRINT1("Affinity support disabled!\n");
#endif
}
/* Return the old affinity */
return OldAffinity;
}
示例8: KepDequeueProcess
///////////////////////////////////////////////////////////////////////////////
//
// KepDequeueProcess
//
// Removes a process from the ready queue.
//
VOID
KepDequeueProcess(
PPROCESS Process
)
{
PPROCESS currentProcess;
ASSERT(Process->Priority < PROCESS_PRIORITY_LEVELS);
currentProcess = KepReadyQueues[Process->Priority].First;
//
// handle special case when Process is the first in the queue
//
if (currentProcess == Process) {
//
// (if the process was the only one in the queue, it's NextPCB is NULL
// and that's enough for us - no need to check for this special case)
//
KepReadyQueues[Process->Priority].First = currentProcess->NextPCB;
currentProcess->NextPCB = NULL;
return;
}
//
// find the process in the queue
//
while (currentProcess->NextPCB) {
if (currentProcess->NextPCB == Process) {
//
// unlink process from the list
//
currentProcess->NextPCB = Process->NextPCB;
//
// handle special case when this process was the last on the list
//
if (KepReadyQueues[Process->Priority].Last == Process) {
KepReadyQueues[Process->Priority].Last = currentProcess;
}
Process->NextPCB = NULL;
return;
}
//
// move to the next queue entry
//
currentProcess = currentProcess->NextPCB;
}
KeBugCheck("KepDequeueProcess: process is not in the priority queue");
}
示例9: MiTrimMemoryConsumer
ULONG
NTAPI
MiTrimMemoryConsumer(ULONG Consumer, ULONG InitialTarget)
{
ULONG Target = InitialTarget;
ULONG NrFreedPages = 0;
NTSTATUS Status;
/* Make sure we can trim this consumer */
if (!MiMemoryConsumers[Consumer].Trim)
{
/* Return the unmodified initial target */
return InitialTarget;
}
if (MiMemoryConsumers[Consumer].PagesUsed > MiMemoryConsumers[Consumer].PagesTarget)
{
/* Consumer page limit exceeded */
Target = max(Target, MiMemoryConsumers[Consumer].PagesUsed - MiMemoryConsumers[Consumer].PagesTarget);
}
if (MmAvailablePages < MiMinimumAvailablePages)
{
/* Global page limit exceeded */
Target = (ULONG)max(Target, MiMinimumAvailablePages - MmAvailablePages);
}
if (Target)
{
if (!InitialTarget)
{
/* If there was no initial target,
* swap at least MiMinimumPagesPerRun */
Target = max(Target, MiMinimumPagesPerRun);
}
/* Now swap the pages out */
Status = MiMemoryConsumers[Consumer].Trim(Target, 0, &NrFreedPages);
DPRINT("Trimming consumer %lu: Freed %lu pages with a target of %lu pages\n", Consumer, NrFreedPages, Target);
if (!NT_SUCCESS(Status))
{
KeBugCheck(MEMORY_MANAGEMENT);
}
/* Update the target */
if (NrFreedPages < Target)
Target -= NrFreedPages;
else
Target = 0;
/* Return the remaining pages needed to meet the target */
return Target;
}
else
{
/* Initial target is zero and we don't have anything else to add */
return 0;
}
}
示例10: KeResumeProcess
///////////////////////////////////////////////////////////////////////////////
//
// KeResumeProcess
//
// Moves process from the blocked or sleeping list to the ready queue
// and changes it's state to ready.
//
VOID
KeResumeProcess(
PPROCESS Process
)
{
ASSERT(Process);
ASSERT(Process->State == blocked);
if (Process->ResumeMethod)
Process->ResumeMethod(Process);
//
// remove process from the blocked list
//
if (!KepRemoveFromProcessList(&KepTimerList, Process)
&& !KepRemoveFromProcessList(&KepBlockedList, Process)) {
KeBugCheck("KeResumeProcess: process blocked, but in no blocked queue");
}
//
// add process to the scheduling queue
//
KepEnqueueProcess(Process);
//
// reschedule if this process has higher priority than the current process
//
if (Process->Priority > KeCurrentProcess->Priority) {
KepReschedule();
}
}
示例11: KeChangeProcessPriority
///////////////////////////////////////////////////////////////////////////////
//
// KeChangeProcessPriority
//
// Changes the priority of specified process.
//
VOID
KeChangeProcessPriority(
PPROCESS Process,
ULONG NewPriority
)
{
ASSERT(Process);
ASSERT(NewPriority < PROCESS_PRIORITY_LEVELS);
switch (Process->State) {
case running:
case blocked:
Process->Priority = NewPriority;
break;
case ready:
KepDequeueProcess(Process);
Process->Priority = NewPriority;
KepEnqueueProcess(Process);
break;
default:
KeBugCheck("KeChangeProcessPriority: unhandled process state");
}
}
示例12: PspSystemThreadStartup
VOID
NTAPI
PspSystemThreadStartup(IN PKSTART_ROUTINE StartRoutine,
IN PVOID StartContext)
{
PETHREAD Thread;
PSTRACE(PS_THREAD_DEBUG,
"StartRoutine: %p StartContext: %p\n", StartRoutine, StartContext);
/* Unlock the dispatcher Database */
KeLowerIrql(PASSIVE_LEVEL);
Thread = PsGetCurrentThread();
/* Make sure the thread isn't gone */
_SEH2_TRY
{
if (!(Thread->Terminated) && !(Thread->DeadThread))
{
/* Call the Start Routine */
StartRoutine(StartContext);
}
}
_SEH2_EXCEPT(PspUnhandledExceptionInSystemThread(_SEH2_GetExceptionInformation()))
{
/* Bugcheck if we got here */
KeBugCheck(KMODE_EXCEPTION_NOT_HANDLED);
}
_SEH2_END;
/* Exit the thread */
PspTerminateThreadByPointer(Thread, STATUS_SUCCESS, TRUE);
}
示例13: CcScheduleReadAhead
VOID
NTAPI
CcScheduleReadAhead(IN PFILE_OBJECT FileObject,
IN PLARGE_INTEGER FileOffset,
IN ULONG Length)
{
PWORK_QUEUE_WITH_READ_AHEAD WorkItem;
DPRINT("Schedule read ahead %08x%08x:%x %wZ\n",
FileOffset->HighPart,
FileOffset->LowPart,
Length,
&FileObject->FileName);
WorkItem = ExAllocatePool(NonPagedPool, sizeof(*WorkItem));
if (!WorkItem) KeBugCheck(0);
ObReferenceObject(FileObject);
WorkItem->FileObject = FileObject;
WorkItem->FileOffset = *FileOffset;
WorkItem->Length = Length;
ExInitializeWorkItem(((PWORK_QUEUE_ITEM)WorkItem),
(PWORKER_THREAD_ROUTINE)CcpReadAhead,
WorkItem);
ExQueueWorkItem((PWORK_QUEUE_ITEM)WorkItem, DelayedWorkQueue);
DPRINT("Done\n");
}
示例14: FsRtlInitializeTunnelCache
/*++
* @name FsRtlDeleteTunnelCache
* @unimplemented
*
* FILLME
*
* @param Cache
* FILLME
*
* @return None
*
* @remarks None
*
*--*/
VOID
NTAPI
FsRtlInitializeTunnelCache(IN PTUNNEL Cache)
{
/* Unimplemented */
KeBugCheck(FILE_SYSTEM);
}
示例15: HashTableUnlock
/** Unlocks a given bucket of a general hash table.
*
* @param Table A hash table the bucket of which is to be unlocked.
* @param Index A zero-based index of the bucked to unlock.
* @param Irql A value of IRQL the caller had been running before the table
* was locked. The parameter is ignored for passive IRQL tables and tables access
* to whom is not synchronized.
*
* @remark
* If access to the table is not synchronized, the routine performs nothing.
*
* The @link(HASH_TABLE_IRQL_VALIDATE) is used to check whether the caller
* runs at a valid IRQL.
*/
static VOID HashTableUnlock(PHASH_TABLE Table, ULONG32 Index, KIRQL Irql)
{
HASH_TABLE_IRQL_VALIDATE(Table);
ASSERT(Index < Table->Size);
switch (Table->Type) {
case httPassiveLevel:
ExReleaseResourceLite(&Table->Locks[Index]);
KeLeaveCriticalRegion();
break;
case httDispatchLevel:
if (Table->DispatchLockExclusive[Index]) {
Table->DispatchLockExclusive[Index] = FALSE;
KeReleaseSpinLock(&Table->DispatchLocks[Index], Irql);
} else {
KeReleaseSpinLock(&Table->DispatchLocks[Index], Irql);
}
break;
case httNoSynchronization:
break;
default:
DEBUG_ERROR("Invalid hash table type: %u", Table->Type);
KeBugCheck(0);
break;
}
return;
}