ULONG KiHardwareTrigger;
PUNICODE_STRING KiBugCheckDriver;
ULONG_PTR KiBugCheckData[5];
-PKNMI_HANDLER_CALLBACK KiNmiCallbackListHead;
+
+PKNMI_HANDLER_CALLBACK KiNmiCallbackListHead = NULL;
KSPIN_LOCK KiNmiCallbackListLock;
+#define TAG_KNMI 'IMNK'
/* Bugzilla Reporting */
UNICODE_STRING KeRosProcessorName, KeRosBiosDate, KeRosBiosVersion;
i++;
/* Check if this is a kernel entry and we only want drivers */
- if ((i <= 2) && (DriversOnly == TRUE))
+ if ((i <= 2) && (DriversOnly != FALSE))
{
/* Skip it */
NextEntry = NextEntry->Flink;
return PcBase;
}
-BOOLEAN
-NTAPI
-KiRosPrintAddress(PVOID address)
-{
- PLIST_ENTRY current_entry;
- PLDR_DATA_TABLE_ENTRY current;
- extern LIST_ENTRY PsLoadedModuleList;
- ULONG_PTR RelativeAddress;
- ULONG i = 0;
-
- do
- {
- current_entry = PsLoadedModuleList.Flink;
-
- while (current_entry != &PsLoadedModuleList)
- {
- current = CONTAINING_RECORD(current_entry,
- LDR_DATA_TABLE_ENTRY,
- InLoadOrderLinks);
-
- if (address >= (PVOID)current->DllBase &&
- address < (PVOID)((ULONG_PTR)current->DllBase +
- current->SizeOfImage))
- {
- RelativeAddress = (ULONG_PTR)address -
- (ULONG_PTR)current->DllBase;
- DbgPrint("<%wZ: %x>", ¤t->FullDllName, RelativeAddress);
- return(TRUE);
- }
- current_entry = current_entry->Flink;
- }
- } while(++i <= 1);
-
- return(FALSE);
-}
-
PVOID
NTAPI
KiRosPcToUserFileHeader(IN PVOID Pc,
if (!KdbSymPrintAddress((PVOID)Addr, NULL))
#endif
{
- /* Print out the module name */
+ CHAR AnsiName[64];
+
+ /* Convert module name to ANSI and print it */
+ KeBugCheckUnicodeToAnsi(&LdrEntry->BaseDllName,
+ AnsiName,
+ sizeof(AnsiName));
Addr -= (ULONG_PTR)LdrEntry->DllBase;
- DbgPrint("<%wZ: %p>", &LdrEntry->FullDllName, (PVOID)Addr);
+ DbgPrint("<%s: %p>", AnsiName, (PVOID)Addr);
}
}
else
{
/* Get the current frames (skip the two. One for the dumper, one for the caller) */
RealFrameCount = RtlCaptureStackBackTrace(2, FrameCount, (PVOID*)Frames, NULL);
+ DPRINT1("RealFrameCount =%lu\n", RealFrameCount);
/* Dump them */
KeRosDumpStackFrameArray(Frames, RealFrameCount);
extern ULONG KeI386MachineType, MxcsrFeatureMask;
extern BOOLEAN Ke386Pae, Ke386NoExecute;
- DbgPrint("ReactOS has crashed! Please go to http://www.reactos.org/bugzilla/enter_bug.cgi to file a bug!\n");
+ DbgPrint("ReactOS has crashed! Please go to http://jira.reactos.org/ to file a bug!\n");
DbgPrint("\nHardware Information\n");
DbgPrint("Processor Architecture: %d\n"
"Feature Bits: %d\n"
/* Format driver name */
sprintf(Message,
- "%s** %12s - Address %p base at %p, DateStamp %08lx\n",
+ "%s** %12s - Address %p base at %p, DateStamp %08lx\r\n",
FirstRun ? "\r\n*":"*",
AnsiName,
(PVOID)Parameters[i],
/* Show the technical Data */
sprintf(AnsiName,
"\r\n\r\n*** STOP: 0x%08lX (0x%p,0x%p,0x%p,0x%p)\r\n\r\n",
- KiBugCheckData[0],
+ (ULONG)KiBugCheckData[0],
(PVOID)KiBugCheckData[1],
(PVOID)KiBugCheckData[2],
(PVOID)KiBugCheckData[3],
FALSE,
&IsSystem);
}
+ else
+ {
+ /* Can't blame a driver, assume system */
+ IsSystem = TRUE;
+ }
- /*
- * Now we should check if this happened in:
- * 1) Special Pool 2) Free Special Pool 3) Session Pool
- * and update the bugcheck code appropriately.
- */
+ /* FIXME: Check for session pool in addition to special pool */
- /* Check if we didn't have a driver base */
- if (!DriverBase)
+ /* Special pool has its own bug check codes */
+ if (MmIsSpecialPoolAddress((PVOID)BugCheckParameter1))
+ {
+ if (MmIsSpecialPoolAddressFree((PVOID)BugCheckParameter1))
+ {
+ KiBugCheckData[0] = IsSystem
+ ? PAGE_FAULT_IN_FREED_SPECIAL_POOL
+ : DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL;
+ }
+ else
+ {
+ KiBugCheckData[0] = IsSystem
+ ? PAGE_FAULT_BEYOND_END_OF_ALLOCATION
+ : DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION;
+ }
+ }
+ else if (!DriverBase)
{
/* Find the driver that unloaded at this address */
KiBugCheckDriver = NULL; // FIXME: ROS can't locate
KiBugCheckDebugBreak(DBG_STATUS_BUGCHECK_SECOND);
/* Shouldn't get here */
+ ASSERT(FALSE);
while (TRUE);
}
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Allocate NMI callback data */
- NmiData = ExAllocatePoolWithTag(NonPagedPool,
- sizeof(KNMI_HANDLER_CALLBACK),
- 'IMNK');
+ NmiData = ExAllocatePoolWithTag(NonPagedPool, sizeof(*NmiData), TAG_KNMI);
if (!NmiData) return NULL;
/* Fill in the information */
*/
NTSTATUS
NTAPI
-KeDeregisterNmiCallback(PVOID Handle)
+KeDeregisterNmiCallback(IN PVOID Handle)
{
- UNIMPLEMENTED;
- return STATUS_UNSUCCESSFUL;
+ KIRQL OldIrql;
+ PKNMI_HANDLER_CALLBACK NmiData;
+ PKNMI_HANDLER_CALLBACK* Previous;
+ ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
+
+ /* Find in the list the NMI callback corresponding to the handle */
+ KiAcquireNmiListLock(&OldIrql);
+ Previous = &KiNmiCallbackListHead;
+ NmiData = *Previous;
+ while (NmiData)
+ {
+ if (NmiData->Handle == Handle)
+ {
+ /* The handle is the pointer to the callback itself */
+ ASSERT(Handle == NmiData);
+
+ /* Found it, remove from the list */
+ *Previous = NmiData->Next;
+ break;
+ }
+
+ /* Not found; try again */
+ Previous = &NmiData->Next;
+ NmiData = *Previous;
+ }
+ KiReleaseNmiListLock(OldIrql);
+
+ /* If we have found the entry, free it */
+ if (NmiData)
+ {
+ ExFreePoolWithTag(NmiData, TAG_KNMI);
+ return STATUS_SUCCESS;
+ }
+
+ return STATUS_INVALID_HANDLE;
}
/*
IN ULONG_PTR BugCheckParameter3,
IN ULONG_PTR BugCheckParameter4)
{
- /* Workaround for Windows Server 2003 Checked PCI Driver issue */
- if (!((BugCheckCode == PCI_BUS_DRIVER_INTERNAL) &&
- (BugCheckParameter1 == 0xDEAD0010)))
- {
- /* Call the internal API */
- KeBugCheckWithTf(BugCheckCode,
- BugCheckParameter1,
- BugCheckParameter2,
- BugCheckParameter3,
- BugCheckParameter4,
- NULL);
- }
+ /* Call the internal API */
+ KeBugCheckWithTf(BugCheckCode,
+ BugCheckParameter1,
+ BugCheckParameter2,
+ BugCheckParameter3,
+ BugCheckParameter4,
+ NULL);
}
/*