1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/memmodel/epoc/moving/mmonitor.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,98 @@
1.4 +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\memmodel\epoc\moving\mmonitor.cpp
1.18 +// Kernel crash debugger - machine independent portion
1.19 +//
1.20 +//
1.21 +
1.22 +#include <kernel/monitor.h>
1.23 +#include "memmodel.h"
1.24 +
1.25 +void Monitor::DumpMemModelProcessData(DProcess* aProcess)
1.26 + {
1.27 + DMemModelProcess* pP=(DMemModelProcess*)aProcess;
1.28 + Printf("NumChunks=%d\r\n",pP->iNumChunks);
1.29 + TInt i;
1.30 + for (i=0; i<pP->iNumChunks; i++)
1.31 + {
1.32 + DMemModelProcess::SChunkInfo& ci=pP->iChunks[i];
1.33 + Printf("%d: Chunk %08x, run %08x, access count %d\r\n",i,ci.iChunk,ci.iDataSectionBase,ci.iAccessCount);
1.34 + }
1.35 + }
1.36 +
1.37 +void Monitor::DumpChunkData(DChunk* aChunk)
1.38 + {
1.39 + DMemModelChunk* pC=(DMemModelChunk*)aChunk;
1.40 + Printf("Owning Process %08x\r\n",pC->iOwningProcess);
1.41 + Printf("Size %x, MaxSize %x, Base %08x\r\n",pC->iSize,pC->iMaxSize,pC->iBase);
1.42 + Printf("Attrib %x, StartPos %x\r\n",pC->iAttributes,pC->iStartPos);
1.43 + Printf("Type %d, State %d, Home Base %08x\r\n",pC->iChunkType,pC->iChunkState,pC->iHomeBase);
1.44 + Printf("Home Region Offset %08x\r\n",pC->iHomeRegionOffset);
1.45 + Printf("Home Region Base %08x\r\n",pC->iHomeRegionBase);
1.46 + Printf("Home Region Size %08x\r\n",pC->iHomeRegionSize);
1.47 + Printf("PTE: %08x, PDE: %08x %08x %08x\r\n", pC->iPtePermissions,
1.48 + pC->iPdePermissions[0],pC->iPdePermissions[1],pC->iPdePermissions[2]);
1.49 + Printf("NumPdes=%d, iPdes=%08x, iHomePdes=%08x\r\n",pC->iNumPdes,pC->iPdes,pC->iHomePdes);
1.50 + Printf("PdeBitMap=%08x, PageBitMap=%08x\r\n",
1.51 + pC->iPdeBitMap, pC->iPageBitMap);
1.52 + DumpCpuChunkData(pC);
1.53 + }
1.54 +
1.55 +void Monitor::MMProcessInfoCommand()
1.56 + {
1.57 + TScheduler* pS=TScheduler::Ptr();
1.58 + DMonObject* pA=(DMonObject*)pS->iAddressSpace;
1.59 + DMonObject* pV=(DMonObject*)pS->iExtras[0];
1.60 + DMonObject* pD=(DMonObject*)pS->iExtras[1];
1.61 + DMonObject* pC=(DMonObject*)pS->iExtras[2];
1.62 + Printf("TheCurrentAddressSpace=%08x\r\n",pA);
1.63 + Printf("TheCurrentVMProcess=%08x\r\n",pV);
1.64 + Monitor::DumpObjectData(pV,EProcess);
1.65 + Printf("TheCurrentDataSectionProcess=%08x\r\n",pD);
1.66 + Printf("TheCompleteDataSectionProcess=%08x\r\n",pC);
1.67 + Monitor::DumpObjectData(pC,EProcess);
1.68 + }
1.69 +
1.70 +void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg)
1.71 + {
1.72 + DMemModelCodeSeg* seg = (DMemModelCodeSeg*) aSeg;
1.73 + Printf(" iCodeAllocBase: %08x\r\n",seg->iCodeAllocBase);
1.74 + Printf(" iDataAllocBase: %08x\r\n",seg->iDataAllocBase);
1.75 + Printf(" iKernelData: %08x\r\n",seg->iKernelData);
1.76 + }
1.77 +
1.78 +EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread)
1.79 + {
1.80 + TLinAddr stackBase=aThread->iUserStackRunAddress;
1.81 + TLinAddr stackTop=stackBase+aThread->iUserStackSize;
1.82 + DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess;
1.83 + if (!pP || ((DMonObject*)pP)->Type()!=EProcess)
1.84 + return 0;
1.85 + for(TInt i=0 ; i<pP->iNumChunks ; ++i)
1.86 + {
1.87 + DMemModelProcess::SChunkInfo& info=pP->iChunks[i];
1.88 + DMemModelChunk* pC=info.iChunk;
1.89 + if (!pC || ((DMonObject*)pC)->Type()!=EChunk)
1.90 + continue;
1.91 + if (stackBase >= info.iDataSectionBase &&
1.92 + stackTop <= info.iDataSectionBase+pC->MaxSize())
1.93 + return (TUint)pC->iBase+(stackBase-info.iDataSectionBase);
1.94 + }
1.95 + return 0;
1.96 + }
1.97 +
1.98 +EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess*, TBool)
1.99 + {
1.100 + return KErrNone;
1.101 + }