author | hgs |
Tue, 27 Apr 2010 15:10:09 +0100 | |
changeset 127 | e408fc570bb5 |
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\x86\ncmonitor.cpp |
|
15 |
// Kernel crash debugger - NKERN ARM specific portion |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
#include "nk_priv.h" |
|
20 |
#include <x86.h> |
|
21 |
#include <kernel/monitor.h> |
|
22 |
||
23 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
void DisplayNThreadPlatformSpecific(Monitor& m, NThread* pT) |
0 | 25 |
{ |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
m.Printf("ExcInUserMode=%02x\r\n",pT->iSpare3); |
0 | 27 |
if (pT != TScheduler::Ptr()->iCurrentThread) |
28 |
{ |
|
29 |
TUint32* pS=(TUint32*)pT->iSavedSP; |
|
30 |
SThreadStack reg; |
|
31 |
MTRAPD(r,wordmove(®,pS,sizeof(SThreadStack))); |
|
32 |
if (r==KErrNone) |
|
33 |
{ |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
34 |
m.Printf("EBX %08x ESI %08x EDI %08x EBP %08x\r\n",reg.iEbx,reg.iEsi,reg.iEdi,reg.iEbp); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
35 |
m.Printf("EIP %08x CR0 %08x FS %08x GS %08x\r\n",reg.iEip,reg.iCR0,reg.iFs,reg.iGs); |
0 | 36 |
} |
37 |
} |
|
38 |
} |
|
39 |
||
40 |
void Monitor::DumpCpuRegisters() |
|
41 |
{ |
|
42 |
SFullX86RegSet& r=*(SFullX86RegSet*)iRegs; |
|
43 |
Printf("EAX=%08x EBX=%08x ECX=%08x EDX=%08x\r\n",r.iEax,r.iEbx,r.iEcx,r.iEdx); |
|
44 |
Printf("ESP=%08x EBP=%08x ESI=%08x EDI=%08x\r\n",r.iEsp,r.iEbp,r.iEsi,r.iEdi); |
|
45 |
Printf(" CS=%08x EIP=%08x EFL=%08x SS=%08x\r\n",r.iCs,r.iEip,r.iEflags,r.iSs); |
|
46 |
Printf(" DS=%08x ES=%08x FS=%08x GS=%08x\r\n",r.iDs,r.iEs,r.iFs,r.iGs); |
|
47 |
Printf("IrqNest=%08x\r\n",r.iIrqNestCount); |
|
48 |
NewLine(); |
|
49 |
} |
|
50 |
||
51 |
void Monitor::DisplayCpuFaultInfo() |
|
52 |
{ |
|
53 |
TScheduler* pS = TScheduler::Ptr(); |
|
54 |
TAny* p = pS->i_ExcInfo; |
|
55 |
if (!p) |
|
56 |
return; |
|
57 |
TX86ExcInfo& a=*(TX86ExcInfo*)p; |
|
58 |
Printf("Exc %02x EFLAGS=%08x FAR=%08x ErrCode=%08x\r\n",a.iExcId,a.iEflags,a.iFaultAddress,a.iExcErrorCode); |
|
59 |
Printf("EAX=%08x EBX=%08x ECX=%08x EDX=%08x\r\n",a.iEax,a.iEbx,a.iEcx,a.iEdx); |
|
60 |
Printf("ESP=%08x EBP=%08x ESI=%08x EDI=%08x\r\n",a.iEsp,a.iEbp,a.iEsi,a.iEdi); |
|
61 |
Printf(" CS=%08x EIP=%08x DS=%08x SS=%08x\r\n",a.iCs,a.iEip,a.iDs,a.iSs); |
|
62 |
Printf(" ES=%08x FS=%08x GS=%08x\r\n",a.iEs,a.iFs,a.iGs); |
|
63 |
if (a.iCs&3) |
|
64 |
{ |
|
65 |
Printf("SS3=%08x ESP3=%08x\r\n",a.iSs3,a.iEsp3); |
|
66 |
} |
|
67 |
} |
|
68 |
||
69 |
EXPORT_C void Monitor::GetStackPointers(NThread* aThread, TUint& aSupSP, TUint& aUsrSP) |
|
70 |
{ |
|
71 |
TScheduler* pS = TScheduler::Ptr(); |
|
72 |
if (aThread == pS->iCurrentThread) |
|
73 |
aSupSP = ((SFullX86RegSet*)iRegs)->iEsp; |
|
74 |
else |
|
75 |
aSupSP = (TUint)aThread->iSavedSP; |
|
76 |
||
77 |
// User SP is in the exception info on the top of the supervisor stack |
|
78 |
TUint stackTop = (TUint)aThread->iStackBase + aThread->iStackSize; |
|
79 |
TX86ExcInfo* excRegs = (TX86ExcInfo*)(stackTop-sizeof(TX86ExcInfo)); |
|
80 |
aUsrSP = excRegs->iEsp3; |
|
81 |
} |