os/kernelhwsrv/kerneltest/e32test/mmu/mmudetect.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1998-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 // e32test\mmu\mmudetect.h
    15 // 
    16 //
    17 
    18 #ifndef __MMUDETECT_H__
    19 #define __MMUDETECT_H__
    20 
    21 #include "u32std.h"
    22 #include <e32rom.h>
    23 #include <e32svr.h>
    24 
    25 inline TUint32 MemModelAttributes()
    26 	{ return (TUint32)UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL); }
    27 
    28 inline TUint32 MemModelType()
    29 	{ return MemModelAttributes() & EMemModelTypeMask; }
    30 
    31 inline TBool HaveMMU()
    32 	{ return MemModelAttributes()&EMemModelAttrVA; }
    33 
    34 inline TBool HaveVirtMem()
    35 	{ return MemModelAttributes()&EMemModelAttrVA; }
    36 
    37 inline TBool HaveMultAddr()
    38 	{ return (MemModelAttributes()&(EMemModelAttrProcessProt|EMemModelAttrSameVA))
    39 									==(EMemModelAttrProcessProt|EMemModelAttrSameVA); }
    40 
    41 inline TBool HaveProcessProt()
    42 	{ return (MemModelAttributes()&EMemModelAttrProcessProt); }
    43 
    44 inline TBool HaveDirectKernProt()
    45 	{ return (MemModelAttributes()&EMemModelAttrKernProt); }
    46 
    47 inline TBool HaveIPCKernProt()
    48 	{ return (MemModelAttributes()&EMemModelAttrIPCKernProt); }
    49 
    50 inline TBool HaveWriteProt()
    51 	{ return (MemModelAttributes()&EMemModelAttrWriteProt); }
    52 
    53 #ifdef __EPOC32__
    54 inline TUint8* KernData()
    55 	{
    56 	const TRomHeader& romHdr=*(const TRomHeader*)UserSvr::RomHeaderAddress();
    57 	return (TUint8*)romHdr.iKernDataAddress;
    58 	}
    59 #else
    60 inline TUint8* KernData()
    61 	{ return NULL; }
    62 #endif
    63 #endif