20 |
20 |
21 #include <kernel/monitor.h> |
21 #include <kernel/monitor.h> |
22 #include "nk_priv.h" |
22 #include "nk_priv.h" |
23 #include <arm.h> |
23 #include <arm.h> |
24 |
24 |
25 void DisplayNThreadPlatformSpecific(Monitor& m, NThread* pT) |
25 EXPORT_C void Monitor::DisplayNThreadInfo(NThread* pT) |
26 { |
26 { |
27 m.Printf("iUserContextType=%02x ExtraContext=%08x ExtraContextSize=%04x\r\n",pT->iSpare3,pT->iExtraContext,pT->iExtraContextSize); |
27 TBuf8<80> buf=_L8("NThread @ "); |
|
28 buf.AppendNumFixedWidth((TUint)pT,EHex,8); |
|
29 buf+=_L8(" Pri "); |
|
30 buf.AppendNum((TUint)pT->iPriority); |
|
31 buf+=_L8(" NState "); |
|
32 switch (pT->iSpare1) |
|
33 { |
|
34 case NThread::EReady: buf+=_L8("READY"); break; |
|
35 case NThread::ESuspended: buf+=_L8("SUSPENDED"); break; |
|
36 case NThread::EWaitFastSemaphore: buf+=_L8("WAITFSEM "); buf.AppendNumFixedWidth((TUint)pT->iWaitObj,EHex,8); break; |
|
37 case NThread::ESleep: buf+=_L8("SLEEP"); break; |
|
38 case NThread::EBlocked: buf+=_L8("BLOCKED"); break; |
|
39 case NThread::EDead: buf+=_L8("DEAD"); break; |
|
40 case NThread::EWaitDfc: buf+=_L8("WAITDFC"); break; |
|
41 default: buf+=_L8("??"); buf.AppendNumFixedWidth((TUint)pT->iSpare1,EHex,8); break; |
|
42 } |
|
43 PrintLine(buf); |
|
44 Printf("Next=%08x Prev=%08x Att=%02x iUserContextType=%02x\r\n",pT->iNext,pT->iPrev,pT->iSpare2,pT->iSpare3); |
|
45 Printf("HeldFM=%08x WaitFM=%08x AddrSp=%08x\r\n",pT->iHeldFastMutex,pT->iWaitFastMutex,pT->iAddressSpace); |
|
46 Printf("Time=%d Timeslice=%d ReqCount=%d\r\n",pT->iTime,pT->iTimeslice,pT->iRequestSemaphore.iCount); |
|
47 Printf("SuspendCount=%d CsCount=%d CsFunction=%08x\r\n",pT->iSuspendCount,pT->iCsCount,pT->iCsFunction); |
|
48 Printf("SavedSP=%08x ExtraContext=%08x ExtraContextSize=%04x\r\n",pT->iSavedSP,pT->iExtraContext,pT->iExtraContextSize); |
|
49 Printf("iUserModeCallbacks=%08x iSpare7=%08x iSpare8=%08x\r\n", pT->iUserModeCallbacks, pT->iSpare7, pT->iSpare8); |
28 if (pT != TScheduler::Ptr()->iCurrentThread) |
50 if (pT != TScheduler::Ptr()->iCurrentThread) |
29 { |
51 { |
30 TUint32* pS=(TUint32*)pT->iSavedSP; |
52 TUint32* pS=(TUint32*)pT->iSavedSP; |
31 TUint32 reg[12+EXTRA_STACK_SPACE/4]; |
53 TUint32 reg[12+EXTRA_STACK_SPACE/4]; |
32 MTRAPD(r,wordmove(reg,pS,48+EXTRA_STACK_SPACE)); |
54 MTRAPD(r,wordmove(reg,pS,48+EXTRA_STACK_SPACE)); |
33 if (r==KErrNone) |
55 if (r==KErrNone) |
34 { |
56 { |
35 TUint32* pR=reg; |
57 TUint32* pR=reg; |
36 #ifdef __CPU_SUPPORT_THUMB2EE |
58 #ifdef __CPU_SUPPORT_THUMB2EE |
37 m.Printf("TEEHBR %08x ",*pR++); |
59 Printf("TEEHBR %08x ",*pR++); |
38 #endif |
60 #endif |
39 #ifdef __CPU_HAS_CP15_THREAD_ID_REG |
61 #ifdef __CPU_HAS_CP15_THREAD_ID_REG |
40 m.Printf("RWRWTID %08x ",*pR++); |
62 Printf("RWRWTID %08x ",*pR++); |
41 #endif |
63 #endif |
42 #ifdef __CPU_HAS_VFP |
64 #ifdef __CPU_HAS_VFP |
43 m.Printf("FPEXC %08x ",*pR++); |
65 Printf("FPEXC %08x ",*pR++); |
44 #endif |
66 #endif |
45 #ifdef __CPU_HAS_COPROCESSOR_ACCESS_REG |
67 #ifdef __CPU_HAS_COPROCESSOR_ACCESS_REG |
46 m.Printf("CAR %08x ",*pR++); |
68 Printf("CAR %08x ",*pR++); |
47 #endif |
69 #endif |
48 #ifdef __CPU_ARM_USE_DOMAINS |
70 #ifdef __CPU_ARM_USE_DOMAINS |
49 m.Printf("DACR %08x\r\n",*pR++); |
71 Printf("DACR %08x\r\n",*pR++); |
50 #endif |
72 #endif |
51 m.Printf("R13_USR %08x R14_USR %08x SPSR_SVC %08x\r\n",pR[0],pR[1],pR[2]); |
73 Printf("R13_USR %08x R14_USR %08x SPSR_SVC %08x\r\n",pR[0],pR[1],pR[2]); |
52 m.Printf(" R4 %08x R5 %08x R6 %08x R7 %08x\r\n",pR[3],pR[4],pR[5],pR[6]); |
74 Printf(" R4 %08x R5 %08x R6 %08x R7 %08x\r\n",pR[3],pR[4],pR[5],pR[6]); |
53 m.Printf(" R8 %08x R9 %08x R10 %08x R11 %08x\r\n",pR[7],pR[8],pR[9],pR[10]); |
75 Printf(" R8 %08x R9 %08x R10 %08x R11 %08x\r\n",pR[7],pR[8],pR[9],pR[10]); |
54 m.Printf(" PC %08x\r\n",pR[11]); |
76 Printf(" PC %08x\r\n",pR[11]); |
55 } |
77 } |
56 } |
78 } |
|
79 NewLine(); |
|
80 } |
|
81 |
|
82 void Monitor::DisplayNFastSemInfo(NFastSemaphore* pS) |
|
83 { |
|
84 Printf("NFastSemaphore @ %08x Count %d OwningThread %08x\r\n",pS,pS->iCount,pS->iOwningThread); |
|
85 } |
|
86 |
|
87 void Monitor::DisplayNFastMutexInfo(NFastMutex* pM) |
|
88 { |
|
89 Printf("NFastMutex @ %08x HoldingThread %08x iWaiting %08x\r\n",pM,pM->iHoldingThread,pM->iWaiting); |
|
90 } |
|
91 |
|
92 void Monitor::DisplaySchedulerInfo() |
|
93 { |
|
94 TScheduler* pS=TScheduler::Ptr(); |
|
95 Printf("SCHEDULER @%08x: CurrentThread %08x\r\n",pS,pS->iCurrentThread); |
|
96 Printf("RescheduleNeeded=%02x DfcPending=%02x KernCSLocked=%08x\r\n",pS->iRescheduleNeededFlag,pS->iDfcPendingFlag,pS->iKernCSLocked); |
|
97 Printf("DFCS: next %08x prev %08x\r\n",pS->iDfcs.iA.iNext,pS->iDfcs.iA.iPrev); |
|
98 Printf("ProcessHandler=%08x, AddressSpace=%08x\r\n",pS->iProcessHandler,pS->iAddressSpace); |
|
99 Printf("SYSLOCK: HoldingThread %08x iWaiting %08x\r\n",pS->iLock.iHoldingThread,pS->iLock.iWaiting); |
|
100 Printf("Extras 0: %08x 1: %08x 2: %08x 3: %08x\r\n",pS->iExtras[0],pS->iExtras[1],pS->iExtras[2],pS->iExtras[3]); |
|
101 Printf("Extras 4: %08x 5: %08x 6: %08x 7: %08x\r\n",pS->iExtras[4],pS->iExtras[5],pS->iExtras[6],pS->iExtras[7]); |
|
102 Printf("Extras 8: %08x 9: %08x A: %08x B: %08x\r\n",pS->iExtras[8],pS->iExtras[9],pS->iExtras[10],pS->iExtras[11]); |
|
103 Printf("Extras C: %08x D: %08x E: %08x F: %08x\r\n",pS->iExtras[12],pS->iExtras[13],pS->iExtras[14],pS->iExtras[15]); |
57 } |
104 } |
58 |
105 |
59 void DumpRegisters(Monitor& m, SFullArmRegSet& a) |
106 void DumpRegisters(Monitor& m, SFullArmRegSet& a) |
60 { |
107 { |
61 SNormalRegs& r = a.iN; |
108 SNormalRegs& r = a.iN; |