sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\mmu\t_pages.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32std.h>
|
sl@0
|
19 |
#include <e32std_private.h>
|
sl@0
|
20 |
#include <e32svr.h>
|
sl@0
|
21 |
#include "d_shadow.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
RShadow Shadow;
|
sl@0
|
24 |
LOCAL_D TUint Read(TUint anAddr)
|
sl@0
|
25 |
{
|
sl@0
|
26 |
return Shadow.Read(anAddr);
|
sl@0
|
27 |
}
|
sl@0
|
28 |
TUint PageTables = 0;
|
sl@0
|
29 |
TCpu Cpu = ECpuUnknown;
|
sl@0
|
30 |
TInt CpuArc = 0;
|
sl@0
|
31 |
TInt CpuSpecial = 0;
|
sl@0
|
32 |
TUint ControlReg = 0;
|
sl@0
|
33 |
|
sl@0
|
34 |
const TUint KXPbitM = 0x800000;
|
sl@0
|
35 |
|
sl@0
|
36 |
LOCAL_C void ProcessCBTEX(TDes& aDes, TUint aCb, TUint aTex)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
|
sl@0
|
39 |
const TPtrC KTEXCB[9] = {_L("StOr"),_L("ShDv"),_L("WTRA"),_L("WBRA"),_L("NoCa"),_L("Resv"),_L("ImpD"),_L("WBWA"),_L("NSDv")};
|
sl@0
|
40 |
const TPtrC KCacheP[4] = {_L("NoCa"),_L("WBWA"),_L("WTRA"),_L("WBRA")};
|
sl@0
|
41 |
aCb = aCb >> 2;
|
sl@0
|
42 |
|
sl@0
|
43 |
TUint texCB = aCb | ((aTex&7) << 2);
|
sl@0
|
44 |
|
sl@0
|
45 |
if ((texCB<9) && (CpuArc>5))
|
sl@0
|
46 |
aDes.Append(KTEXCB[texCB]);
|
sl@0
|
47 |
else if ((aTex&4) && (CpuArc>5))
|
sl@0
|
48 |
{
|
sl@0
|
49 |
aDes.Append(KCacheP[aTex&3]);
|
sl@0
|
50 |
aDes.Append(TChar('/'));
|
sl@0
|
51 |
aDes.Append(KCacheP[aCb]);
|
sl@0
|
52 |
}
|
sl@0
|
53 |
else
|
sl@0
|
54 |
{
|
sl@0
|
55 |
if (CpuArc>5)
|
sl@0
|
56 |
{
|
sl@0
|
57 |
if (aTex&4)
|
sl@0
|
58 |
aDes.Append(TChar('1'));
|
sl@0
|
59 |
else
|
sl@0
|
60 |
aDes.Append(TChar('0'));
|
sl@0
|
61 |
|
sl@0
|
62 |
if (aTex&2)
|
sl@0
|
63 |
aDes.Append(TChar('1'));
|
sl@0
|
64 |
else
|
sl@0
|
65 |
aDes.Append(TChar('0'));
|
sl@0
|
66 |
|
sl@0
|
67 |
if (aTex&1)
|
sl@0
|
68 |
aDes.Append(TChar('1'));
|
sl@0
|
69 |
else
|
sl@0
|
70 |
aDes.Append(TChar('0'));
|
sl@0
|
71 |
}
|
sl@0
|
72 |
else if (CpuSpecial == 2)
|
sl@0
|
73 |
{
|
sl@0
|
74 |
if (aTex==1)
|
sl@0
|
75 |
aDes.Append(TChar('X'));
|
sl@0
|
76 |
else if (aTex==0)
|
sl@0
|
77 |
aDes.Append(TChar('_'));
|
sl@0
|
78 |
else
|
sl@0
|
79 |
aDes.Append(TChar('?'));
|
sl@0
|
80 |
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
if (aCb & 2)
|
sl@0
|
84 |
aDes.Append(TChar('C'));
|
sl@0
|
85 |
else
|
sl@0
|
86 |
aDes.Append(TChar('_'));
|
sl@0
|
87 |
if (aCb & 1)
|
sl@0
|
88 |
aDes.Append(TChar('B'));
|
sl@0
|
89 |
else
|
sl@0
|
90 |
aDes.Append(TChar('_'));
|
sl@0
|
91 |
}
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
LOCAL_C void ProcessXNnGS(TDes& aDes, TUint anGS, TUint aXN)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
if ((ControlReg & KXPbitM))
|
sl@0
|
98 |
{
|
sl@0
|
99 |
aDes.Append(TChar(' '));
|
sl@0
|
100 |
if (aXN )
|
sl@0
|
101 |
aDes.Append(_L("XN "));
|
sl@0
|
102 |
else
|
sl@0
|
103 |
aDes.Append(_L("__ "));
|
sl@0
|
104 |
|
sl@0
|
105 |
if (anGS&2 )
|
sl@0
|
106 |
aDes.Append(_L("nG "));
|
sl@0
|
107 |
else
|
sl@0
|
108 |
aDes.Append(_L("__ "));
|
sl@0
|
109 |
|
sl@0
|
110 |
if (anGS&1 )
|
sl@0
|
111 |
aDes.Append(TChar('S'));
|
sl@0
|
112 |
else
|
sl@0
|
113 |
aDes.Append(TChar('_'));
|
sl@0
|
114 |
|
sl@0
|
115 |
}
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
|
sl@0
|
119 |
LOCAL_C void ProcessAP(TDes& aDes, TUint aAp)
|
sl@0
|
120 |
{
|
sl@0
|
121 |
const TPtrC KAccessP[7] = {_L(" RWNO"),_L(" RWRO"),_L(" RWRW"),_L(" Rsv0"),_L(" RONO"),_L(" RORO"),_L(" Rsv1")};
|
sl@0
|
122 |
const TPtrC KAccZrP[4] = {_L(" NONO"), _L(" RONO"), _L(" RORO"), _L(" Rsv2")};
|
sl@0
|
123 |
|
sl@0
|
124 |
TUint access = aAp & 3;
|
sl@0
|
125 |
TUint apx = (aAp >> 3) & 4;
|
sl@0
|
126 |
|
sl@0
|
127 |
if (((ControlReg & 0x300) !=0) && apx)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
aDes.Append(_L(" Rsv3"));
|
sl@0
|
130 |
}
|
sl@0
|
131 |
else
|
sl@0
|
132 |
{
|
sl@0
|
133 |
if ((ControlReg & KXPbitM))
|
sl@0
|
134 |
access |= apx;
|
sl@0
|
135 |
|
sl@0
|
136 |
if (access==0)
|
sl@0
|
137 |
aDes.Append(KAccZrP[(ControlReg >> 8) & 3]);
|
sl@0
|
138 |
else
|
sl@0
|
139 |
aDes.Append(KAccessP[access-1]);
|
sl@0
|
140 |
}
|
sl@0
|
141 |
}
|
sl@0
|
142 |
|
sl@0
|
143 |
LOCAL_C void ProcessPteSE(TUint aPte, TUint anAddr)
|
sl@0
|
144 |
{
|
sl@0
|
145 |
TUint type=aPte&3;
|
sl@0
|
146 |
TBuf<36> buf;
|
sl@0
|
147 |
switch(type)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
case 0:
|
sl@0
|
150 |
// not present
|
sl@0
|
151 |
break;
|
sl@0
|
152 |
case 1:
|
sl@0
|
153 |
{
|
sl@0
|
154 |
// large page
|
sl@0
|
155 |
TUint phys=aPte & 0xffff0000;
|
sl@0
|
156 |
TUint ap0=(aPte>>4)&3;
|
sl@0
|
157 |
TUint ap1=(aPte>>6)&3;
|
sl@0
|
158 |
TUint ap2=(aPte>>8)&3;
|
sl@0
|
159 |
TUint ap3=(aPte>>10)&3;
|
sl@0
|
160 |
TUint tex=(aPte>>12)&0xf;
|
sl@0
|
161 |
ProcessCBTEX(buf,aPte&0xc,tex);
|
sl@0
|
162 |
ProcessAP(buf,ap0);
|
sl@0
|
163 |
ProcessAP(buf,ap1);
|
sl@0
|
164 |
ProcessAP(buf,ap2);
|
sl@0
|
165 |
ProcessAP(buf,ap3);
|
sl@0
|
166 |
RDebug::Print(_L("\t%08x Lpage: phys=%08x, %S"),anAddr,phys,&buf);
|
sl@0
|
167 |
break;
|
sl@0
|
168 |
}
|
sl@0
|
169 |
case 2:
|
sl@0
|
170 |
{
|
sl@0
|
171 |
// small page
|
sl@0
|
172 |
TUint phys=aPte & 0xfffff000;
|
sl@0
|
173 |
TUint ap0=(aPte>>4)&3;
|
sl@0
|
174 |
TUint ap1=(aPte>>6)&3;
|
sl@0
|
175 |
TUint ap2=(aPte>>8)&3;
|
sl@0
|
176 |
TUint ap3=(aPte>>10)&3;
|
sl@0
|
177 |
ProcessCBTEX(buf,aPte&0xc,0);
|
sl@0
|
178 |
ProcessAP(buf,ap0);
|
sl@0
|
179 |
ProcessAP(buf,ap1);
|
sl@0
|
180 |
ProcessAP(buf,ap2);
|
sl@0
|
181 |
ProcessAP(buf,ap3);
|
sl@0
|
182 |
RDebug::Print(_L("\t%08x Spage: phys=%08x, %S"),anAddr,phys,&buf);
|
sl@0
|
183 |
break;
|
sl@0
|
184 |
}
|
sl@0
|
185 |
case 3:
|
sl@0
|
186 |
{
|
sl@0
|
187 |
// extended small page
|
sl@0
|
188 |
TUint phys=aPte & 0xfffff000;
|
sl@0
|
189 |
TUint ap=(aPte>>4)&3;
|
sl@0
|
190 |
TUint tex=(aPte>>6)&0xf;
|
sl@0
|
191 |
ProcessCBTEX(buf,aPte&0xc,tex);
|
sl@0
|
192 |
ProcessAP(buf,ap);
|
sl@0
|
193 |
RDebug::Print(_L("\t%08x XSpage: phys=%08x, %S"),anAddr,phys,&buf);
|
sl@0
|
194 |
break;
|
sl@0
|
195 |
}
|
sl@0
|
196 |
}
|
sl@0
|
197 |
}
|
sl@0
|
198 |
|
sl@0
|
199 |
|
sl@0
|
200 |
LOCAL_C void ProcessPteSD(TUint aPte, TUint anAddr)
|
sl@0
|
201 |
{
|
sl@0
|
202 |
if ((aPte&3) != 0)
|
sl@0
|
203 |
{
|
sl@0
|
204 |
|
sl@0
|
205 |
TBuf<36> buf;
|
sl@0
|
206 |
TUint ap=(aPte>>4)&23;
|
sl@0
|
207 |
|
sl@0
|
208 |
if (aPte&2) // XS-Page
|
sl@0
|
209 |
{
|
sl@0
|
210 |
// extended small page
|
sl@0
|
211 |
TUint phys=aPte & 0xfffff000;
|
sl@0
|
212 |
TUint tex=(aPte>>6)&0x7;
|
sl@0
|
213 |
ProcessCBTEX(buf,aPte&0xc,tex);
|
sl@0
|
214 |
ProcessAP(buf,ap);
|
sl@0
|
215 |
ProcessXNnGS(buf, (aPte>>10)&3, aPte &1);
|
sl@0
|
216 |
RDebug::Print(_L("\t%08x XSpage: phys=%08x, %S"),anAddr,phys,&buf);
|
sl@0
|
217 |
}
|
sl@0
|
218 |
else // L-Page
|
sl@0
|
219 |
{
|
sl@0
|
220 |
|
sl@0
|
221 |
// large page
|
sl@0
|
222 |
TUint phys=aPte & 0xffff0000;
|
sl@0
|
223 |
TUint tex=(aPte>>12)&0x7;
|
sl@0
|
224 |
ProcessCBTEX(buf,aPte&0xc,tex);
|
sl@0
|
225 |
ProcessAP(buf,ap);
|
sl@0
|
226 |
ProcessXNnGS(buf, (aPte>>10)&3, (aPte >> 15) &1);
|
sl@0
|
227 |
RDebug::Print(_L("\t%08x Lpage: phys=%08x, %S"),anAddr,phys,&buf);
|
sl@0
|
228 |
}
|
sl@0
|
229 |
|
sl@0
|
230 |
}// Else "Fault" - Not Present
|
sl@0
|
231 |
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
|
sl@0
|
235 |
LOCAL_C void ProcessPde(TUint aPde, TUint anAddr)
|
sl@0
|
236 |
{
|
sl@0
|
237 |
TUint type=aPde&3;
|
sl@0
|
238 |
TBuf<24> buf;
|
sl@0
|
239 |
switch(type)
|
sl@0
|
240 |
{
|
sl@0
|
241 |
case 0:
|
sl@0
|
242 |
// not present
|
sl@0
|
243 |
if (aPde)
|
sl@0
|
244 |
RDebug::Print(_L(" Not Present\n"));
|
sl@0
|
245 |
break;
|
sl@0
|
246 |
case 1:
|
sl@0
|
247 |
{
|
sl@0
|
248 |
// page table
|
sl@0
|
249 |
TUint ptphys=aPde & 0xfffffc00;
|
sl@0
|
250 |
TUint domain=(aPde>>5)&15;
|
sl@0
|
251 |
TUint P=(aPde&0x200);
|
sl@0
|
252 |
TUint ptpgphys=ptphys & 0xfffff000;
|
sl@0
|
253 |
TUint ptlin=0;
|
sl@0
|
254 |
|
sl@0
|
255 |
TInt i;
|
sl@0
|
256 |
for (i=0; i<256; i++)
|
sl@0
|
257 |
{
|
sl@0
|
258 |
if ((Read(PageTables+i*4)&0xfffff000)==ptpgphys)
|
sl@0
|
259 |
{
|
sl@0
|
260 |
if (ptlin==0)
|
sl@0
|
261 |
ptlin=PageTables+(i<<12)+(ptphys & 0xc00);
|
sl@0
|
262 |
else
|
sl@0
|
263 |
RDebug::Print(_L("WARNING Multiple page tables found! alt = %08x\n"), PageTables+(i<<12)+(ptphys & 0xc00));
|
sl@0
|
264 |
}
|
sl@0
|
265 |
}
|
sl@0
|
266 |
if (ptlin)
|
sl@0
|
267 |
{
|
sl@0
|
268 |
RDebug::Print(_L("%08x page table: phys=%08x, domain %2d, %s, page table lin=%08x"),anAddr,ptphys,domain,P?L"ECC":L"No ECC",ptlin);
|
sl@0
|
269 |
for (i=0; i<256; i++)
|
sl@0
|
270 |
{
|
sl@0
|
271 |
TUint addr=anAddr+(i<<12);
|
sl@0
|
272 |
TUint pte=Read(ptlin+i*4);
|
sl@0
|
273 |
|
sl@0
|
274 |
if (ControlReg & KXPbitM)
|
sl@0
|
275 |
ProcessPteSD(pte,addr);
|
sl@0
|
276 |
else
|
sl@0
|
277 |
ProcessPteSE(pte,addr);
|
sl@0
|
278 |
}
|
sl@0
|
279 |
}
|
sl@0
|
280 |
else
|
sl@0
|
281 |
RDebug::Print(_L("%08x page table: phys=%08x, domain %2d, %s, page table not found"),anAddr,ptphys,domain,P?L"ECC":L"No ECC");
|
sl@0
|
282 |
|
sl@0
|
283 |
break;
|
sl@0
|
284 |
}
|
sl@0
|
285 |
case 2:
|
sl@0
|
286 |
{
|
sl@0
|
287 |
// section
|
sl@0
|
288 |
TUint phys=aPde & 0xfff00000;
|
sl@0
|
289 |
TUint perm=(aPde>>10)&0x23;
|
sl@0
|
290 |
TUint P=(aPde&0x200);
|
sl@0
|
291 |
TUint domain=(aPde>>5)&15;
|
sl@0
|
292 |
ProcessCBTEX(buf,aPde&0xc,(aPde>>12)&0xf); // tex is bigger on xscale, but bit is masked off later.
|
sl@0
|
293 |
ProcessAP(buf,perm);
|
sl@0
|
294 |
ProcessXNnGS(buf, (aPde>>16)&3, (aPde>>4)&1);
|
sl@0
|
295 |
|
sl@0
|
296 |
if ((ControlReg & KXPbitM) && (aPde & 0x40000))
|
sl@0
|
297 |
{
|
sl@0
|
298 |
domain = (domain << 4) | ((aPde >> 20) &15);
|
sl@0
|
299 |
RDebug::Print(_L("%08x Supersectn: phys=%08x, base %4d, %s, %S"),anAddr,phys,domain,P?L"ECC":L"No ECC",&buf);
|
sl@0
|
300 |
}
|
sl@0
|
301 |
else
|
sl@0
|
302 |
{
|
sl@0
|
303 |
RDebug::Print(_L("%08x section : phys=%08x, domain %2d, %s, %S"),anAddr,phys,domain,P?L"ECC":L"No ECC",&buf);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
break;
|
sl@0
|
306 |
}
|
sl@0
|
307 |
default:
|
sl@0
|
308 |
// invalid
|
sl@0
|
309 |
RDebug::Print(_L("PDE for %08x invalid, value %08x"),anAddr,aPde);
|
sl@0
|
310 |
break;
|
sl@0
|
311 |
}
|
sl@0
|
312 |
}
|
sl@0
|
313 |
|
sl@0
|
314 |
const TInt KNotInInvalid = -2;
|
sl@0
|
315 |
TInt StartInvalid=KNotInInvalid;
|
sl@0
|
316 |
TInt StartInvalidBase=0;
|
sl@0
|
317 |
TInt EndInvalidBase=0;
|
sl@0
|
318 |
|
sl@0
|
319 |
void DisplayNotPresent(TInt aCurrentPd)
|
sl@0
|
320 |
{
|
sl@0
|
321 |
aCurrentPd--;
|
sl@0
|
322 |
if (StartInvalid!=KNotInInvalid) // Display any Invalid ranges.
|
sl@0
|
323 |
{
|
sl@0
|
324 |
if (StartInvalid == aCurrentPd)
|
sl@0
|
325 |
RDebug::Print(_L("\nPage Directory 0x%x: Base=0x%x - Not Present.\n"), StartInvalid, StartInvalidBase);
|
sl@0
|
326 |
else
|
sl@0
|
327 |
RDebug::Print(_L("\nPage Directorys 0x%x-0x%x: Bases=0x%x-0x%x - Not Present.\n"), StartInvalid, aCurrentPd, StartInvalidBase, EndInvalidBase);
|
sl@0
|
328 |
|
sl@0
|
329 |
StartInvalid=KNotInInvalid;
|
sl@0
|
330 |
}
|
sl@0
|
331 |
}
|
sl@0
|
332 |
|
sl@0
|
333 |
void ProcessPd(TUint aPd)
|
sl@0
|
334 |
{
|
sl@0
|
335 |
TUint i;
|
sl@0
|
336 |
TUint pdSize;
|
sl@0
|
337 |
TUint pdBase;
|
sl@0
|
338 |
TUint offset;
|
sl@0
|
339 |
|
sl@0
|
340 |
TInt err = Shadow.GetPdInfo(aPd, pdSize, pdBase, offset);
|
sl@0
|
341 |
|
sl@0
|
342 |
if (err==KErrNone)
|
sl@0
|
343 |
{
|
sl@0
|
344 |
DisplayNotPresent(aPd);
|
sl@0
|
345 |
|
sl@0
|
346 |
if (aPd==KGlobalPageDirectory)
|
sl@0
|
347 |
RDebug::Print(_L("Global Page Directory: Base=0x%x, Entries=0x%x, Start index=0x%x\n"), pdBase, pdSize, offset);
|
sl@0
|
348 |
else
|
sl@0
|
349 |
RDebug::Print(_L("\nPage Directory 0x%x: Base=0x%x, Entries=0x%x %x\n"), aPd, pdBase, pdSize, offset);
|
sl@0
|
350 |
|
sl@0
|
351 |
if (Cpu == ECpuArm)
|
sl@0
|
352 |
{
|
sl@0
|
353 |
|
sl@0
|
354 |
for (i=0; i<pdSize; i++)
|
sl@0
|
355 |
{
|
sl@0
|
356 |
TUint addr=(i+offset)<<20;
|
sl@0
|
357 |
TUint pde=Read(pdBase+i*4);
|
sl@0
|
358 |
ProcessPde(pde,addr);
|
sl@0
|
359 |
}
|
sl@0
|
360 |
}
|
sl@0
|
361 |
else
|
sl@0
|
362 |
RDebug::Print(_L("Cannot display pde for this CPU"));
|
sl@0
|
363 |
}
|
sl@0
|
364 |
else
|
sl@0
|
365 |
{ // Dont list all invalid PDs - there are too many.
|
sl@0
|
366 |
if (StartInvalid==KNotInInvalid)
|
sl@0
|
367 |
{
|
sl@0
|
368 |
StartInvalidBase = pdBase;
|
sl@0
|
369 |
StartInvalid = aPd;
|
sl@0
|
370 |
}
|
sl@0
|
371 |
else
|
sl@0
|
372 |
{
|
sl@0
|
373 |
EndInvalidBase=pdBase;
|
sl@0
|
374 |
}
|
sl@0
|
375 |
|
sl@0
|
376 |
}
|
sl@0
|
377 |
}
|
sl@0
|
378 |
|
sl@0
|
379 |
GLDEF_C TInt E32Main()
|
sl@0
|
380 |
{
|
sl@0
|
381 |
TUint mmuId=0;
|
sl@0
|
382 |
TUint cacheType=0;
|
sl@0
|
383 |
|
sl@0
|
384 |
|
sl@0
|
385 |
|
sl@0
|
386 |
TInt r=User::LoadLogicalDevice(_L("D_SHADOW"));
|
sl@0
|
387 |
if ((r!=KErrNone) && (r!=KErrAlreadyExists))
|
sl@0
|
388 |
User::Panic(_L("T_PAGES0"),r);
|
sl@0
|
389 |
r=Shadow.Open();
|
sl@0
|
390 |
if (r!=KErrNone)
|
sl@0
|
391 |
User::Panic(_L("T_PAGES1"),r);
|
sl@0
|
392 |
|
sl@0
|
393 |
Shadow.GetMemoryArchitecture(Cpu, ControlReg);
|
sl@0
|
394 |
switch (Cpu)
|
sl@0
|
395 |
{
|
sl@0
|
396 |
case ECpuArm:
|
sl@0
|
397 |
{
|
sl@0
|
398 |
mmuId=Shadow.MmuId();
|
sl@0
|
399 |
TUint implementor= (mmuId>>24);
|
sl@0
|
400 |
|
sl@0
|
401 |
if (implementor==0x44)
|
sl@0
|
402 |
CpuSpecial = 1;
|
sl@0
|
403 |
|
sl@0
|
404 |
switch ((mmuId>>12)&15)
|
sl@0
|
405 |
{
|
sl@0
|
406 |
case 0: // Pre-ARM7
|
sl@0
|
407 |
if ((mmuId>>4)==0x4156030)
|
sl@0
|
408 |
CpuArc = 2;
|
sl@0
|
409 |
else if ((mmuId>>8)==0x415606)
|
sl@0
|
410 |
CpuArc = 3;
|
sl@0
|
411 |
break;
|
sl@0
|
412 |
case 7: // Mid-ARM7
|
sl@0
|
413 |
CpuArc = 3;
|
sl@0
|
414 |
default:// Post-ARM7
|
sl@0
|
415 |
TUint arc = (mmuId >>16) &15;
|
sl@0
|
416 |
if (arc<3)
|
sl@0
|
417 |
{
|
sl@0
|
418 |
CpuArc = 4;
|
sl@0
|
419 |
if ((implementor==0x69) && (arc==4))
|
sl@0
|
420 |
CpuSpecial=1;
|
sl@0
|
421 |
}
|
sl@0
|
422 |
else if (arc<7)
|
sl@0
|
423 |
{
|
sl@0
|
424 |
CpuArc = 5;
|
sl@0
|
425 |
if ((implementor==0x69) && (arc==5))
|
sl@0
|
426 |
CpuSpecial=2;
|
sl@0
|
427 |
}
|
sl@0
|
428 |
else if (arc==7)
|
sl@0
|
429 |
CpuArc = 6;
|
sl@0
|
430 |
else
|
sl@0
|
431 |
CpuArc = arc;
|
sl@0
|
432 |
}
|
sl@0
|
433 |
|
sl@0
|
434 |
switch (CpuSpecial)
|
sl@0
|
435 |
{
|
sl@0
|
436 |
case 1:RDebug::Print(_L("\nCPU = ARMv%d (StrongArm), ControlRegister = 0x%x "),CpuArc, ControlReg);
|
sl@0
|
437 |
break;
|
sl@0
|
438 |
case 2:RDebug::Print(_L("\nCPU = ARMv%d (XScale), ControlRegister = 0x%x "),CpuArc, ControlReg);
|
sl@0
|
439 |
break;
|
sl@0
|
440 |
default:
|
sl@0
|
441 |
if (CpuArc<7)
|
sl@0
|
442 |
RDebug::Print(_L("\nCPU = ARMv%d, ControlRegister = 0x%x "),CpuArc, ControlReg);
|
sl@0
|
443 |
else
|
sl@0
|
444 |
RDebug::Print(_L("\nCPU = ARM (#%d), ControlRegister = 0x%x "),CpuArc, ControlReg);
|
sl@0
|
445 |
}
|
sl@0
|
446 |
|
sl@0
|
447 |
RDebug::Print(_L("(MMU=%d, Alignment Checking=%d, Write Buffer=%d, System Protection=%d, "),
|
sl@0
|
448 |
ControlReg & 1,(ControlReg>>1)&1,(ControlReg>>3)&1, (ControlReg>>8)&1);
|
sl@0
|
449 |
|
sl@0
|
450 |
if (ControlReg & KXPbitM)
|
sl@0
|
451 |
RDebug::Print(_L("ROM Protection=%d, Subpages Disabled, Exception Endian=%d)\n"), (ControlReg>>9)&1, (ControlReg>>25)&1);
|
sl@0
|
452 |
else
|
sl@0
|
453 |
RDebug::Print(_L("ROM Protection=%d, Subpages Enabled, Exception Endian=%d)\n"), (ControlReg>>9)&1, (ControlReg>>25)&1);
|
sl@0
|
454 |
|
sl@0
|
455 |
RDebug::Print(_L("MMU ID=%08X"),mmuId);
|
sl@0
|
456 |
|
sl@0
|
457 |
|
sl@0
|
458 |
|
sl@0
|
459 |
cacheType=Shadow.CacheType();
|
sl@0
|
460 |
RDebug::Print(_L("CACHE TYPE=%08X"),cacheType);
|
sl@0
|
461 |
break;
|
sl@0
|
462 |
|
sl@0
|
463 |
}
|
sl@0
|
464 |
|
sl@0
|
465 |
case ECpuX86:
|
sl@0
|
466 |
RDebug::Print(_L("\nCPU = x86\n"));
|
sl@0
|
467 |
break;
|
sl@0
|
468 |
case ECpuUnknown:
|
sl@0
|
469 |
default:
|
sl@0
|
470 |
RDebug::Print(_L("\nCPU = Unknown, Flags = 0x%x\n"), ControlReg);
|
sl@0
|
471 |
|
sl@0
|
472 |
}
|
sl@0
|
473 |
|
sl@0
|
474 |
TUint numPages = 0;
|
sl@0
|
475 |
TMemModel memModel = Shadow.GetMemModelInfo(PageTables, numPages);
|
sl@0
|
476 |
|
sl@0
|
477 |
switch (memModel)
|
sl@0
|
478 |
{
|
sl@0
|
479 |
case EMemModelMoving: RDebug::Print(_L("Moving Memory Model.\n"));
|
sl@0
|
480 |
break;
|
sl@0
|
481 |
case EMemModelMultiple : RDebug::Print(_L("Multiple Memory Model.\nMax number of PageDirectorys=0x%x.\n"), numPages);
|
sl@0
|
482 |
break;
|
sl@0
|
483 |
case EMemModelFlexible : RDebug::Print(_L("Flexible Memory Model.\nMax number of PageDirectorys=0x%x.\n"), numPages);
|
sl@0
|
484 |
break;
|
sl@0
|
485 |
default:
|
sl@0
|
486 |
RDebug::Print(_L("Unknown Memory Model.\n"));
|
sl@0
|
487 |
return KErrNone;
|
sl@0
|
488 |
}
|
sl@0
|
489 |
|
sl@0
|
490 |
ProcessPd(KGlobalPageDirectory);
|
sl@0
|
491 |
|
sl@0
|
492 |
if (memModel==2)
|
sl@0
|
493 |
{
|
sl@0
|
494 |
TUint i;
|
sl@0
|
495 |
for (i=0; i<numPages; i++)
|
sl@0
|
496 |
{
|
sl@0
|
497 |
ProcessPd(i);
|
sl@0
|
498 |
}
|
sl@0
|
499 |
DisplayNotPresent(numPages);
|
sl@0
|
500 |
}
|
sl@0
|
501 |
Shadow.Close();
|
sl@0
|
502 |
User::FreeLogicalDevice(_L("Shadow"));
|
sl@0
|
503 |
return KErrNone;
|
sl@0
|
504 |
}
|