ReactOS 0.4.15-dev-5874-gc762234
bug.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ke/bug.c
5 * PURPOSE: Bugcheck Support
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <ntoskrnl.h>
12
13#define NDEBUG
14#include <debug.h>
15
16/* GLOBALS *******************************************************************/
17
28
31
32/* Bugzilla Reporting */
35
36/* PRIVATE FUNCTIONS *********************************************************/
37
41 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry,
42 IN BOOLEAN DriversOnly,
43 OUT PBOOLEAN InKernel)
44{
45 ULONG i = 0;
46 PVOID ImageBase, PcBase = NULL;
48 PLIST_ENTRY ListHead, NextEntry;
49
50 /* Check which list we should use */
53
54 /* Assume no */
55 *InKernel = FALSE;
56
57 /* Set list pointers and make sure it's valid */
58 NextEntry = ListHead->Flink;
59 if (NextEntry)
60 {
61 /* Start loop */
62 while (NextEntry != ListHead)
63 {
64 /* Increase entry */
65 i++;
66
67 /* Check if this is a kernel entry and we only want drivers */
68 if ((i <= 2) && (DriversOnly != FALSE))
69 {
70 /* Skip it */
71 NextEntry = NextEntry->Flink;
72 continue;
73 }
74
75 /* Get the loader entry */
76 Entry = CONTAINING_RECORD(NextEntry,
78 InLoadOrderLinks);
79
80 /* Move to the next entry */
81 NextEntry = NextEntry->Flink;
82 ImageBase = Entry->DllBase;
83
84 /* Check if this is the right one */
85 if (((ULONG_PTR)Pc >= (ULONG_PTR)Entry->DllBase) &&
86 ((ULONG_PTR)Pc < ((ULONG_PTR)Entry->DllBase + Entry->SizeOfImage)))
87 {
88 /* Return this entry */
89 *LdrEntry = Entry;
90 PcBase = ImageBase;
91
92 /* Check if this was a kernel or HAL entry */
93 if (i <= 2) *InKernel = TRUE;
94 break;
95 }
96 }
97 }
98
99 /* Return the base address */
100 return PcBase;
101}
102
103PVOID
104NTAPI
106 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
107{
108 PVOID ImageBase, PcBase = NULL;
110 PLIST_ENTRY ListHead, NextEntry;
111
112 /*
113 * We know this is valid because we should only be called after a
114 * succesfull address from RtlWalkFrameChain for UserMode, which
115 * validates everything for us.
116 */
117 ListHead = &KeGetCurrentThread()->
118 Teb->ProcessEnvironmentBlock->Ldr->InLoadOrderModuleList;
119
120 /* Set list pointers and make sure it's valid */
121 NextEntry = ListHead->Flink;
122 if (NextEntry)
123 {
124 /* Start loop */
125 while (NextEntry != ListHead)
126 {
127 /* Get the loader entry */
128 Entry = CONTAINING_RECORD(NextEntry,
130 InLoadOrderLinks);
131
132 /* Move to the next entry */
133 NextEntry = NextEntry->Flink;
134 ImageBase = Entry->DllBase;
135
136 /* Check if this is the right one */
137 if (((ULONG_PTR)Pc >= (ULONG_PTR)Entry->DllBase) &&
138 ((ULONG_PTR)Pc < ((ULONG_PTR)Entry->DllBase + Entry->SizeOfImage)))
139 {
140 /* Return this entry */
141 *LdrEntry = Entry;
142 PcBase = ImageBase;
143 break;
144 }
145 }
146 }
147
148 /* Return the base address */
149 return PcBase;
150}
151
152USHORT
153NTAPI
156 OUT PVOID *BackTrace,
158{
159 PVOID Frames[2 * 64];
160 ULONG FrameCount;
161 ULONG Hash = 0, i;
162
163 /* Skip a frame for the caller */
164 FramesToSkip++;
165
166 /* Don't go past the limit */
167 if ((FramesToCapture + FramesToSkip) >= 128) return 0;
168
169 /* Do the back trace */
170 FrameCount = RtlWalkFrameChain(Frames, FramesToCapture + FramesToSkip, 1);
171
172 /* Make sure we're not skipping all of them */
173 if (FrameCount <= FramesToSkip) return 0;
174
175 /* Loop all the frames */
176 for (i = 0; i < FramesToCapture; i++)
177 {
178 /* Don't go past the limit */
179 if ((FramesToSkip + i) >= FrameCount) break;
180
181 /* Save this entry and hash it */
182 BackTrace[i] = Frames[FramesToSkip + i];
183 Hash += PtrToUlong(BackTrace[i]);
184 }
185
186 /* Write the hash */
188
189 /* Clear the other entries and return count */
190 RtlFillMemoryUlong(Frames, 128, 0);
191 return (USHORT)i;
192}
193
194
195VOID
198 IN ULONG FrameCount)
199{
200 ULONG i;
201 ULONG_PTR Addr;
202 BOOLEAN InSystem;
203 PVOID p;
204
205 /* GCC complaints that it may be used uninitialized */
206 PLDR_DATA_TABLE_ENTRY LdrEntry = NULL;
207
208 /* Loop them */
209 for (i = 0; i < FrameCount; i++)
210 {
211 /* Get the EIP */
212 Addr = Frames[i];
213 if (!Addr)
214 {
215 break;
216 }
217
218 /* Get the base for this file */
220 {
221 /* We are in kernel */
222 p = KiPcToFileHeader((PVOID)Addr, &LdrEntry, FALSE, &InSystem);
223 }
224 else
225 {
226 /* We are in user land */
227 p = KiRosPcToUserFileHeader((PVOID)Addr, &LdrEntry);
228 }
229 if (p)
230 {
231#ifdef KDBG
232 if (!KdbSymPrintAddress((PVOID)Addr, NULL))
233#endif
234 {
235 CHAR AnsiName[64];
236
237 /* Convert module name to ANSI and print it */
239 AnsiName,
240 sizeof(AnsiName));
241 Addr -= (ULONG_PTR)LdrEntry->DllBase;
242 DbgPrint("<%s: %p>", AnsiName, (PVOID)Addr);
243 }
244 }
245 else
246 {
247 /* Print only the address */
248 DbgPrint("<%p>", (PVOID)Addr);
249 }
250
251 /* Go to the next frame */
252 DbgPrint("\n");
253 }
254}
255
256VOID
257NTAPI
259 IN ULONG FrameCount OPTIONAL)
260{
261 ULONG_PTR Frames[32];
262 ULONG RealFrameCount;
263
264 /* If the caller didn't ask, assume 32 frames */
265 if (!FrameCount || FrameCount > 32) FrameCount = 32;
266
267 if (Frame)
268 {
269 /* Dump them */
270 KeRosDumpStackFrameArray(Frame, FrameCount);
271 }
272 else
273 {
274 /* Get the current frames (skip the two. One for the dumper, one for the caller) */
275 RealFrameCount = RtlCaptureStackBackTrace(2, FrameCount, (PVOID*)Frames, NULL);
276 DPRINT1("RealFrameCount =%lu\n", RealFrameCount);
277
278 /* Dump them */
279 KeRosDumpStackFrameArray(Frames, RealFrameCount);
280
281 /* Count left for user mode? */
282 if (FrameCount - RealFrameCount > 0)
283 {
284 /* Get the current frames */
285 RealFrameCount = KeRosCaptureUserStackBackTrace(-1, FrameCount - RealFrameCount, (PVOID*)Frames, NULL);
286
287 /* Dump them */
288 KeRosDumpStackFrameArray(Frames, RealFrameCount);
289 }
290 }
291}
292
293CODE_SEG("INIT")
294VOID
295NTAPI
297{
299 LDR_RESOURCE_INFO ResourceInfo;
300 PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry;
302 PLDR_DATA_TABLE_ENTRY LdrEntry;
303
304 /* Get the kernel entry */
307 InLoadOrderLinks);
308
309 /* Cache the Bugcheck Message Strings. Prepare the Lookup Data */
310 ResourceInfo.Type = 11;
311 ResourceInfo.Name = 1;
312 ResourceInfo.Language = 9;
313
314 /* Do the lookup. */
315 Status = LdrFindResource_U(LdrEntry->DllBase,
316 &ResourceInfo,
318 &ResourceDataEntry);
319
320 /* Make sure it worked */
321 if (NT_SUCCESS(Status))
322 {
323 /* Now actually get a pointer to it */
324 Status = LdrAccessResource(LdrEntry->DllBase,
325 ResourceDataEntry,
327 NULL);
329 }
330}
331
333NTAPI
335 OUT PANSI_STRING OutputString OPTIONAL)
336{
337 ULONG i;
338 ULONG IdOffset;
339 PMESSAGE_RESOURCE_ENTRY MessageEntry;
340 PCHAR BugCode;
343
344 /* Make sure we're not bugchecking too early */
345 if (!KiBugCodeMessages) return Result;
346
347 /*
348 * Globally protect in SEH as we are trying to access data in
349 * dire situations, and potentially going to patch it (see below).
350 */
352 {
353
354 /*
355 * Make the kernel resource section writable, as we are going to manually
356 * trim the trailing newlines in the bugcheck resource message in place,
357 * when OutputString is NULL and before displaying it on screen.
358 */
360
361 /* Find the message. This code is based on RtlFindMesssage */
362 for (i = 0; i < KiBugCodeMessages->NumberOfBlocks; i++)
363 {
364 /* Check if the ID matches */
365 if ((BugCheckCode >= KiBugCodeMessages->Blocks[i].LowId) &&
366 (BugCheckCode <= KiBugCodeMessages->Blocks[i].HighId))
367 {
368 /* Get offset to entry */
369 MessageEntry = (PMESSAGE_RESOURCE_ENTRY)
371 IdOffset = BugCheckCode - KiBugCodeMessages->Blocks[i].LowId;
372
373 /* Advance in the entries until finding it */
374 while (IdOffset--)
375 {
376 MessageEntry = (PMESSAGE_RESOURCE_ENTRY)
377 ((ULONG_PTR)MessageEntry + MessageEntry->Length);
378 }
379
380 /* Make sure it's not Unicode */
381 ASSERT(!(MessageEntry->Flags & MESSAGE_RESOURCE_UNICODE));
382
383 /* Get the final code */
384 BugCode = (PCHAR)MessageEntry->Text;
385 Length = (USHORT)strlen(BugCode);
386
387 /* Handle trailing newlines */
388 while ((Length > 0) && ((BugCode[Length - 1] == '\n') ||
389 (BugCode[Length - 1] == '\r') ||
390 (BugCode[Length - 1] == ANSI_NULL)))
391 {
392 /* Directly trim the newline in place if we don't return the string */
393 if (!OutputString) BugCode[Length - 1] = ANSI_NULL;
394
395 /* Skip the trailing newline */
396 Length--;
397 }
398
399 /* Check if caller wants an output string */
400 if (OutputString)
401 {
402 /* Return it in the OutputString */
403 OutputString->Buffer = BugCode;
404 OutputString->Length = Length;
405 OutputString->MaximumLength = Length;
406 }
407 else
408 {
409 /* Direct output to screen */
410 InbvDisplayString(BugCode);
411 InbvDisplayString("\r");
412 }
413
414 /* We're done */
415 Result = TRUE;
416 break;
417 }
418 }
419
420 }
422 {
423 }
424 _SEH2_END;
425
426 /* Return the result */
427 return Result;
428}
429
430VOID
431NTAPI
433{
434 PKBUGCHECK_CALLBACK_RECORD CurrentRecord;
435 PLIST_ENTRY ListHead, NextEntry, LastEntry;
436 ULONG_PTR Checksum;
437
438 /* First make sure that the list is initialized... it might not be */
439 ListHead = &KeBugcheckCallbackListHead;
440 if ((!ListHead->Flink) || (!ListHead->Blink))
441 return;
442
443 /* Loop the list */
444 LastEntry = ListHead;
445 NextEntry = ListHead->Flink;
446 while (NextEntry != ListHead)
447 {
448 /* Get the reord */
449 CurrentRecord = CONTAINING_RECORD(NextEntry,
451 Entry);
452
453 /* Validate it */
454 // TODO/FIXME: Check whether the memory CurrentRecord points to
455 // is still accessible and valid!
456 if (CurrentRecord->Entry.Blink != LastEntry) return;
457 Checksum = (ULONG_PTR)CurrentRecord->CallbackRoutine;
458 Checksum += (ULONG_PTR)CurrentRecord->Buffer;
459 Checksum += (ULONG_PTR)CurrentRecord->Length;
460 Checksum += (ULONG_PTR)CurrentRecord->Component;
461
462 /* Make sure it's inserted and validated */
463 if ((CurrentRecord->State == BufferInserted) &&
464 (CurrentRecord->Checksum == Checksum))
465 {
466 /* Call the routine */
467 CurrentRecord->State = BufferStarted;
469 {
470 (CurrentRecord->CallbackRoutine)(CurrentRecord->Buffer,
471 CurrentRecord->Length);
472 CurrentRecord->State = BufferFinished;
473 }
475 {
476 CurrentRecord->State = BufferIncomplete;
477 }
478 _SEH2_END;
479 }
480
481 /* Go to the next entry */
482 LastEntry = NextEntry;
483 NextEntry = NextEntry->Flink;
484 }
485}
486
487VOID
488NTAPI
490{
491 /*
492 * Wrap this in SEH so we don't crash if
493 * there is no debugger or if it disconnected
494 */
495DoBreak:
497 {
498 /* Breakpoint */
499 DbgBreakPointWithStatus(StatusCode);
500 }
502 {
503 /* No debugger, halt the CPU */
505 }
506 _SEH2_END;
507
508 /* Break again if this wasn't first try */
509 if (StatusCode != DBG_STATUS_BUGCHECK_FIRST) goto DoBreak;
510}
511
512PCHAR
513NTAPI
515 OUT PCHAR Ansi,
517{
518 PCHAR p;
519 PWCHAR pw;
520 ULONG i;
521
522 /* Set length and normalize it */
523 i = Unicode->Length / sizeof(WCHAR);
524 i = min(i, Length - 1);
525
526 /* Set source and destination, and copy */
527 pw = Unicode->Buffer;
528 p = Ansi;
529 while (i--) *p++ = (CHAR)*pw++;
530
531 /* Null terminate and return */
532 *p = ANSI_NULL;
533 return Ansi;
534}
535
536VOID
537NTAPI
540 IN ULONG ParameterCount,
541 IN PKE_BUGCHECK_UNICODE_TO_ANSI ConversionRoutine)
542{
543 ULONG i;
544 BOOLEAN InSystem;
545 PLDR_DATA_TABLE_ENTRY LdrEntry;
546 PVOID ImageBase;
547 PUNICODE_STRING DriverName;
548 CHAR AnsiName[32];
549 PIMAGE_NT_HEADERS NtHeader;
551 BOOLEAN FirstRun = TRUE;
552
553 /* Loop parameters */
554 for (i = 0; i < ParameterCount; i++)
555 {
556 /* Get the base for this parameter */
557 ImageBase = KiPcToFileHeader((PVOID)Parameters[i],
558 &LdrEntry,
559 FALSE,
560 &InSystem);
561 if (!ImageBase)
562 {
563 /* FIXME: Add code to check for unloaded drivers */
564 DPRINT1("Potentially unloaded driver!\n");
565 continue;
566 }
567 else
568 {
569 /* Get the NT Headers and Timestamp */
570 NtHeader = RtlImageNtHeader(LdrEntry->DllBase);
572
573 /* Convert the driver name */
574 DriverName = &LdrEntry->BaseDllName;
575 ConversionRoutine(&LdrEntry->BaseDllName,
576 AnsiName,
577 sizeof(AnsiName));
578 }
579
580 /* Format driver name */
582 "%s** %12s - Address %p base at %p, DateStamp %08lx\r\n",
583 FirstRun ? "\r\n*":"*",
584 AnsiName,
586 ImageBase,
587 TimeStamp);
588
589 /* Check if we only had one parameter */
590 if (ParameterCount <= 1)
591 {
592 /* Then just save the name */
593 KiBugCheckDriver = DriverName;
594 }
595 else
596 {
597 /* Otherwise, display the message */
599 }
600
601 /* Loop again */
602 FirstRun = FALSE;
603 }
604}
605
606VOID
607NTAPI
609 IN BOOLEAN IsHardError,
610 IN PCHAR HardErrCaption OPTIONAL,
611 IN PCHAR HardErrMessage OPTIONAL,
613{
614 CHAR AnsiName[107];
615
616 /* Check if bootvid is installed */
618 {
619 /* Acquire ownership and reset the display */
622
623 /* Display blue screen */
629 }
630
631 /* Check if this is a hard error */
632 if (IsHardError)
633 {
634 /* Display caption and message */
635 if (HardErrCaption) InbvDisplayString(HardErrCaption);
636 if (HardErrMessage) InbvDisplayString(HardErrMessage);
637 }
638
639 /* Begin the display */
640 InbvDisplayString("\r\n");
641
642 /* Print out initial message */
643 KeGetBugMessageText(BUGCHECK_MESSAGE_INTRO, NULL);
644 InbvDisplayString("\r\n\r\n");
645
646 /* Check if we have a driver */
648 {
649 /* Print out into to driver name */
650 KeGetBugMessageText(BUGCODE_ID_DRIVER, NULL);
651
652 /* Convert and print out driver name */
653 KeBugCheckUnicodeToAnsi(KiBugCheckDriver, AnsiName, sizeof(AnsiName));
655 InbvDisplayString(AnsiName);
656 InbvDisplayString("\r\n\r\n");
657 }
658
659 /* Check if this is the generic message */
660 if (MessageId == BUGCODE_PSS_MESSAGE)
661 {
662 /* It is, so get the bug code string as well */
664 InbvDisplayString("\r\n\r\n");
665 }
666
667 /* Print second introduction message */
668 KeGetBugMessageText(PSS_MESSAGE_INTRO, NULL);
669 InbvDisplayString("\r\n\r\n");
670
671 /* Get the bug code string */
672 KeGetBugMessageText(MessageId, NULL);
673 InbvDisplayString("\r\n\r\n");
674
675 /* Print message for technical information */
676 KeGetBugMessageText(BUGCHECK_TECH_INFO, NULL);
677
678 /* Show the technical Data */
679 RtlStringCbPrintfA(AnsiName,
680 sizeof(AnsiName),
681 "\r\n\r\n*** STOP: 0x%08lX (0x%p,0x%p,0x%p,0x%p)\r\n\r\n",
687 InbvDisplayString(AnsiName);
688
689 /* Check if we have a driver*/
691 {
692 /* Display technical driver data */
694 }
695 else
696 {
697 /* Dump parameter information */
700 4,
702 }
703}
704
706VOID
707NTAPI
709 IN ULONG_PTR BugCheckParameter1,
710 IN ULONG_PTR BugCheckParameter2,
711 IN ULONG_PTR BugCheckParameter3,
712 IN ULONG_PTR BugCheckParameter4,
713 IN PKTRAP_FRAME TrapFrame)
714{
715 PKPRCB Prcb = KeGetCurrentPrcb();
717 ULONG MessageId;
718 CHAR AnsiName[128];
719 BOOLEAN IsSystem, IsHardError = FALSE, Reboot = FALSE;
720 PCHAR HardErrCaption = NULL, HardErrMessage = NULL;
721 PVOID Pc = NULL, Memory;
722 PVOID DriverBase;
723 PLDR_DATA_TABLE_ENTRY LdrEntry;
724 PULONG_PTR HardErrorParameters;
726#ifdef CONFIG_SMP
727 LONG i = 0;
728#endif
729
730 /* Set active bugcheck */
733
734 /* Check if this is power failure simulation */
735 if (BugCheckCode == POWER_FAILURE_SIMULATE)
736 {
737 /* Call the Callbacks and reboot */
740 }
741
742 /* Save the IRQL and set hardware trigger */
745
746 /* Capture the CPU Context */
750
751 /* FIXME: Call the Watchdog if it's registered */
752
753 /* Check which bugcode this is */
754 switch (BugCheckCode)
755 {
756 /* These bug checks already have detailed messages, keep them */
757 case UNEXPECTED_KERNEL_MODE_TRAP:
758 case DRIVER_CORRUPTED_EXPOOL:
759 case ACPI_BIOS_ERROR:
760 case ACPI_BIOS_FATAL_ERROR:
761 case THREAD_STUCK_IN_DEVICE_DRIVER:
762 case DATA_BUS_ERROR:
763 case FAT_FILE_SYSTEM:
764 case NO_MORE_SYSTEM_PTES:
765 case INACCESSIBLE_BOOT_DEVICE:
766
767 /* Keep the same code */
768 MessageId = BugCheckCode;
769 break;
770
771 /* Check if this is a kernel-mode exception */
772 case KERNEL_MODE_EXCEPTION_NOT_HANDLED:
773 case SYSTEM_THREAD_EXCEPTION_NOT_HANDLED:
774 case KMODE_EXCEPTION_NOT_HANDLED:
775
776 /* Use the generic text message */
777 MessageId = KMODE_EXCEPTION_NOT_HANDLED;
778 break;
779
780 /* File-system errors */
781 case NTFS_FILE_SYSTEM:
782
783 /* Use the generic message for FAT */
784 MessageId = FAT_FILE_SYSTEM;
785 break;
786
787 /* Check if this is a coruption of the Mm's Pool */
788 case DRIVER_CORRUPTED_MMPOOL:
789
790 /* Use generic corruption message */
791 MessageId = DRIVER_CORRUPTED_EXPOOL;
792 break;
793
794 /* Check if this is a signature check failure */
796
797 /* Use the generic corruption message */
798 MessageId = BUGCODE_PSS_MESSAGE_SIGNATURE;
799 break;
800
801 /* All other codes */
802 default:
803
804 /* Use the default bugcheck message */
805 MessageId = BUGCODE_PSS_MESSAGE;
806 break;
807 }
808
809 /* Save bugcheck data */
810 KiBugCheckData[0] = BugCheckCode;
811 KiBugCheckData[1] = BugCheckParameter1;
812 KiBugCheckData[2] = BugCheckParameter2;
813 KiBugCheckData[3] = BugCheckParameter3;
814 KiBugCheckData[4] = BugCheckParameter4;
815
816 /* Now check what bugcheck this is */
817 switch (BugCheckCode)
818 {
819 /* Invalid access to R/O memory or Unhandled KM Exception */
820 case KERNEL_MODE_EXCEPTION_NOT_HANDLED:
821 case ATTEMPTED_WRITE_TO_READONLY_MEMORY:
822 case ATTEMPTED_EXECUTE_OF_NOEXECUTE_MEMORY:
823 {
824 /* Check if we have a trap frame */
825 if (!TrapFrame)
826 {
827 /* Use parameter 3 as a trap frame, if it exists */
828 if (BugCheckParameter3) TrapFrame = (PVOID)BugCheckParameter3;
829 }
830
831 /* Check if we got one now and if we need to get the Program Counter */
832 if ((TrapFrame) &&
833 (BugCheckCode != KERNEL_MODE_EXCEPTION_NOT_HANDLED))
834 {
835 /* Get the Program Counter */
836 Pc = (PVOID)KeGetTrapFramePc(TrapFrame);
837 }
838 break;
839 }
840
841 /* Wrong IRQL */
842 case IRQL_NOT_LESS_OR_EQUAL:
843 {
844 /*
845 * The NT kernel has 3 special sections:
846 * MISYSPTE, POOLMI and POOLCODE. The bug check code can
847 * determine in which of these sections this bugcode happened
848 * and provide a more detailed analysis. For now, we don't.
849 */
850
851 /* Program Counter is in parameter 4 */
852 Pc = (PVOID)BugCheckParameter4;
853
854 /* Get the driver base */
855 DriverBase = KiPcToFileHeader(Pc,
856 &LdrEntry,
857 FALSE,
858 &IsSystem);
859 if (IsSystem)
860 {
861 /*
862 * The error happened inside the kernel or HAL.
863 * Get the memory address that was being referenced.
864 */
865 Memory = (PVOID)BugCheckParameter1;
866
867 /* Find to which driver it belongs */
868 DriverBase = KiPcToFileHeader(Memory,
869 &LdrEntry,
870 TRUE,
871 &IsSystem);
872 if (DriverBase)
873 {
874 /* Get the driver name and update the bug code */
875 KiBugCheckDriver = &LdrEntry->BaseDllName;
876 KiBugCheckData[0] = DRIVER_PORTION_MUST_BE_NONPAGED;
877 }
878 else
879 {
880 /* Find the driver that unloaded at this address */
881 KiBugCheckDriver = NULL; // FIXME: ROS can't locate
882
883 /* Check if the cause was an unloaded driver */
885 {
886 /* Update bug check code */
887 KiBugCheckData[0] =
888 SYSTEM_SCAN_AT_RAISED_IRQL_CAUGHT_IMPROPER_DRIVER_UNLOAD;
889 }
890 }
891 }
892 else
893 {
894 /* Update the bug check code */
895 KiBugCheckData[0] = DRIVER_IRQL_NOT_LESS_OR_EQUAL;
896 }
897
898 /* Clear Pc so we don't look it up later */
899 Pc = NULL;
900 break;
901 }
902
903 /* Hard error */
904 case FATAL_UNHANDLED_HARD_ERROR:
905 {
906 /* Copy bug check data from hard error */
907 HardErrorParameters = (PULONG_PTR)BugCheckParameter2;
908 KiBugCheckData[0] = BugCheckParameter1;
909 KiBugCheckData[1] = HardErrorParameters[0];
910 KiBugCheckData[2] = HardErrorParameters[1];
911 KiBugCheckData[3] = HardErrorParameters[2];
912 KiBugCheckData[4] = HardErrorParameters[3];
913
914 /* Remember that this is hard error and set the caption/message */
915 IsHardError = TRUE;
916 HardErrCaption = (PCHAR)BugCheckParameter3;
917 HardErrMessage = (PCHAR)BugCheckParameter4;
918 break;
919 }
920
921 /* Page fault */
922 case PAGE_FAULT_IN_NONPAGED_AREA:
923 {
924 /* Assume no driver */
925 DriverBase = NULL;
926
927 /* Check if we have a trap frame */
928 if (!TrapFrame)
929 {
930 /* We don't, use parameter 3 if possible */
931 if (BugCheckParameter3) TrapFrame = (PVOID)BugCheckParameter3;
932 }
933
934 /* Check if we have a frame now */
935 if (TrapFrame)
936 {
937 /* Get the Program Counter */
938 Pc = (PVOID)KeGetTrapFramePc(TrapFrame);
939 KiBugCheckData[3] = (ULONG_PTR)Pc;
940
941 /* Find out if was in the kernel or drivers */
942 DriverBase = KiPcToFileHeader(Pc,
943 &LdrEntry,
944 FALSE,
945 &IsSystem);
946 }
947 else
948 {
949 /* Can't blame a driver, assume system */
950 IsSystem = TRUE;
951 }
952
953 /* FIXME: Check for session pool in addition to special pool */
954
955 /* Special pool has its own bug check codes */
956 if (MmIsSpecialPoolAddress((PVOID)BugCheckParameter1))
957 {
958 if (MmIsSpecialPoolAddressFree((PVOID)BugCheckParameter1))
959 {
960 KiBugCheckData[0] = IsSystem
961 ? PAGE_FAULT_IN_FREED_SPECIAL_POOL
962 : DRIVER_PAGE_FAULT_IN_FREED_SPECIAL_POOL;
963 }
964 else
965 {
966 KiBugCheckData[0] = IsSystem
967 ? PAGE_FAULT_BEYOND_END_OF_ALLOCATION
968 : DRIVER_PAGE_FAULT_BEYOND_END_OF_ALLOCATION;
969 }
970 }
971 else if (!DriverBase)
972 {
973 /* Find the driver that unloaded at this address */
974 KiBugCheckDriver = NULL; // FIXME: ROS can't locate
975
976 /* Check if the cause was an unloaded driver */
978 {
979 KiBugCheckData[0] =
980 DRIVER_UNLOADED_WITHOUT_CANCELLING_PENDING_OPERATIONS;
981 }
982 }
983 break;
984 }
985
986 /* Check if the driver forgot to unlock pages */
987 case DRIVER_LEFT_LOCKED_PAGES_IN_PROCESS:
988
989 /* Program Counter is in parameter 1 */
990 Pc = (PVOID)BugCheckParameter1;
991 break;
992
993 /* Check if the driver consumed too many PTEs */
994 case DRIVER_USED_EXCESSIVE_PTES:
995
996 /* Loader entry is in parameter 1 */
997 LdrEntry = (PVOID)BugCheckParameter1;
998 KiBugCheckDriver = &LdrEntry->BaseDllName;
999 break;
1000
1001 /* Check if the driver has a stuck thread */
1002 case THREAD_STUCK_IN_DEVICE_DRIVER:
1003
1004 /* The name is in Parameter 3 */
1005 KiBugCheckDriver = (PVOID)BugCheckParameter3;
1006 break;
1007
1008 /* Anything else */
1009 default:
1010 break;
1011 }
1012
1013 /* Do we have a driver name? */
1014 if (KiBugCheckDriver)
1015 {
1016 /* Convert it to ANSI */
1017 KeBugCheckUnicodeToAnsi(KiBugCheckDriver, AnsiName, sizeof(AnsiName));
1018 }
1019 else
1020 {
1021 /* Do we have a Program Counter? */
1022 if (Pc)
1023 {
1024 /* Dump image name */
1025 KiDumpParameterImages(AnsiName,
1026 (PULONG_PTR)&Pc,
1027 1,
1029 }
1030 }
1031
1032 /* Check if we need to save the context for KD */
1034
1035 /* Check if a debugger is connected */
1036 if ((BugCheckCode != MANUALLY_INITIATED_CRASH) && (KdDebuggerEnabled))
1037 {
1038 /* Crash on the debugger console */
1039 DbgPrint("\n*** Fatal System Error: 0x%08lx\n"
1040 " (0x%p,0x%p,0x%p,0x%p)\n\n",
1041 KiBugCheckData[0],
1042 KiBugCheckData[1],
1043 KiBugCheckData[2],
1044 KiBugCheckData[3],
1045 KiBugCheckData[4]);
1046
1047 /* Check if the debugger isn't currently connected */
1049 {
1050 /* Check if we have a driver to blame */
1051 if (KiBugCheckDriver)
1052 {
1053 /* Dump it */
1054 DbgPrint("Driver at fault: %s.\n", AnsiName);
1055 }
1056
1057 /* Check if this was a hard error */
1058 if (IsHardError)
1059 {
1060 /* Print caption and message */
1061 if (HardErrCaption) DbgPrint(HardErrCaption);
1062 if (HardErrMessage) DbgPrint(HardErrMessage);
1063 }
1064
1065 /* Break in the debugger */
1067 }
1068 }
1069
1070 /* Raise IRQL to HIGH_LEVEL */
1071 _disable();
1073
1074 /* Avoid recursion */
1076 {
1077#ifdef CONFIG_SMP
1078 /* Set CPU that is bug checking now */
1079 KeBugCheckOwner = Prcb->Number;
1080
1081 /* Freeze the other CPUs */
1082 for (i = 0; i < KeNumberProcessors; i++)
1083 {
1085 {
1086 /* Send the IPI and give them one second to catch up */
1087 KiIpiSend(1 << i, IPI_FREEZE);
1089 }
1090 }
1091#endif
1092
1093 /* Display the BSOD */
1094 KiDisplayBlueScreen(MessageId,
1095 IsHardError,
1096 HardErrCaption,
1097 HardErrMessage,
1098 AnsiName);
1099
1100 // TODO/FIXME: Run the registered reason-callbacks from
1101 // the KeBugcheckReasonCallbackListHead list with the
1102 // KbCallbackReserved1 reason.
1103
1104 /* Check if the debugger is disabled but we can enable it */
1106 {
1107 /* Enable it */
1109 }
1110 else
1111 {
1112 /* Otherwise, print the last line */
1113 InbvDisplayString("\r\n");
1114 }
1115
1116 /* Save the context */
1118
1119 /* FIXME: Support Triage Dump */
1120
1121 /* FIXME: Write the crash dump */
1122 }
1123 else
1124 {
1125 /* Increase recursion count */
1128 {
1129 /* Break in the debugger */
1131 }
1132 else if (KeBugCheckOwnerRecursionCount > 2)
1133 {
1134 /* Halt execution */
1135 while (TRUE);
1136 }
1137 }
1138
1139 /* Call the Callbacks */
1141
1142 /* FIXME: Call Watchdog if enabled */
1143
1144 /* Check if we have to reboot */
1145 if (Reboot)
1146 {
1147 /* Unload symbols */
1150 }
1151
1152 /* Attempt to break in the debugger (otherwise halt CPU) */
1154
1155 /* Shouldn't get here */
1156 ASSERT(FALSE);
1157 while (TRUE);
1158}
1159
1160BOOLEAN
1161NTAPI
1163{
1165 PKNMI_HANDLER_CALLBACK NmiData;
1166
1167 /* Parse the list of callbacks */
1168 NmiData = KiNmiCallbackListHead;
1169 while (NmiData)
1170 {
1171 /* Save if this callback has handled it -- all it takes is one */
1172 Handled |= NmiData->Callback(NmiData->Context, Handled);
1173 NmiData = NmiData->Next;
1174 }
1175
1176 /* Has anyone handled this? */
1177 return Handled;
1178}
1179
1180/* PUBLIC FUNCTIONS **********************************************************/
1181
1182/*
1183 * @unimplemented
1184 */
1186NTAPI
1188 IN ULONG Flags,
1191 OUT ULONG BufferNeeded OPTIONAL)
1192{
1194 return STATUS_UNSUCCESSFUL;
1195}
1196
1197/*
1198 * @implemented
1199 */
1200BOOLEAN
1201NTAPI
1203{
1204 KIRQL OldIrql;
1206
1207 /* Raise IRQL to High */
1209
1210 /* Check the Current State */
1212 {
1213 /* Reset state and remove from list */
1216 Status = TRUE;
1217 }
1218
1219 /* Lower IRQL and return */
1221 return Status;
1222}
1223
1224/*
1225 * @implemented
1226 */
1227BOOLEAN
1228NTAPI
1231{
1232 KIRQL OldIrql;
1234
1235 /* Raise IRQL to High */
1237
1238 /* Check the Current State */
1240 {
1241 /* Reset state and remove from list */
1244 Status = TRUE;
1245 }
1246
1247 /* Lower IRQL and return */
1249 return Status;
1250}
1251
1252/*
1253 * @implemented
1254 */
1255BOOLEAN
1256NTAPI
1259 IN PVOID Buffer,
1260 IN ULONG Length,
1262{
1263 KIRQL OldIrql;
1265
1266 /* Raise IRQL to High */
1268
1269 /* Check the Current State first so we don't double-register */
1271 {
1272 /* Set the Callback Settings and insert into the list */
1273 CallbackRecord->Length = Length;
1274 CallbackRecord->Buffer = Buffer;
1279 Status = TRUE;
1280 }
1281
1282 /* Lower IRQL and return */
1284 return Status;
1285}
1286
1287/*
1288 * @implemented
1289 */
1290BOOLEAN
1291NTAPI
1297{
1298 KIRQL OldIrql;
1300
1301 /* Raise IRQL to High */
1303
1304 /* Check the Current State first so we don't double-register */
1306 {
1307 /* Set the Callback Settings and insert into the list */
1314 Status = TRUE;
1315 }
1316
1317 /* Lower IRQL and return */
1319 return Status;
1320}
1321
1322/*
1323 * @implemented
1324 */
1325PVOID
1326NTAPI
1329{
1330 KIRQL OldIrql;
1331 PKNMI_HANDLER_CALLBACK NmiData, Next;
1333
1334 /* Allocate NMI callback data */
1335 NmiData = ExAllocatePoolWithTag(NonPagedPool, sizeof(*NmiData), TAG_KNMI);
1336 if (!NmiData) return NULL;
1337
1338 /* Fill in the information */
1339 NmiData->Callback = CallbackRoutine;
1340 NmiData->Context = Context;
1341 NmiData->Handle = NmiData;
1342
1343 /* Insert it into NMI callback list */
1345 NmiData->Next = KiNmiCallbackListHead;
1347 NmiData,
1348 NmiData->Next);
1349 ASSERT(Next == NmiData->Next);
1351
1352 /* Return the opaque "handle" */
1353 return NmiData->Handle;
1354}
1355
1356/*
1357 * @implemented
1358 */
1360NTAPI
1362{
1363 KIRQL OldIrql;
1364 PKNMI_HANDLER_CALLBACK NmiData;
1365 PKNMI_HANDLER_CALLBACK* Previous;
1367
1368 /* Find in the list the NMI callback corresponding to the handle */
1370 Previous = &KiNmiCallbackListHead;
1371 NmiData = *Previous;
1372 while (NmiData)
1373 {
1374 if (NmiData->Handle == Handle)
1375 {
1376 /* The handle is the pointer to the callback itself */
1377 ASSERT(Handle == NmiData);
1378
1379 /* Found it, remove from the list */
1380 *Previous = NmiData->Next;
1381 break;
1382 }
1383
1384 /* Not found; try again */
1385 Previous = &NmiData->Next;
1386 NmiData = *Previous;
1387 }
1389
1390 /* If we have found the entry, free it */
1391 if (NmiData)
1392 {
1393 ExFreePoolWithTag(NmiData, TAG_KNMI);
1394 return STATUS_SUCCESS;
1395 }
1396
1397 return STATUS_INVALID_HANDLE;
1398}
1399
1400/*
1401 * @implemented
1402 */
1404VOID
1405NTAPI
1406KeBugCheckEx(IN ULONG BugCheckCode,
1407 IN ULONG_PTR BugCheckParameter1,
1408 IN ULONG_PTR BugCheckParameter2,
1409 IN ULONG_PTR BugCheckParameter3,
1410 IN ULONG_PTR BugCheckParameter4)
1411{
1412 /* Call the internal API */
1413 KeBugCheckWithTf(BugCheckCode,
1414 BugCheckParameter1,
1415 BugCheckParameter2,
1416 BugCheckParameter3,
1417 BugCheckParameter4,
1418 NULL);
1419}
1420
1421/*
1422 * @implemented
1423 */
1425VOID
1426NTAPI
1427KeBugCheck(ULONG BugCheckCode)
1428{
1429 /* Call the internal API */
1430 KeBugCheckWithTf(BugCheckCode, 0, 0, 0, 0, NULL);
1431}
1432
1433/*
1434 * @implemented
1435 */
1436VOID
1437NTAPI
1439{
1440 /* Disable interrupts */
1442 _disable();
1443
1444 /* Check the bugcheck count */
1446 {
1447 /* There was only one, is the debugger disabled? */
1449 {
1450 /* Enable the debugger */
1451 KdInitSystem(0, NULL);
1452 }
1453 }
1454
1455 /* Break in the debugger */
1457}
1458
1459/* EOF */
static tBugCheckData BugCheckData
KBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord
unsigned char BOOLEAN
Type
Definition: Type.h:7
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ACPI_BIOS_ERROR(plist)
Definition: acoutput.h:243
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define CHAR(Char)
#define MAXULONG_PTR
Definition: basetsd.h:103
@ Reboot
Definition: bl.h:891
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:81
#define UNIMPLEMENTED
Definition: debug.h:115
LIST_ENTRY KeBugcheckCallbackListHead
Definition: bug.c:18
PVOID NTAPI KiPcToFileHeader(IN PVOID Pc, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry, IN BOOLEAN DriversOnly, OUT PBOOLEAN InKernel)
Definition: bug.c:40
UNICODE_STRING KeRosVideoBiosVersion
Definition: bug.c:34
PKNMI_HANDLER_CALLBACK KiNmiCallbackListHead
Definition: bug.c:29
VOID NTAPI KiInitializeBugCheck(VOID)
Definition: bug.c:296
UNICODE_STRING KeRosProcessorName
Definition: bug.c:33
ULONG KeBugCheckOwner
Definition: bug.c:21
BOOLEAN NTAPI KeDeregisterBugCheckCallback(IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
Definition: bug.c:1202
BOOLEAN NTAPI KeRegisterBugCheckCallback(IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord, IN PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine, IN PVOID Buffer, IN ULONG Length, IN PUCHAR Component)
Definition: bug.c:1257
PUNICODE_STRING KiBugCheckDriver
Definition: bug.c:26
BOOLEAN NTAPI KeGetBugMessageText(IN ULONG BugCheckCode, OUT PANSI_STRING OutputString OPTIONAL)
Definition: bug.c:334
PCHAR NTAPI KeBugCheckUnicodeToAnsi(IN PUNICODE_STRING Unicode, OUT PCHAR Ansi, IN ULONG Length)
Definition: bug.c:514
PVOID NTAPI KeRegisterNmiCallback(IN PNMI_CALLBACK CallbackRoutine, IN PVOID Context)
Definition: bug.c:1327
VOID NTAPI KiDumpParameterImages(IN PCHAR Message, IN PULONG_PTR Parameters, IN ULONG ParameterCount, IN PKE_BUGCHECK_UNICODE_TO_ANSI ConversionRoutine)
Definition: bug.c:538
VOID NTAPI KeEnterKernelDebugger(VOID)
Definition: bug.c:1438
KSPIN_LOCK KiNmiCallbackListLock
Definition: bug.c:30
PVOID NTAPI KiRosPcToUserFileHeader(IN PVOID Pc, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
Definition: bug.c:105
UNICODE_STRING KeRosBiosVersion
Definition: bug.c:33
PMESSAGE_RESOURCE_DATA KiBugCodeMessages
Definition: bug.c:23
LONG KeBugCheckOwnerRecursionCount
Definition: bug.c:22
UNICODE_STRING KeRosBiosDate
Definition: bug.c:33
ULONG KeBugCheckActive
Definition: bug.c:21
BOOLEAN NTAPI KeRegisterBugCheckReasonCallback(IN PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord, IN PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine, IN KBUGCHECK_CALLBACK_REASON Reason, IN PUCHAR Component)
Definition: bug.c:1292
DECLSPEC_NORETURN VOID NTAPI KeBugCheckWithTf(IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4, IN PKTRAP_FRAME TrapFrame)
Definition: bug.c:708
VOID NTAPI KiDisplayBlueScreen(IN ULONG MessageId, IN BOOLEAN IsHardError, IN PCHAR HardErrCaption OPTIONAL, IN PCHAR HardErrMessage OPTIONAL, IN PCHAR Message)
Definition: bug.c:608
BOOLEAN NTAPI KeDeregisterBugCheckReasonCallback(IN PKBUGCHECK_REASON_CALLBACK_RECORD CallbackRecord)
Definition: bug.c:1229
KSPIN_LOCK BugCheckCallbackLock
Definition: bug.c:20
ULONG_PTR KiBugCheckData[5]
Definition: bug.c:27
DECLSPEC_NORETURN VOID NTAPI KeBugCheckEx(IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
Definition: bug.c:1406
BOOLEAN NTAPI KiHandleNmi(VOID)
Definition: bug.c:1162
VOID FASTCALL KeRosDumpStackFrameArray(IN PULONG_PTR Frames, IN ULONG FrameCount)
Definition: bug.c:197
NTSTATUS NTAPI KeDeregisterNmiCallback(IN PVOID Handle)
Definition: bug.c:1361
VOID NTAPI KiDoBugCheckCallbacks(VOID)
Definition: bug.c:432
VOID NTAPI KiBugCheckDebugBreak(IN ULONG StatusCode)
Definition: bug.c:489
UNICODE_STRING KeRosVideoBiosDate
Definition: bug.c:34
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1427
NTSTATUS NTAPI KeInitializeCrashDumpHeader(IN ULONG Type, IN ULONG Flags, OUT PVOID Buffer, IN ULONG BufferSize, OUT ULONG BufferNeeded OPTIONAL)
Definition: bug.c:1187
ULONG KeBugCheckCount
Definition: bug.c:24
USHORT NTAPI KeRosCaptureUserStackBackTrace(IN ULONG FramesToSkip, IN ULONG FramesToCapture, OUT PVOID *BackTrace, OUT PULONG BackTraceHash OPTIONAL)
Definition: bug.c:154
LIST_ENTRY KeBugcheckReasonCallbackListHead
Definition: bug.c:19
ULONG KiHardwareTrigger
Definition: bug.c:25
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG NTAPI RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags)
Definition: libsupp.c:227
#define RtlImageNtHeader
Definition: compat.h:806
static int Hash(const char *)
Definition: reader.c:2257
static const WCHAR Message[]
Definition: register.c:74
#define ULONG_PTR
Definition: config.h:101
#define PtrToUlong(u)
Definition: config.h:107
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define NonPagedPool
Definition: env_spec_w32.h:307
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
_Must_inspect_result_ _In_ PFLT_GET_OPERATION_STATUS_CALLBACK CallbackRoutine
Definition: fltkernel.h:1035
_In_ ULONG FramesToCapture
_In_ ULONG _Out_opt_ PULONG BackTraceHash
ULONG Handle
Definition: gdb_input.c:15
#define KeRosDumpStackFrames(Frames, Count)
Definition: gdidebug.h:11
Status
Definition: gdiplustypes.h:25
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DbgPrint
Definition: hal.h:12
#define KeGetCurrentThread
Definition: hal.h:55
VOID NTAPI HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
Definition: reboot.c:22
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:289
VOID NTAPI InbvInstallDisplayStringFilter(_In_ INBV_DISPLAY_STRING_FILTER DisplayFilter)
Definition: inbv.c:386
VOID NTAPI InbvSetTextColor(_In_ ULONG Color)
Definition: inbv.c:459
BOOLEAN NTAPI InbvEnableDisplayString(_In_ BOOLEAN Enable)
Definition: inbv.c:369
BOOLEAN NTAPI InbvDisplayString(_In_ PCHAR String)
Definition: inbv.c:331
BOOLEAN NTAPI InbvResetDisplay(VOID)
Definition: inbv.c:430
VOID NTAPI InbvSetScrollRegion(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom)
Definition: inbv.c:447
VOID NTAPI InbvSolidColorFill(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Right, _In_ ULONG Bottom, _In_ ULONG Color)
Definition: inbv.c:484
BOOLEAN NTAPI InbvIsBootDriverInstalled(VOID)
Definition: inbv.c:395
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
void __cdecl _disable(void)
Definition: intrin_arm.h:365
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
BOOLEAN NTAPI KdInitSystem(_In_ ULONG BootPhase, _In_opt_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: kdinit.c:142
BOOLEAN KdPitchDebugger
Definition: kddata.c:81
NTSTATUS NTAPI KdEnableDebuggerWithLock(IN BOOLEAN NeedLock)
Definition: kdapi.c:1959
BOOLEAN KdbSymPrintAddress(IN PVOID Address, IN PCONTEXT Context)
Print address...
Definition: kdb_symbols.c:148
BOOLEAN KdDebuggerNotPresent
Definition: kddata.c:82
BOOLEAN KdDebuggerEnabled
Definition: kddata.c:83
KDDEBUGGER_DATA64 * KdDebuggerDataBlock
Definition: kdpacket.c:21
FORCEINLINE VOID KiAcquireNmiListLock(OUT PKIRQL OldIrql)
Definition: ke_x.h:1679
FORCEINLINE VOID KiReleaseNmiListLock(IN KIRQL OldIrql)
Definition: ke_x.h:1686
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
NTSTATUS NTAPI LdrAccessResource(_In_ PVOID BaseAddress, _In_ PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry, _Out_opt_ PVOID *Resource, _Out_opt_ PULONG Size)
NTSTATUS NTAPI LdrFindResource_U(_In_ PVOID BaseAddress, _In_ PLDR_RESOURCE_INFO ResourceInfo, _In_ ULONG Level, _Out_ PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry)
#define RESOURCE_DATA_LEVEL
Definition: ldrtypes.h:33
if(dx< 0)
Definition: linetemp.h:194
#define RtlFillMemoryUlong(dst, len, val)
Definition: mkhive.h:55
#define PCHAR
Definition: match.c:90
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:47
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define min(a, b)
Definition: monoChain.cc:55
#define IPI_FREEZE
Definition: ketypes.h:238
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1080
#define HalHaltSystem
Definition: halfuncs.h:43
@ HalRebootRoutine
Definition: haltypes.h:37
#define DBG_STATUS_BUGCHECK_FIRST
Definition: kdtypes.h:41
#define DBG_STATUS_BUGCHECK_SECOND
Definition: kdtypes.h:42
#define DBG_STATUS_FATAL
Definition: kdtypes.h:43
VOID NTAPI DbgUnLoadImageSymbols(_In_ PSTRING Name, _In_ PVOID Base, _In_ ULONG_PTR ProcessId)
NTSYSAPI VOID NTAPI RtlCaptureContext(_Out_ PCONTEXT ContextRecord)
#define MESSAGE_RESOURCE_UNICODE
Definition: rtltypes.h:351
struct _MESSAGE_RESOURCE_ENTRY * PMESSAGE_RESOURCE_ENTRY
#define FASTCALL
Definition: nt_native.h:50
#define DECLSPEC_NORETURN
Definition: ntbasedef.h:176
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define KeGetTrapFramePc(TrapFrame)
Definition: ke.h:37
VOID FASTCALL KiIpiSend(KAFFINITY TargetSet, ULONG IpiRequest)
PCHAR(NTAPI * PKE_BUGCHECK_UNICODE_TO_ANSI)(IN PUNICODE_STRING Unicode, IN PCHAR Ansi, IN ULONG Length)
Definition: ke.h:87
VOID NTAPI KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState)
Definition: cpu.c:397
VOID NTAPI MmMakeKernelResourceSectionWritable(VOID)
Definition: sysldr.c:2311
BOOLEAN NTAPI MmIsSpecialPoolAddress(IN PVOID P)
BOOLEAN NTAPI MmIsSpecialPoolAddressFree(IN PVOID P)
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_SYSTEM_IMAGE_BAD_SIGNATURE
Definition: ntstatus.h:829
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
#define SCREEN_WIDTH
Definition: pc98video.c:27
#define SCREEN_HEIGHT
Definition: pc98video.c:28
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:21
SECURITY_INTEGER TimeStamp
Definition: sspi.h:78
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
PVOID MmHighestUserAddress
Definition: rtlcompat.c:29
#define ASSERT_IRQL_LESS_OR_EQUAL(x)
Definition: debug.h:251
#define BV_COLOR_BLUE
Definition: display.h:19
#define BV_COLOR_WHITE
Definition: display.h:30
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:337
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
base of all file and directory entries
Definition: entries.h:83
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
Definition: pedump.c:458
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine
Definition: ketypes.h:324
KBUGCHECK_CALLBACK_REASON Reason
Definition: ketypes.h:302
PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine
Definition: ketypes.h:299
ULONG64 SavedContext
Definition: wdbgexts.h:195
PNMI_CALLBACK Callback
Definition: ke.h:81
struct _KNMI_HANDLER_CALLBACK * Next
Definition: ke.h:80
USHORT Number
Definition: ketypes.h:564
KPROCESSOR_STATE ProcessorState
Definition: ketypes.h:584
UCHAR DebuggerSavedIRQL
Definition: ketypes.h:744
CONTEXT ContextFrame
Definition: ketypes.h:536
Definition: btrfs_drv.h:1876
PVOID DllBase
Definition: btrfs_drv.h:1880
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:145
ULONG_PTR Language
Definition: ldrtypes.h:183
ULONG_PTR Name
Definition: ldrtypes.h:182
ULONG_PTR Type
Definition: ldrtypes.h:181
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY LoadOrderListHead
Definition: arc.h:493
MESSAGE_RESOURCE_BLOCK Blocks[ANYSIZE_ARRAY]
Definition: rtltypes.h:1912
Definition: rtltypes.h:1896
UCHAR Text[ANYSIZE_ARRAY]
Definition: rtltypes.h:1899
USHORT Flags
Definition: rtltypes.h:1898
USHORT Length
Definition: rtltypes.h:1897
#define TAG_KNMI
Definition: tag.h:41
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
int32_t * PLONG
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792
@ BufferIncomplete
Definition: ketypes.h:311
@ BufferEmpty
Definition: ketypes.h:307
@ BufferInserted
Definition: ketypes.h:308
@ BufferFinished
Definition: ketypes.h:310
@ BufferStarted
Definition: ketypes.h:309
NMI_CALLBACK * PNMI_CALLBACK
Definition: ketypes.h:338
_In_ BOOLEAN Handled
Definition: ketypes.h:337
KBUGCHECK_CALLBACK_ROUTINE * PKBUGCHECK_CALLBACK_ROUTINE
Definition: ketypes.h:320
KBUGCHECK_CALLBACK_REASON
Definition: ketypes.h:247
KBUGCHECK_REASON_CALLBACK_ROUTINE * PKBUGCHECK_REASON_CALLBACK_ROUTINE
Definition: ketypes.h:259
_In_ ULONG Component
Definition: potypes.h:496
NTSYSAPI USHORT NTAPI RtlCaptureStackBackTrace(_In_ ULONG FramesToSkip, _In_ ULONG FramesToCapture, _Out_writes_to_(FramesToCapture, return) PVOID *BackTrace, _Out_opt_ PULONG BackTraceHash)
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175