os/kernelhwsrv/kerneltest/e32test/mmu/mmudetect.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/mmu/mmudetect.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,63 @@
     1.4 +// Copyright (c) 1998-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 +// e32test\mmu\mmudetect.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __MMUDETECT_H__
    1.22 +#define __MMUDETECT_H__
    1.23 +
    1.24 +#include "u32std.h"
    1.25 +#include <e32rom.h>
    1.26 +#include <e32svr.h>
    1.27 +
    1.28 +inline TUint32 MemModelAttributes()
    1.29 +	{ return (TUint32)UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemModelInfo, NULL, NULL); }
    1.30 +
    1.31 +inline TUint32 MemModelType()
    1.32 +	{ return MemModelAttributes() & EMemModelTypeMask; }
    1.33 +
    1.34 +inline TBool HaveMMU()
    1.35 +	{ return MemModelAttributes()&EMemModelAttrVA; }
    1.36 +
    1.37 +inline TBool HaveVirtMem()
    1.38 +	{ return MemModelAttributes()&EMemModelAttrVA; }
    1.39 +
    1.40 +inline TBool HaveMultAddr()
    1.41 +	{ return (MemModelAttributes()&(EMemModelAttrProcessProt|EMemModelAttrSameVA))
    1.42 +									==(EMemModelAttrProcessProt|EMemModelAttrSameVA); }
    1.43 +
    1.44 +inline TBool HaveProcessProt()
    1.45 +	{ return (MemModelAttributes()&EMemModelAttrProcessProt); }
    1.46 +
    1.47 +inline TBool HaveDirectKernProt()
    1.48 +	{ return (MemModelAttributes()&EMemModelAttrKernProt); }
    1.49 +
    1.50 +inline TBool HaveIPCKernProt()
    1.51 +	{ return (MemModelAttributes()&EMemModelAttrIPCKernProt); }
    1.52 +
    1.53 +inline TBool HaveWriteProt()
    1.54 +	{ return (MemModelAttributes()&EMemModelAttrWriteProt); }
    1.55 +
    1.56 +#ifdef __EPOC32__
    1.57 +inline TUint8* KernData()
    1.58 +	{
    1.59 +	const TRomHeader& romHdr=*(const TRomHeader*)UserSvr::RomHeaderAddress();
    1.60 +	return (TUint8*)romHdr.iKernDataAddress;
    1.61 +	}
    1.62 +#else
    1.63 +inline TUint8* KernData()
    1.64 +	{ return NULL; }
    1.65 +#endif
    1.66 +#endif