author | hgs |
Wed, 23 Jun 2010 11:59:44 +0100 | |
changeset 175 | 5af6c74cd793 |
parent 90 | 947f0dc9f7a8 |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\nkern\arm\ncmonitor.cpp |
|
15 |
// Kernel crash debugger - NKERN ARM specific portion |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
#define __INCLUDE_REG_OFFSETS__ // for SP_R13U in nk_plat.h |
|
20 |
||
21 |
#include <kernel/monitor.h> |
|
22 |
#include "nk_priv.h" |
|
23 |
#include <arm.h> |
|
24 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
25 |
void DisplayNThreadPlatformSpecific(Monitor& m, NThread* pT) |
0 | 26 |
{ |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
27 |
m.Printf("iUserContextType=%02x ExtraContext=%08x ExtraContextSize=%04x\r\n",pT->iSpare3,pT->iExtraContext,pT->iExtraContextSize); |
0 | 28 |
if (pT != TScheduler::Ptr()->iCurrentThread) |
29 |
{ |
|
30 |
TUint32* pS=(TUint32*)pT->iSavedSP; |
|
31 |
TUint32 reg[12+EXTRA_STACK_SPACE/4]; |
|
32 |
MTRAPD(r,wordmove(reg,pS,48+EXTRA_STACK_SPACE)); |
|
33 |
if (r==KErrNone) |
|
34 |
{ |
|
35 |
TUint32* pR=reg; |
|
36 |
#ifdef __CPU_SUPPORT_THUMB2EE |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
37 |
m.Printf("TEEHBR %08x ",*pR++); |
0 | 38 |
#endif |
39 |
#ifdef __CPU_HAS_CP15_THREAD_ID_REG |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
m.Printf("RWRWTID %08x ",*pR++); |
0 | 41 |
#endif |
42 |
#ifdef __CPU_HAS_VFP |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
m.Printf("FPEXC %08x ",*pR++); |
0 | 44 |
#endif |
45 |
#ifdef __CPU_HAS_COPROCESSOR_ACCESS_REG |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
m.Printf("CAR %08x ",*pR++); |
0 | 47 |
#endif |
48 |
#ifdef __CPU_ARM_USE_DOMAINS |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
49 |
m.Printf("DACR %08x\r\n",*pR++); |
0 | 50 |
#endif |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
51 |
m.Printf("R13_USR %08x R14_USR %08x SPSR_SVC %08x\r\n",pR[0],pR[1],pR[2]); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
52 |
m.Printf(" R4 %08x R5 %08x R6 %08x R7 %08x\r\n",pR[3],pR[4],pR[5],pR[6]); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
53 |
m.Printf(" R8 %08x R9 %08x R10 %08x R11 %08x\r\n",pR[7],pR[8],pR[9],pR[10]); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
54 |
m.Printf(" PC %08x\r\n",pR[11]); |
0 | 55 |
} |
56 |
} |
|
57 |
} |
|
58 |
||
59 |
void DumpRegisters(Monitor& m, SFullArmRegSet& a) |
|
60 |
{ |
|
61 |
SNormalRegs& r = a.iN; |
|
62 |
m.Printf("MODE_USR:\r\n"); |
|
63 |
m.Printf(" R0=%08x R1=%08x R2=%08x R3=%08x\r\n", r.iR0, r.iR1, r.iR2, r.iR3); |
|
64 |
m.Printf(" R4=%08x R5=%08x R6=%08x R7=%08x\r\n", r.iR4, r.iR5, r.iR6, r.iR7); |
|
65 |
m.Printf(" R8=%08x R9=%08x R10=%08x R11=%08x\r\n", r.iR8, r.iR9, r.iR10, r.iR11); |
|
66 |
m.Printf("R12=%08x R13=%08x R14=%08x R15=%08x\r\n", r.iR12, r.iR13, r.iR14, r.iR15); |
|
67 |
m.Printf("CPSR=%08x\r\n", r.iFlags); |
|
68 |
m.Printf("MODE_FIQ:\r\n"); |
|
69 |
m.Printf(" R8=%08x R9=%08x R10=%08x R11=%08x\r\n", r.iR8Fiq, r.iR9Fiq, r.iR10Fiq, r.iR11Fiq); |
|
70 |
m.Printf("R12=%08x R13=%08x R14=%08x SPSR=%08x\r\n", r.iR12Fiq, r.iR13Fiq, r.iR14Fiq, r.iSpsrFiq); |
|
71 |
m.Printf("MODE_IRQ:\r\n"); |
|
72 |
m.Printf("R13=%08x R14=%08x SPSR=%08x\r\n", r.iR13Irq, r.iR14Irq, r.iSpsrIrq); |
|
73 |
m.Printf("MODE_SVC:\r\n"); |
|
74 |
m.Printf("R13=%08x R14=%08x SPSR=%08x\r\n", r.iR13Svc, r.iR14Svc, r.iSpsrSvc); |
|
75 |
m.Printf("MODE_ABT:\r\n"); |
|
76 |
m.Printf("R13=%08x R14=%08x SPSR=%08x\r\n", r.iR13Abt, r.iR14Abt, r.iSpsrAbt); |
|
77 |
m.Printf("MODE_UND:\r\n"); |
|
78 |
m.Printf("R13=%08x R14=%08x SPSR=%08x\r\n", r.iR13Und, r.iR14Und, r.iSpsrUnd); |
|
79 |
// m.Printf("MODE_MON:\r\n"); |
|
80 |
// m.Printf("R13=%08x R14=%08x SPSR=%08x\r\n", r.iR13Mon, r.iR14Mon, r.iSpsrMon); |
|
81 |
||
82 |
SAuxiliaryRegs& aux = a.iA; |
|
83 |
m.Printf("TEEHBR=%08x CPACR=%08x\r\n", aux.iTEEHBR, aux.iCPACR); |
|
84 |
||
85 |
SBankedRegs& b = a.iB[0]; |
|
86 |
m.Printf(" SCTLR=%08x ACTLR=%08x PRRR=%08x NMRR=%08x\r\n", b.iSCTLR, b.iACTLR, b.iPRRR, b.iNMRR); |
|
87 |
m.Printf(" DACR=%08x TTBR0=%08x TTBR1=%08x TTBCR=%08x\r\n", b.iDACR, b.iTTBR0, b.iTTBR1, b.iTTBCR); |
|
88 |
m.Printf(" VBAR=%08x FCSEID=%08x CTXIDR=%08x\r\n", b.iVBAR, b.iFCSEIDR, b.iCTXIDR); |
|
89 |
m.Printf("Thread ID RWRW=%08x RWRO=%08x RWNO=%08x\r\n", b.iRWRWTID, b.iRWROTID, b.iRWNOTID); |
|
90 |
#ifdef __CPU_HAS_MMU |
|
91 |
extern TUint32 GetMMUID(); |
|
92 |
m.Printf(" MMUID %08x\r\n", GetMMUID()); |
|
93 |
#endif |
|
94 |
#ifdef __CPU_HAS_VFP |
|
95 |
m.Printf("FPEXC %08x\r\n", a.iMore[0]); |
|
96 |
#endif |
|
97 |
#ifdef __CPU_HAS_CACHE_TYPE_REGISTER |
|
98 |
extern TUint32 GetCacheType(); |
|
99 |
m.Printf("CTYPE %08x\r\n", GetCacheType()); |
|
100 |
#endif |
|
101 |
m.NewLine(); |
|
102 |
} |
|
103 |
||
104 |
EXPORT_C void Monitor::DumpCpuRegisters() |
|
105 |
{ |
|
106 |
SFullArmRegSet& r = *(SFullArmRegSet*)iRegs; |
|
107 |
DumpRegisters(*this, r); |
|
108 |
} |
|
109 |
||
110 |
EXPORT_C void Monitor::DisplayCpuFaultInfo() |
|
111 |
{ |
|
112 |
TScheduler* pS = TScheduler::Ptr(); |
|
113 |
SFullArmRegSet& r = *(SFullArmRegSet*)pS->i_Regs; |
|
114 |
if (TUint(r.iExcCode) > TUint(EArmExceptionUndefinedOpcode)) |
|
115 |
return; |
|
116 |
Printf("Exc %1d Cpsr=%08x FAR=%08x FSR=%08x\r\n", r.iExcCode, r.iN.iFlags, r.iB[0].iDFAR, r.iB[0].iDFSR); |
|
117 |
Printf(" R0=%08x R1=%08x R2=%08x R3=%08x\r\n", r.iN.iR0, r.iN.iR1, r.iN.iR2, r.iN.iR3); |
|
118 |
Printf(" R4=%08x R5=%08x R6=%08x R7=%08x\r\n", r.iN.iR4, r.iN.iR5, r.iN.iR6, r.iN.iR7); |
|
119 |
Printf(" R8=%08x R9=%08x R10=%08x R11=%08x\r\n", r.iN.iR8, r.iN.iR9, r.iN.iR10, r.iN.iR11); |
|
120 |
Printf("R12=%08x R13=%08x R14=%08x R15=%08x\r\n", r.iN.iR12, r.iN.iR13, r.iN.iR14, r.iN.iR15); |
|
121 |
Printf("R13Svc=%08x R14Svc=%08x SpsrSvc=%08x\r\n", r.iN.iR13Svc, r.iN.iR14Svc, r.iN.iSpsrSvc); |
|
122 |
} |
|
123 |
||
124 |
EXPORT_C void Monitor::GetStackPointers(NThread* aThread, TUint& aSupSP, TUint& aUsrSP) |
|
125 |
{ |
|
126 |
TScheduler* pS = TScheduler::Ptr(); |
|
127 |
if (aThread == pS->iCurrentThread) |
|
128 |
{ |
|
129 |
SFullArmRegSet& r = *(SFullArmRegSet*)iRegs; |
|
130 |
aSupSP = r.iN.iR13Svc; |
|
131 |
aUsrSP = r.iN.iR13; |
|
132 |
} |
|
133 |
else |
|
134 |
{ |
|
135 |
TUint32* sp = (TUint32*)aThread->iSavedSP; |
|
136 |
aSupSP = (TUint)sp; |
|
137 |
aUsrSP = sp[SP_R13U]; |
|
138 |
} |
|
139 |
} |