24 |
24 |
25 SFullArmRegSet& RegSet(TInt aCpu) |
25 SFullArmRegSet& RegSet(TInt aCpu) |
26 { |
26 { |
27 TScheduler* pS = TScheduler::Ptr(); |
27 TScheduler* pS = TScheduler::Ptr(); |
28 TSubScheduler& ss = *pS->iSub[aCpu]; |
28 TSubScheduler& ss = *pS->iSub[aCpu]; |
29 return *(SFullArmRegSet*)ss.i_AbtStackTop; |
29 return *ss.iSSX.iRegs; |
30 } |
30 } |
31 |
31 |
32 void Monitor::DisplaySpinLock(const char* aTitle, TSpinLock* aLock) |
32 void DisplayNThreadStackedRegs(Monitor& m, SThreadReschedStack& reg) |
33 { |
33 { |
34 volatile TUint32* p = (volatile TUint32*)aLock; |
34 m.Printf("TEEHBR %08x UROTID %08x URWTID %08x FPEXC %08x\r\n", reg.iTEEHBR, reg.iRWROTID, reg.iRWRWTID, reg.iFpExc); |
35 Printf("%s %08x %08x\r\n", aTitle, p[0], p[1]); |
35 m.Printf(" CAR %08x DACR %08x\r\n", reg.iCar, reg.iDacr); |
|
36 m.Printf(" SPARE %08x SPSR %08x SPRSCH %08x R15 %08x\r\n", reg.iSpare, reg.iSpsrSvc, reg.iSPRschdFlg, reg.iR15); |
36 } |
37 } |
37 |
38 |
38 EXPORT_C void Monitor::DisplayNThreadInfo(NThread* aT) |
39 void DisplaySubSchedulerExt(Monitor& m, TSubScheduler& ss) |
39 { |
40 { |
40 DisplayNSchedulableInfo(aT); |
41 TSubSchedulerX& x = ss.iSSX; |
|
42 m.Printf("Extras[ 0] %08x Extras[ 1] %08x Extras[ 2] %08x i_GblTmrA %08x\r\n", x.iSSXP[0], x.iSSXP[1], x.iSSXP[2], x.iGlobalTimerAddr); |
|
43 m.Printf("i_ScuAddr %08x i_GicDist %08x i_GicCpuIf %08x i_LocTmrA %08x\r\n", x.iScuAddr, x.iGicDistAddr, x.iGicCpuIfcAddr, x.iLocalTimerAddr); |
|
44 m.Printf("i_IrqCount %08x i_IrqNest %08x i_ExcInfo %08x i_CrashSt %08x\r\n", x.iIrqCount, x.iIrqNestCount, x.iExcInfo, x.iCrashState); |
|
45 m.Printf("i_AbtStkTp %08x i_UndSktTp %08x i_FiqStkTp %08x i_IrqStkTp %08x\r\n", x.iAbtStackTop, x.iUndStackTop, x.iFiqStackTop, x.iIrqStackTop); |
|
46 m.Printf("CpuFreqM %08x CpuFreqS %08x CpuPeriodM %08x CpuPeriodS %08x\r\n", x.iCpuFreqRI.iR.iM, x.iCpuFreqRI.iR.iX, x.iCpuFreqRI.iI.iM, x.iCpuFreqRI.iI.iX); |
|
47 m.Printf("TmrFreqM %08x TmrFreqS %08x TmrPeriodM %08x TmrPeriodS %08x\r\n", x.iTimerFreqRI.iR.iM, x.iTimerFreqRI.iR.iX, x.iTimerFreqRI.iI.iM, x.iTimerFreqRI.iI.iX); |
41 } |
48 } |
42 |
49 |
43 void Monitor::DisplayNSchedulableInfo(NSchedulable* aS) |
50 void DisplaySchedulerExt(Monitor& m, TScheduler& s) |
44 { |
51 { |
45 NThread* t = aS->iParent ? (NThread*)aS : 0; |
52 TSchedulerX& sx = s.iSX; |
46 NThreadGroup* g = aS->iParent ? 0 : (NThreadGroup*)aS; |
53 m.Printf("iTimerMax %08x %08x\r\n", I64HIGH(sx.iTimerMax), I64LOW(sx.iTimerMax)); |
47 |
54 m.Printf("iGTmrA %08x iScuAddr %08x iGicDistA %08x iGicCpuIfcA %08x iLocTmrA %08x\r\n", |
48 if (t && aS->iParent==aS) |
55 sx.iGlobalTimerAddr, sx.iScuAddr, sx.iGicDistAddr, sx.iGicCpuIfcAddr, sx.iLocalTimerAddr); |
49 Printf("NThread @%08x Pri %d\r\n",aS,aS->iPriority); |
56 m.Printf("iGTFreqM %08x iGTFreqS %08x iGTPeriodM %08x iGTPeriodS %08x\r\n", |
50 else if (t) |
57 sx.iGTimerFreqRI.iR.iM, sx.iGTimerFreqRI.iR.iX, sx.iGTimerFreqRI.iI.iM, sx.iGTimerFreqRI.iI.iX); |
51 Printf("NThread @%08x (G:%08x) Pri %d\r\n",aS,aS->iParent,aS->iPriority); |
58 m.Printf("iCount0 %08x %08x iTimestamp0 %08x %08x\r\n", |
52 else |
59 I64HIGH(sx.iCount0), I64LOW(sx.iCount0), I64HIGH(sx.iTimestamp0), I64LOW(sx.iTimestamp0)); |
53 Printf("NThreadGroup @%08x Pri %d\r\n",aS,aS->iPriority); |
|
54 Printf("Rdy=%02x Curr=%02x LastCpu=%d CpuChg=%02x FrzCpu=%d\r\n", aS->iReady, aS->iCurrent, aS->iLastCpu, aS->iCpuChange, aS->iFreezeCpu); |
|
55 Printf("Next=%08x Prev=%08x Parent=%08x CPUaff=%08x\r\n", aS->iNext, aS->iPrev, aS->iParent, aS->iCpuAffinity); |
|
56 Printf("PauseCount %02x Susp %1x\r\n", aS->iPauseCount, aS->iSuspended); |
|
57 DisplaySpinLock("SpinLock", &aS->iSSpinLock); |
|
58 Printf("Stopping %02x Events %08x %08x EventState %08x\r\n", aS->iStopping, aS->iEvents.iA.iNext, aS->iEvents.iA.iPrev, aS->iEventState); |
|
59 Printf("TotalCpuTime %08x %08x RunCount %08x %08x\r\n", aS->iTotalCpuTime32[1], aS->iTotalCpuTime32[0], aS->iRunCount32[1], aS->iRunCount32[0]); |
|
60 |
|
61 if (g) |
|
62 { |
|
63 // Thread group |
|
64 return; |
|
65 } |
|
66 |
|
67 Printf("WaitState %02x %02x [%02x %02x] (%08x)\r\n", t->iWaitState.iWtC.iWtStFlags, t->iWaitState.iWtC.iWtObjType, |
|
68 t->iWaitState.iWtC.iWtStSpare1, t->iWaitState.iWtC.iWtStSpare2, t->iWaitState.iWtC.iWtObj); |
|
69 Printf("BasePri %d MutexPri %d Att=%02x\r\n", t->iBasePri, t->iMutexPri, t->i_ThrdAttr); |
|
70 Printf("HeldFM=%08x FMDef=%02x AddrSp=%08x\r\n", t->iHeldFastMutex, t->iFastMutexDefer, t->iAddressSpace); |
|
71 Printf("Time=%d Timeslice=%d ReqCount=%08x\r\n", t->iTime, t->iTimeslice, t->iRequestSemaphore.iCount); |
|
72 Printf("SuspendCount=%d CsCount=%d CsFunction=%08x\r\n", t->iSuspendCount, t->iCsCount, t->iCsFunction); |
|
73 Printf("LinkedObjType %02x LinkedObj %08x\r\n", t->iLinkedObjType, t->iLinkedObj); |
|
74 Printf("SavedSP=%08x WaitLink:%08x %08x %d\r\n", t->iSavedSP, t->iWaitLink.iNext, t->iWaitLink.iPrev, t->iWaitLink.iPriority); |
|
75 Printf("iNewParent=%08x iExtraContext=%08x, iExtraContextSize=%08x\r\n", t->iNewParent, t->iExtraContext, t->iExtraContextSize); |
|
76 Printf("iUserModeCallbacks=%08x iNThreadBaseSpare6=%08x\r\n", t->iUserModeCallbacks, t->iNThreadBaseSpare6); |
|
77 Printf("iNThreadBaseSpare7=%08x iNThreadBaseSpare8=%08x iNThreadBaseSpare9=%08x\r\n", t->iNThreadBaseSpare7, t->iNThreadBaseSpare8, t->iNThreadBaseSpare9); |
|
78 if (!aS->iCurrent) |
|
79 { |
|
80 TUint32* pS=(TUint32*)t->iSavedSP; |
|
81 SThreadReschedStack reg; |
|
82 MTRAPD(r,wordmove(®,pS,sizeof(SThreadReschedStack))); |
|
83 if (r==KErrNone) |
|
84 { |
|
85 Printf("TEEHBR %08x UROTID %08x URWTID %08x FPEXC %08x\r\n", reg.iTEEHBR, reg.iRWROTID, reg.iRWRWTID, reg.iFpExc); |
|
86 Printf(" CAR %08x DACR %08x\r\n", reg.iCar, reg.iDacr); |
|
87 Printf(" SPARE %08x SPSR %08x SPRSCH %08x R15 %08x\r\n", reg.iSpare, reg.iSpsrSvc, reg.iSPRschdFlg, reg.iR15); |
|
88 } |
|
89 } |
|
90 NewLine(); |
|
91 } |
|
92 |
|
93 void Monitor::DisplayNFastSemInfo(NFastSemaphore* pS) |
|
94 { |
|
95 if (pS->iCount >= 0) |
|
96 Printf("NFastSemaphore @ %08x Count %d OwningThread %08x\r\n",pS,pS->iCount,pS->iOwningThread); |
|
97 else |
|
98 Printf("NFastSemaphore @ %08x Count %08x (%08x) OwningThread %08x\r\n",pS,pS->iCount,pS->iCount<<2,pS->iOwningThread); |
|
99 } |
|
100 |
|
101 void Monitor::DisplayNFastMutexInfo(NFastMutex* aM) |
|
102 { |
|
103 Printf("NFastMutex @ %08x HoldingThread %08x iWaitQ Pri Mask %08x %08x\r\n", aM, aM->iHoldingThread, aM->iWaitQ.iPresent[1], aM->iWaitQ.iPresent[0]); |
|
104 DisplaySpinLock("SpinLock", &aM->iMutexLock); |
|
105 } |
|
106 |
|
107 void DisplaySubSchedulerInfo(Monitor& m, TSubScheduler& ss) |
|
108 { |
|
109 m.Printf("\r\nSUBSCHEDULER %d @%08x:\r\n", ss.iCpuNum, &ss); |
|
110 m.Printf("CurrentThread=%08x\r\n", ss.iCurrentThread); |
|
111 m.Printf("IDFCs %08x %08x CPU# %08x CPUmask %08x\r\n", ss.iDfcs.iA.iNext, ss.iDfcs.iA.iPrev, ss.iCpuNum, ss.iCpuMask); |
|
112 m.Printf("ExIDFCs %08x %08x CurIDFC %08x PendFlg %08x\r\n", ss.iExIDfcs.iA.iNext, ss.iExIDfcs.iA.iPrev, ss.iCurrentIDFC, *(TUint32*)&ss.iRescheduleNeededFlag); |
|
113 m.DisplaySpinLock("ExIDfcLock", &ss.iExIDfcLock); |
|
114 m.Printf("KLCount %d InIDFC %02x EvPend %02x\r\n", ss.iKernLockCount, ss.iInIDFC, ss.iEventHandlersPending); |
|
115 m.Printf("AddrSp %08x RschdIPIs %08x iNextIPI %08x\r\n", ss.iAddressSpace, ss.iReschedIPIs, ss.iNextIPI); |
|
116 m.DisplaySpinLock("ReadyListLock", &ss.iReadyListLock); |
|
117 m.Printf("EvtHand %08x %08x InitThrd %08x SLOC %08x %08x\r\n", ss.iEventHandlers.iA.iNext, ss.iEventHandlers.iA.iPrev, |
|
118 ss.iInitialThread, I64HIGH(ss.iSpinLockOrderCheck), I64LOW(ss.iSpinLockOrderCheck)); |
|
119 m.DisplaySpinLock("EventHandlerLock", &ss.iEventHandlerLock); |
|
120 m.Printf("Extras[ 0] %08x Extras[ 1] %08x Extras[ 2] %08x Extras[ 3] %08x\r\n", ss.iExtras[0], ss.iExtras[1], ss.iExtras[2], ss.iExtras[3]); |
|
121 m.Printf("i_ScuAddr %08x i_GicDist %08x i_GicCpuIf %08x i_LocTmrA %08x\r\n", ss.i_ScuAddr, ss.i_GicDistAddr, ss.i_GicCpuIfcAddr, ss.i_LocalTimerAddr); |
|
122 m.Printf("i_IrqCount %08x i_IrqNest %08x i_ExcInfo %08x i_CrashSt %08x\r\n", ss.i_IrqCount, ss.i_IrqNestCount, ss.i_ExcInfo, ss.i_CrashState); |
|
123 m.Printf("i_AbtStkTp %08x i_UndSktTp %08x i_FiqStkTp %08x i_IrqStkTp %08x\r\n", ss.i_AbtStackTop, ss.i_UndStackTop, ss.i_FiqStackTop, ss.i_IrqStackTop); |
|
124 m.Printf("i_TmrMultF %08x i_TmrMultI %08x i_CpuMult %08x Extras[13] %08x\r\n", ss.i_TimerMultF, ss.i_TimerMultI, ss.i_CpuMult, ss.iExtras[19]); |
|
125 m.Printf("i_LstTmrSt %08x i_TstmpErr %08x i_MaxCorr %08x i_TimerGap %08x\r\n", ss.iExtras[20], ss.iExtras[21], ss.iExtras[22], ss.iExtras[23]); |
|
126 m.Printf("iLastTimestamp %08x %08x iReschedCount %08x %08x\r\n", ss.iLastTimestamp32[1], ss.iLastTimestamp32[0], ss.iReschedCount32[1], ss.iReschedCount32[0]); |
|
127 } |
|
128 |
|
129 void Monitor::DisplaySchedulerInfo() |
|
130 { |
|
131 TScheduler* pS=TScheduler::Ptr(); |
|
132 Printf("SCHEDULER @%08x:\r\n",pS); |
|
133 Printf("ProcessHandler=%08x MonitorExceptionHandler=%08x RescheduleHook=%08x\r\n",pS->iProcessHandler,pS->iMonitorExceptionHandler,pS->iRescheduleHook); |
|
134 Printf("iActiveCpus1=%08x, iActiveCpus2=%08x, iNumCpus=%d\r\n",pS->iActiveCpus1,pS->iActiveCpus2,pS->iNumCpus); |
|
135 Printf("SYSLOCK @ %08x\r\n",&pS->iLock); |
|
136 DisplayNFastMutexInfo(&pS->iLock); |
|
137 DisplaySpinLock("IdleSpinLock", &pS->iIdleSpinLock); |
|
138 Printf("IdleDfcs %08x %08x CpusNotIdle %08x IdleGeneration %02x IdleSpillCpu %02x\r\n", |
|
139 pS->iIdleDfcs.iA.iNext, pS->iIdleDfcs.iA.iPrev, pS->iCpusNotIdle, pS->iIdleGeneration, pS->iIdleSpillCpu); |
|
140 Printf("Extras 0: %08x 1: %08x 2: %08x 3: %08x\r\n",pS->iExtras[0],pS->iExtras[1],pS->iExtras[2],pS->iExtras[3]); |
|
141 Printf("Extras 4: %08x 5: %08x 6: %08x 7: %08x\r\n",pS->iExtras[4],pS->iExtras[5],pS->iExtras[6],pS->iExtras[7]); |
|
142 Printf("Extras 8: %08x 9: %08x A: %08x B: %08x\r\n",pS->iExtras[8],pS->iExtras[9],pS->iExtras[10],pS->iExtras[11]); |
|
143 Printf("Extras C: %08x D: %08x E: %08x F: %08x\r\n",pS->iExtras[12],pS->iExtras[13],pS->iExtras[14],pS->iExtras[15]); |
|
144 Printf("Extras 10: %08x 11: %08x 12: %08x 13: %08x\r\n",pS->iExtras[16],pS->iExtras[17],pS->iExtras[18],pS->iExtras[19]); |
|
145 Printf("Extras 14: %08x 15: %08x 16: %08x 17: %08x\r\n",pS->iExtras[20],pS->iExtras[21],pS->iExtras[22],pS->iExtras[23]); |
|
146 |
|
147 TInt i; |
|
148 for (i=0; i<KMaxCpus; ++i) |
|
149 { |
|
150 TSubScheduler& ss = *pS->iSub[i]; |
|
151 DisplaySubSchedulerInfo(*this,ss); |
|
152 } |
|
153 } |
60 } |
154 |
61 |
155 void DumpRegisters(Monitor& m, SFullArmRegSet& a) |
62 void DumpRegisters(Monitor& m, SFullArmRegSet& a) |
156 { |
63 { |
157 SNormalRegs& r = a.iN; |
64 SNormalRegs& r = a.iN; |