os/kernelhwsrv/kernel/eka/memmodel/epoc/moving/mmonitor.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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\memmodel\epoc\moving\mmonitor.cpp
    15 // Kernel crash debugger - machine independent portion
    16 // 
    17 //
    18 
    19 #include <kernel/monitor.h>
    20 #include "memmodel.h"
    21 
    22 void Monitor::DumpMemModelProcessData(DProcess* aProcess)
    23 	{
    24 	DMemModelProcess* pP=(DMemModelProcess*)aProcess;
    25 	Printf("NumChunks=%d\r\n",pP->iNumChunks);
    26 	TInt i;
    27 	for (i=0; i<pP->iNumChunks; i++)
    28 		{
    29 		DMemModelProcess::SChunkInfo& ci=pP->iChunks[i];
    30 		Printf("%d: Chunk %08x, run %08x, access count %d\r\n",i,ci.iChunk,ci.iDataSectionBase,ci.iAccessCount);
    31 		}
    32 	}
    33 
    34 void Monitor::DumpChunkData(DChunk* aChunk)
    35 	{
    36 	DMemModelChunk* pC=(DMemModelChunk*)aChunk;
    37 	Printf("Owning Process %08x\r\n",pC->iOwningProcess);
    38 	Printf("Size %x, MaxSize %x, Base %08x\r\n",pC->iSize,pC->iMaxSize,pC->iBase);
    39 	Printf("Attrib %x, StartPos %x\r\n",pC->iAttributes,pC->iStartPos);
    40 	Printf("Type %d, State %d, Home Base %08x\r\n",pC->iChunkType,pC->iChunkState,pC->iHomeBase);
    41 	Printf("Home Region Offset %08x\r\n",pC->iHomeRegionOffset);
    42 	Printf("Home Region Base %08x\r\n",pC->iHomeRegionBase);
    43 	Printf("Home Region Size %08x\r\n",pC->iHomeRegionSize);
    44 	Printf("PTE: %08x, PDE: %08x %08x %08x\r\n", pC->iPtePermissions,
    45 					pC->iPdePermissions[0],pC->iPdePermissions[1],pC->iPdePermissions[2]);
    46 	Printf("NumPdes=%d, iPdes=%08x, iHomePdes=%08x\r\n",pC->iNumPdes,pC->iPdes,pC->iHomePdes);
    47 	Printf("PdeBitMap=%08x, PageBitMap=%08x\r\n",
    48 							pC->iPdeBitMap, pC->iPageBitMap);
    49 	DumpCpuChunkData(pC);
    50 	}
    51 
    52 void Monitor::MMProcessInfoCommand()
    53 	{
    54 	TScheduler* pS=TScheduler::Ptr();
    55 	DMonObject* pA=(DMonObject*)pS->iAddressSpace;
    56 	DMonObject* pV=(DMonObject*)pS->iExtras[0];
    57 	DMonObject* pD=(DMonObject*)pS->iExtras[1];
    58 	DMonObject* pC=(DMonObject*)pS->iExtras[2];
    59 	Printf("TheCurrentAddressSpace=%08x\r\n",pA);
    60 	Printf("TheCurrentVMProcess=%08x\r\n",pV);
    61 	Monitor::DumpObjectData(pV,EProcess);
    62 	Printf("TheCurrentDataSectionProcess=%08x\r\n",pD);
    63 	Printf("TheCompleteDataSectionProcess=%08x\r\n",pC);
    64 	Monitor::DumpObjectData(pC,EProcess);
    65 	}
    66 
    67 void Monitor::MDisplayCodeSeg(DCodeSeg* aSeg)
    68 	{
    69 	DMemModelCodeSeg* seg = (DMemModelCodeSeg*) aSeg;
    70 	Printf("   iCodeAllocBase: %08x\r\n",seg->iCodeAllocBase);
    71 	Printf("   iDataAllocBase: %08x\r\n",seg->iDataAllocBase);
    72 	Printf("   iKernelData: %08x\r\n",seg->iKernelData);
    73 	}
    74 	
    75 EXPORT_C TUint Monitor::MapAndLocateUserStack(DThread* aThread)	
    76 	{
    77  	TLinAddr stackBase=aThread->iUserStackRunAddress;
    78  	TLinAddr stackTop=stackBase+aThread->iUserStackSize;
    79 	DMemModelProcess* pP=(DMemModelProcess*)aThread->iOwningProcess;
    80 	if (!pP || ((DMonObject*)pP)->Type()!=EProcess)
    81 		return 0;
    82 	for(TInt i=0 ; i<pP->iNumChunks ; ++i)
    83 		{
    84 		DMemModelProcess::SChunkInfo& info=pP->iChunks[i];
    85 		DMemModelChunk* pC=info.iChunk;
    86 		if (!pC || ((DMonObject*)pC)->Type()!=EChunk)
    87 			continue;
    88 		if (stackBase >= info.iDataSectionBase  &&
    89 			stackTop <= info.iDataSectionBase+pC->MaxSize())
    90 			return (TUint)pC->iBase+(stackBase-info.iDataSectionBase);
    91 		}
    92 	return 0;
    93 	}
    94 
    95 EXPORT_C TInt Monitor::SwitchAddressSpace(DProcess*, TBool)
    96 	{
    97 	return KErrNone;
    98 	}