00069 :
00070
00071 This function formats and displays
the machine state at
the time of
the
00072 to bug check.
00073
00074 Arguments:
00075
00076 ProcessorState - Supplies a pointer to a processor state record.
00077
00078
Buffer - Supplies a pointer to a buffer to be used to output machine
00079 state information.
00080
00081 BugCheckParameters - Supplies a pointer to an array of additional
00082 bug check information.
00083
00084 NumberOfParameters - Suppiles
the size of
the bug check parameters
00085 array.
00086
00087 UnicodeToAnsiRoutine - Supplies a pointer to a routine to convert
Unicode strings
00088 to Ansi strings without touching paged
translation tables.
00089
00090 Return Value:
00091
00092 None.
00093
00094 --*/
00095
00096 {
00097
00098 PCONTEXT ContextRecord;
00099 ULONG ControlPc;
00100 PLDR_DATA_TABLE_ENTRY DataTableEntry;
00101 ULONG DisplayColumn;
00102 ULONG DisplayHeight;
00103 ULONG DisplayRow;
00104 ULONG DisplayWidth;
00105 UNICODE_STRING DllName;
00106 ULONG EstablisherFrame;
00107 PRUNTIME_FUNCTION FunctionEntry;
00108 PVOID ImageBase;
00109 ULONG
Index;
00110 BOOLEAN InFunction;
00111 ULONG LastStack;
00112 PLIST_ENTRY ModuleListHead;
00113 PLIST_ENTRY NextEntry;
00114 ULONG NextPc;
00115 ULONG StackLimit;
00116 UCHAR AnsiBuffer[ 32 ];
00117 ULONG DateStamp;
00118
00119
00120
00121
00122
00123
HalQueryDisplayParameters(&DisplayWidth,
00124 &DisplayHeight,
00125 &DisplayColumn,
00126 &DisplayRow);
00127
00128
00129
00130
00131
00132
00133
for (
Index = 0;
Index < NumberOfParameters;
Index += 1) {
00134 ImageBase =
KiPcToFileHeader((PVOID)*BugCheckParameters,
00135 &ImageBase,
00136 &DataTableEntry);
00137
00138
if (ImageBase !=
NULL) {
00139
sprintf(Buffer,
00140
"*** %08lX has base at %08lX - %s\n",
00141 *BugCheckParameters,
00142 ImageBase,
00143 (*UnicodeToAnsiRoutine)( &DataTableEntry->BaseDllName, AnsiBuffer,
sizeof( AnsiBuffer )));
00144
00145
HalDisplayString(Buffer);
00146 }
00147
00148 BugCheckParameters += 1;
00149 }
00150
00151
00152
00153
00154
00155 ContextRecord = &ProcessorState->ContextFrame;
00156 LastStack = (ULONG)ContextRecord->XIntSp;
00157 ControlPc = (ULONG)(ContextRecord->XIntRa - 4);
00158 NextPc = ControlPc;
00159 FunctionEntry =
KiLookupFunctionEntry(ControlPc);
00160
if (FunctionEntry !=
NULL) {
00161 NextPc =
RtlVirtualUnwind(ControlPc | 1,
00162 FunctionEntry,
00163 ContextRecord,
00164 &InFunction,
00165 &EstablisherFrame,
00166 NULL);
00167 }
00168
00169
00170
00171
00172
00173
00174
00175
00176
sprintf(Buffer,
00177
"\nMachine State at Call to Bug Check PC : %08lX PSR : %08lX\n\n",
00178 (ULONG)ContextRecord->XIntRa,
00179 ContextRecord->Psr);
00180
00181
HalDisplayString(Buffer);
00182
00183
00184
00185
00186
00187
sprintf(Buffer,
00188
"AT :%8lX V0 :%8lX V1 :%8lX A0 :%8lX\n",
00189 (ULONG)ContextRecord->XIntAt,
00190 (ULONG)ContextRecord->XIntV0,
00191 (ULONG)ContextRecord->XIntV1,
00192 (ULONG)ContextRecord->XIntA0);
00193
00194
HalDisplayString(Buffer);
00195
00196
sprintf(Buffer,
00197
"A1 :%8lX A2 :%8lX A3 :%8lX T0 :%8lX\n",
00198 (ULONG)ContextRecord->XIntA1,
00199 (ULONG)ContextRecord->XIntA2,
00200 (ULONG)ContextRecord->XIntA3,
00201 (ULONG)ContextRecord->XIntT0);
00202
00203
HalDisplayString(Buffer);
00204
00205
sprintf(Buffer,
00206
"T1 :%8lX T2 :%8lX T3 :%8lX T4 :%8lX\n",
00207 (ULONG)ContextRecord->XIntT1,
00208 (ULONG)ContextRecord->XIntT2,
00209 (ULONG)ContextRecord->XIntT3,
00210 (ULONG)ContextRecord->XIntT4);
00211
00212
HalDisplayString(Buffer);
00213
00214
sprintf(Buffer,
00215
"T5 :%8lX T6 :%8lX T7 :%8lX T8 :%8lX\n",
00216 (ULONG)ContextRecord->XIntT5,
00217 (ULONG)ContextRecord->XIntT6,
00218 (ULONG)ContextRecord->XIntT7,
00219 (ULONG)ContextRecord->XIntT8);
00220
00221
HalDisplayString(Buffer);
00222
00223
sprintf(Buffer,
00224
"T9 :%8lX S0 :%8lX S1 :%8lX S2 :%8lX\n",
00225 (ULONG)ContextRecord->XIntT9,
00226 (ULONG)ContextRecord->XIntS0,
00227 (ULONG)ContextRecord->XIntS1,
00228 (ULONG)ContextRecord->XIntS2);
00229
00230
HalDisplayString(Buffer);
00231
00232
sprintf(Buffer,
00233
"S3 :%8lX S4 :%8lX S5 :%8lX S6 :%8lX\n",
00234 (ULONG)ContextRecord->XIntS3,
00235 (ULONG)ContextRecord->XIntS4,
00236 (ULONG)ContextRecord->XIntS5,
00237 (ULONG)ContextRecord->XIntS6);
00238
00239
HalDisplayString(Buffer);
00240
00241
sprintf(Buffer,
00242
"S7 :%8lX S8 :%8lX GP :%8lX SP :%8lX\n",
00243 (ULONG)ContextRecord->XIntS7,
00244 (ULONG)ContextRecord->XIntS8,
00245 (ULONG)ContextRecord->XIntGp,
00246 (ULONG)ContextRecord->XIntSp);
00247
00248
HalDisplayString(Buffer);
00249
00250
sprintf(Buffer,
00251
"RA :%8lX LO :%8lX HI :%8lX FSR:%8lX\n",
00252 (ULONG)ContextRecord->XIntRa,
00253 (ULONG)ContextRecord->XIntLo,
00254 (ULONG)ContextRecord->XIntHi,
00255 (ULONG)ContextRecord->Fsr);
00256
00257
HalDisplayString(Buffer);
00258
00259
00260
00261
00262
00263
sprintf(Buffer,
00264
"F0 :%8lX F1 :%8lX F2 :%8lX F3 :%8lX\n",
00265 ContextRecord->FltF0,
00266 ContextRecord->FltF1,
00267 ContextRecord->FltF2,
00268 ContextRecord->FltF3);
00269
00270
HalDisplayString(Buffer);
00271
00272
sprintf(Buffer,
00273
"F4 :%8lX F5 :%8lX F6 :%8lX F7 :%8lX\n",
00274 ContextRecord->FltF4,
00275 ContextRecord->FltF5,
00276 ContextRecord->FltF6,
00277 ContextRecord->FltF7);
00278
00279
HalDisplayString(Buffer);
00280
00281
sprintf(Buffer,
00282
"F8 :%8lX F9 :%8lX F10:%8lX F11:%8lX\n",
00283 ContextRecord->FltF8,
00284 ContextRecord->FltF9,
00285 ContextRecord->FltF10,
00286 ContextRecord->FltF11);
00287
00288
HalDisplayString(Buffer);
00289
00290
sprintf(Buffer,
00291
"F12:%8lX F13:%8lX F14:%8lX F15:%8lX\n",
00292 ContextRecord->FltF12,
00293 ContextRecord->FltF13,
00294 ContextRecord->FltF14,
00295 ContextRecord->FltF15);
00296
00297
HalDisplayString(Buffer);
00298
00299
sprintf(Buffer,
00300
"F16:%8lX F17:%8lX F18:%8lX F19:%8lX\n",
00301 ContextRecord->FltF16,
00302 ContextRecord->FltF17,
00303 ContextRecord->FltF18,
00304 ContextRecord->FltF19);
00305
00306
HalDisplayString(Buffer);
00307
00308
sprintf(Buffer,
00309
"F20:%8lX F21:%8lX F22:%8lX F23:%8lX\n",
00310 ContextRecord->FltF20,
00311 ContextRecord->FltF21,
00312 ContextRecord->FltF22,
00313 ContextRecord->FltF23);
00314
00315
HalDisplayString(Buffer);
00316
00317
sprintf(Buffer,
00318
"F24:%8lX F25:%8lX F26:%8lX F27:%8lX\n",
00319 ContextRecord->FltF24,
00320 ContextRecord->FltF25,
00321 ContextRecord->FltF26,
00322 ContextRecord->FltF27);
00323
00324
HalDisplayString(Buffer);
00325
00326
sprintf(Buffer,
00327
"F28:%8lX F29:%8lX F30:%8lX F31:%8lX\n\n",
00328 ContextRecord->FltF28,
00329 ContextRecord->FltF29,
00330 ContextRecord->FltF30,
00331 ContextRecord->FltF31);
00332
00333
HalDisplayString(Buffer);
00334
00335
00336
00337
00338
00339 DllName.Length = 0;
00340 DllName.Buffer =
L"";
00341
if (FunctionEntry !=
NULL) {
00342 StackLimit = (ULONG)
KeGetCurrentThread()->KernelStack;
00343
HalDisplayString(
"Callee-Sp Return-Ra Dll Base - Name\n");
00344
for (
Index = 0;
Index < 8;
Index += 1) {
00345 ImageBase =
KiPcToFileHeader((PVOID)ControlPc,
00346 &ImageBase,
00347 &DataTableEntry);
00348
00349
sprintf(Buffer,
00350
" %08lX %08lX : %08lX - %s\n",
00351 (ULONG)ContextRecord->XIntSp,
00352 NextPc + 4,
00353 ImageBase,
00354 (*UnicodeToAnsiRoutine)( (ImageBase != NULL) ? &DataTableEntry->BaseDllName : &DllName,
00355 AnsiBuffer,
sizeof( AnsiBuffer )));
00356
00357
HalDisplayString(Buffer);
00358
if ((NextPc != ControlPc) || ((ULONG)ContextRecord->XIntSp != LastStack)) {
00359 ControlPc = NextPc;
00360 LastStack = (ULONG)ContextRecord->XIntSp;
00361 FunctionEntry =
KiLookupFunctionEntry(ControlPc);
00362
if ((FunctionEntry !=
NULL) && (LastStack < StackLimit)) {
00363 NextPc =
RtlVirtualUnwind(ControlPc | 1,
00364 FunctionEntry,
00365 ContextRecord,
00366 &InFunction,
00367 &EstablisherFrame,
00368 NULL);
00369 }
else {
00370 NextPc = (ULONG)ContextRecord->XIntRa;
00371 }
00372
00373 }
else {
00374
break;
00375 }
00376 }
00377 }
00378
00379
00380
00381
00382
00383
sprintf(Buffer,
00384
"\nIRQL : %d, DPC Active : %s, SYSVER 0x%08x\n",
00385 KeGetCurrentIrql(),
00386 KeIsExecutingDpc() ?
"TRUE" :
"FALSE",
00387 NtBuildNumber);
00388
00389
HalDisplayString(Buffer);
00390
00391
00392
00393
00394
00395
sprintf(Buffer,
00396
"Processor Id %d.%d, Icache : %d, Dcache : %d\n",
00397 (PCR->ProcessorId >> 8) & 0xff,
00398 PCR->ProcessorId & 0xff,
00399 PCR->FirstLevelIcacheSize,
00400 PCR->FirstLevelDcacheSize);
00401
00402
HalDisplayString(Buffer);
00403
00404
00405
00406
00407
00408
00409
00410
HalQueryDisplayParameters(&DisplayWidth,
00411 &DisplayHeight,
00412 &DisplayColumn,
00413 &DisplayRow);
00414
00415
if (DisplayWidth > (80 + 24)) {
00416
if (
KeLoaderBlock !=
NULL) {
00417 ModuleListHead = &
KeLoaderBlock->
LoadOrderListHead;
00418
00419 }
else {
00420 ModuleListHead = &
PsLoadedModuleList;
00421 }
00422
00423
00424
00425
00426
00427
Index = 1;
00428
KiDisplayString(80, Index,
"Dll Base DateStmp - Name");
00429 NextEntry = ModuleListHead->Flink;
00430
if (NextEntry !=
NULL) {
00431
00432
00433
00434
00435
00436
00437
while (NextEntry != ModuleListHead) {
00438
Index += 1;
00439 DataTableEntry = CONTAINING_RECORD(NextEntry,
00440 LDR_DATA_TABLE_ENTRY,
00441 InLoadOrderLinks);
00442
00443
if (
MmDbgReadCheck(DataTableEntry->DllBase) !=
NULL) {
00444 PIMAGE_NT_HEADERS NtHeaders;
00445
00446 NtHeaders =
RtlImageNtHeader(DataTableEntry->DllBase);
00447 DateStamp = NtHeaders->FileHeader.TimeDateStamp;
00448
00449 }
else {
00450 DateStamp = 0;
00451 }
00452
sprintf(Buffer,
00453
"%08lX %08lx - %s",
00454 DataTableEntry->DllBase,
00455 DateStamp,
00456 (*UnicodeToAnsiRoutine)( &DataTableEntry->BaseDllName, AnsiBuffer,
sizeof( AnsiBuffer )));
00457
00458
KiDisplayString(80, Index, Buffer);
00459 NextEntry = NextEntry->Flink;
00460
if (
Index > DisplayHeight) {
00461
break;
00462 }
00463 }
00464 }
00465 }
00466
00467
00468
00469
00470
00471
HalSetDisplayParameters(DisplayColumn, DisplayRow);
00472
return;
00473 }