19 #include "nk_priv.h" |
19 #include "nk_priv.h" |
20 #include <x86.h> |
20 #include <x86.h> |
21 #include <kernel/monitor.h> |
21 #include <kernel/monitor.h> |
22 |
22 |
23 |
23 |
24 EXPORT_C void Monitor::DisplayNThreadInfo(NThread* pT) |
24 void DisplayNThreadPlatformSpecific(Monitor& m, NThread* pT) |
25 { |
25 { |
26 TBuf8<80> buf=_L8("NThread @ "); |
26 m.Printf("ExcInUserMode=%02x\r\n",pT->iSpare3); |
27 buf.AppendNumFixedWidth((TUint)pT,EHex,8); |
|
28 buf+=_L8(" Pri "); |
|
29 buf.AppendNum((TUint)pT->iPriority); |
|
30 buf+=_L8(" NState "); |
|
31 switch (pT->iSpare1) |
|
32 { |
|
33 case NThread::EReady: buf+=_L8("READY"); break; |
|
34 case NThread::ESuspended: buf+=_L8("SUSPENDED"); break; |
|
35 case NThread::EWaitFastSemaphore: buf+=_L8("WAITFSEM "); buf.AppendNumFixedWidth((TUint)pT->iWaitObj,EHex,8); break; |
|
36 case NThread::ESleep: buf+=_L8("SLEEP"); break; |
|
37 case NThread::EBlocked: buf+=_L8("BLOCKED"); break; |
|
38 case NThread::EDead: buf+=_L8("DEAD"); break; |
|
39 case NThread::EWaitDfc: buf+=_L8("WAITDFC"); break; |
|
40 default: buf+=_L8("??"); buf.AppendNumFixedWidth((TUint)pT->iSpare1,EHex,8); break; |
|
41 } |
|
42 PrintLine(buf); |
|
43 Printf("Next=%08x Prev=%08x Att=%02x ExcInUserMode=%02x\r\n",pT->iNext,pT->iPrev,pT->iSpare2,pT->iSpare3); |
|
44 Printf("HeldFM=%08x WaitFM=%08x AddrSp=%08x\r\n",pT->iHeldFastMutex,pT->iWaitFastMutex,pT->iAddressSpace); |
|
45 Printf("Time=%d Timeslice=%d ReqCount=%d\r\n",pT->iTime,pT->iTimeslice,pT->iRequestSemaphore.iCount); |
|
46 Printf("SuspendCount=%d CsCount=%d CsFunction=%08x\r\n",pT->iSuspendCount,pT->iCsCount,pT->iCsFunction); |
|
47 Printf("iUserModeCallbacks=%08x iSpare7=%08x iSpare8=%08x\r\n", pT->iUserModeCallbacks, pT->iSpare7, pT->iSpare8); |
|
48 Printf("SavedSP=%08x\r\n",pT->iSavedSP); |
|
49 if (pT != TScheduler::Ptr()->iCurrentThread) |
27 if (pT != TScheduler::Ptr()->iCurrentThread) |
50 { |
28 { |
51 TUint32* pS=(TUint32*)pT->iSavedSP; |
29 TUint32* pS=(TUint32*)pT->iSavedSP; |
52 SThreadStack reg; |
30 SThreadStack reg; |
53 MTRAPD(r,wordmove(®,pS,sizeof(SThreadStack))); |
31 MTRAPD(r,wordmove(®,pS,sizeof(SThreadStack))); |
54 if (r==KErrNone) |
32 if (r==KErrNone) |
55 { |
33 { |
56 Printf("EBX %08x ESI %08x EDI %08x EBP %08x\r\n",reg.iEbx,reg.iEsi,reg.iEdi,reg.iEbp); |
34 m.Printf("EBX %08x ESI %08x EDI %08x EBP %08x\r\n",reg.iEbx,reg.iEsi,reg.iEdi,reg.iEbp); |
57 Printf("EIP %08x CR0 %08x FS %08x GS %08x\r\n",reg.iEip,reg.iCR0,reg.iFs,reg.iGs); |
35 m.Printf("EIP %08x CR0 %08x FS %08x GS %08x\r\n",reg.iEip,reg.iCR0,reg.iFs,reg.iGs); |
58 } |
36 } |
59 } |
37 } |
60 NewLine(); |
|
61 } |
|
62 |
|
63 void Monitor::DisplayNFastSemInfo(NFastSemaphore* pS) |
|
64 { |
|
65 Printf("NFastSemaphore @ %08x Count %d OwningThread %08x\r\n",pS,pS->iCount,pS->iOwningThread); |
|
66 } |
|
67 |
|
68 void Monitor::DisplayNFastMutexInfo(NFastMutex* pM) |
|
69 { |
|
70 Printf("NFastMutex @ %08x HoldingThread %08x iWaiting %08x\r\n",pM,pM->iHoldingThread,pM->iWaiting); |
|
71 } |
|
72 |
|
73 void Monitor::DisplaySchedulerInfo() |
|
74 { |
|
75 TScheduler* pS=TScheduler::Ptr(); |
|
76 Printf("SCHEDULER @%08x: CurrentThread %08x\r\n",pS,pS->iCurrentThread); |
|
77 Printf("RescheduleNeeded=%02x DfcPending=%02x KernCSLocked=%08x\r\n",pS->iRescheduleNeededFlag,pS->iDfcPendingFlag,pS->iKernCSLocked); |
|
78 Printf("DFCS: next %08x prev %08x\r\n",pS->iDfcs.iA.iNext,pS->iDfcs.iA.iPrev); |
|
79 Printf("ProcessHandler=%08x, AddressSpace=%08x\r\n",pS->iProcessHandler,pS->iAddressSpace); |
|
80 Printf("SYSLOCK: HoldingThread %08x iWaiting %08x\r\n",pS->iLock.iHoldingThread,pS->iLock.iWaiting); |
|
81 Printf("Extras 0: %08x 1: %08x 2: %08x 3: %08x\r\n",pS->iExtras[0],pS->iExtras[1],pS->iExtras[2],pS->iExtras[3]); |
|
82 Printf("Extras 4: %08x 5: %08x 6: %08x 7: %08x\r\n",pS->iExtras[4],pS->iExtras[5],pS->iExtras[6],pS->iExtras[7]); |
|
83 Printf("Extras 8: %08x 9: %08x A: %08x B: %08x\r\n",pS->iExtras[8],pS->iExtras[9],pS->iExtras[10],pS->iExtras[11]); |
|
84 Printf("Extras C: %08x D: %08x E: %08x F: %08x\r\n",pS->iExtras[12],pS->iExtras[13],pS->iExtras[14],pS->iExtras[15]); |
|
85 } |
38 } |
86 |
39 |
87 void Monitor::DumpCpuRegisters() |
40 void Monitor::DumpCpuRegisters() |
88 { |
41 { |
89 SFullX86RegSet& r=*(SFullX86RegSet*)iRegs; |
42 SFullX86RegSet& r=*(SFullX86RegSet*)iRegs; |