os/kernelhwsrv/kernel/eka/memmodel/epoc/multiple/x86/xmonitor.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\multiple\x86\xmonitor.cpp
    15 // Kernel crash debugger - ARM specific portion
    16 // 
    17 //
    18 
    19 #include <kernel/monitor.h>
    20 #include <x86_mem.h>
    21 
    22 void SetPageDir(DMemModelProcess* aProcess);
    23 
    24 void Monitor::CpuInit()
    25 	{
    26 	}
    27 
    28 void Monitor::DumpCpuProcessData(DProcess* aProcess)
    29 	{
    30 	}
    31 
    32 void Monitor::DumpCpuChunkData(DChunk* aChunk)
    33 	{
    34 	}
    35 
    36 
    37 // From xmmu.cpp:
    38 const TUint32 KPdePteAccessed=0x20;
    39 const TUint32 KPdePteDirty=0x40;
    40 
    41 // Mask to ignore accessed and dirty bits
    42 const TUint32 KPdeEqualMask=~(KPdePteAccessed|KPdePteDirty);
    43 
    44 TBool PdesEqual(const TPde* aLeft, const TPde* aRight, TLinAddr aBase, TLinAddr aEnd)
    45 	{
    46 	for (TUint addr = aBase ; addr != aEnd ; addr += (1 << KChunkShift))
    47 		{
    48 		TUint i = addr >> KChunkShift;		
    49 		if ((aLeft[i] & KPdeEqualMask) != (aRight[i] & KPdeEqualMask))
    50 			return EFalse;
    51 		}	
    52 	return ETrue;
    53 	}
    54 
    55 TInt MapProcess(DMemModelProcess* aProcess, TBool aForce)
    56 	{
    57 	// Check top half of page dir is same as for the kernel
    58 	TUint a = (TUint)aProcess;
    59 	DMonObject* o = (DMonObject*)aProcess;
    60 	if (a<KPrimaryIOBase || a>=KKernelSectionEnd || (a&3))
    61 		return KErrArgument;
    62 	if (o->Type()!=EProcess)
    63 		return KErrArgument;
    64 
    65 	const TPde* kpd=(const TPde*)KPageDirectoryBase;
    66 	const TPde* ppd=(const TPde*)(KPageDirectoryBase+(aProcess->iOsAsid<<KPageTableShift));
    67 	if (!PdesEqual(kpd, ppd, KRomLinearBase, KUserGlobalDataEnd) ||		// ROM + user global
    68 		!PdesEqual(kpd, ppd, KRamDriveEndAddress, 0x00000000))			// kernel mappings
    69 		{
    70 		if (!aForce)
    71 			return KErrCorrupt;
    72 		wordmove((TAny*)(ppd+(KRomLinearBase>>KChunkShift)), (TAny*)(kpd+(KRomLinearBase>>KChunkShift)), ((KUserGlobalDataEnd-KRomLinearBase)>>KChunkShift)*sizeof(TPde));
    73 		wordmove((TAny*)(ppd+(KRamDriveEndAddress>>KChunkShift)), (TAny*)(kpd+(KRamDriveEndAddress>>KChunkShift)), ((0-KRamDriveEndAddress)>>KChunkShift)*sizeof(TPde));
    74 		}
    75 	SetPageDir(aProcess);
    76 	return KErrNone;
    77 	}