os/kernelhwsrv/kernel/eka/include/memmodel/epoc/plat_priv.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 // e32\include\memmodel\epoc\plat_priv.h
    15 // 
    16 // WARNING: This file contains some APIs which are internal and are subject
    17 //          to change without notice. Such APIs should therefore not be used
    18 //          outside the Kernel and Hardware Services package.
    19 //
    20 
    21 #ifndef __M32KERN_H__
    22 #define __M32KERN_H__
    23 #include <kernel/kern_priv.h>
    24 #include <platform.h>
    25 #include <e32def_private.h>
    26 
    27 /** Hardware Variant Discriminator
    28 
    29 @internalTechnology
    30 */
    31 class THardwareVariant
    32 	{
    33 public:
    34 	inline THardwareVariant();
    35 	inline THardwareVariant(TUint aVariant);
    36 	inline operator TUint();
    37 	inline TBool IsIndependent();
    38 	inline TBool IsCpu();
    39 	inline TBool IsCompatibleWith(TUint aCpu, TUint aAsic, TUint aVMask);
    40 private:
    41 	inline TUint Layer();
    42 	inline TUint Parent();
    43 	inline TUint VMask();
    44 private:
    45 	TUint iVariant;
    46 	};
    47 
    48 /**
    49 @internalTechnology
    50 */
    51 inline THardwareVariant::THardwareVariant()
    52 	{iVariant=0x01000000;}
    53 
    54 /**
    55 @internalTechnology
    56 */
    57 inline THardwareVariant::THardwareVariant(TUint aVariant)
    58 	{iVariant=aVariant;}
    59 
    60 /**
    61 @internalTechnology
    62 */
    63 inline THardwareVariant::operator TUint()
    64 	{return iVariant;}
    65 
    66 /**
    67 @internalTechnology
    68 */
    69 inline TUint THardwareVariant::Layer()
    70 	{return iVariant>>24;}
    71 
    72 /**
    73 @internalTechnology
    74 */
    75 inline TUint THardwareVariant::Parent()
    76 	{return (iVariant>>16)&0xff;}
    77 
    78 /**
    79 @internalTechnology
    80 */
    81 inline TUint THardwareVariant::VMask()
    82 	{return iVariant&0xffff;}
    83 
    84 /**
    85 @internalTechnology
    86 */
    87 inline TBool THardwareVariant::IsIndependent()
    88 	{return (Layer()<=3);}
    89 
    90 /**
    91 @internalTechnology
    92 */
    93 inline TBool THardwareVariant::IsCpu()
    94 	{return (Parent()==3);}
    95 
    96 /**
    97 @internalTechnology
    98 */
    99 inline TBool THardwareVariant::IsCompatibleWith(TUint aCpu, TUint aAsic, TUint aVMask)
   100 	{ return(Layer()<=3 || (Parent()==3 && Layer()==aCpu) ||
   101 		(Layer()==aAsic && (VMask() & aVMask)!=0) );}
   102 
   103 
   104 /** Functions/Data defined in layer 2 or below of the kernel and not available to layer 1.
   105 
   106 @internalComponent
   107 */
   108 class PP
   109 	{
   110 public:
   111 	enum TPlatPanic
   112 		{
   113 		EInitialSystemTimeInvalid=0,
   114 		EInvalidStartupReason=1,
   115 		EIncorrectDllDataAddress=2,
   116 		ENoDllDataChunk=3,
   117 		EUnsupportedOldBinary=4,
   118     	};
   119 
   120 	static void Panic(TPlatPanic aPanic);
   121 	static void InitSuperPageFromRom(TLinAddr aRomHeader, TLinAddr aSuperPage);
   122 public:
   123 	static TInt RamDriveMaxSize;
   124 	static TInt RamDriveRange;
   125 	static TUint32 NanoWaitCal;
   126 	static DChunk* TheRamDriveChunk;
   127 	static TLinAddr RamDriveStartAddress;
   128 	static TInt MaxUserThreadStack;
   129 	static TInt UserThreadStackGuard;
   130 	static TInt MaxStackSpacePerProcess;
   131 	static TInt SupervisorThreadStackGuard;
   132 	static TUint32 MonitorEntryPoint[3];
   133 	static TLinAddr RomRootDirAddress;
   134 public:
   135 	};
   136 
   137 extern "C" {
   138 extern TLinAddr RomHeaderAddress;
   139 }
   140 
   141 /********************************************
   142  * Code segment
   143  ********************************************/
   144 
   145 /**
   146 @internalComponent
   147 */
   148 struct SRamCodeInfo
   149 	{
   150 	TInt iCodeSize;
   151 	TInt iTextSize;
   152 	TLinAddr iCodeRunAddr;
   153 	TLinAddr iCodeLoadAddr;
   154 	TInt iDataSize;
   155 	TInt iBssSize;
   156 	TLinAddr iDataRunAddr;
   157 	TLinAddr iDataLoadAddr;
   158 	TInt iConstOffset; // not used
   159 	TLinAddr iExportDir;
   160 	TInt iExportDirCount;
   161 	TLinAddr iExceptionDescriptor;
   162 	};
   163 
   164 
   165 class DEpocCodeSeg;
   166 
   167 /**
   168 @internalComponent
   169 */
   170 class DEpocCodeSegMemory : public DBase
   171 	{
   172 public:
   173 	static DEpocCodeSegMemory* New(DEpocCodeSeg* aCodeSeg);
   174 	TInt Open();
   175 	TInt Close();
   176 protected:
   177 	DEpocCodeSegMemory(DEpocCodeSeg* aCodeSeg);
   178 public:
   179 	TInt iAccessCount;
   180 	SRamCodeInfo iRamInfo;
   181 	DEpocCodeSeg* iCodeSeg;
   182 	};
   183 
   184 
   185 /**
   186 @internalComponent
   187 */
   188 class DEpocCodeSeg : public DCodeSeg
   189 	{
   190 public:
   191 	virtual ~DEpocCodeSeg();
   192 	void Destruct();
   193 public:
   194 	virtual void Info(TCodeSegCreateInfo& aInfo);
   195 	virtual TLibraryFunction Lookup(TInt aOrdinal);
   196 	virtual TInt GetMemoryInfo(TModuleMemoryInfo& aInfo, DProcess* aProcess);
   197 	virtual TInt DoCreate(TCodeSegCreateInfo& aInfo, DProcess* aProcess);
   198 	virtual void InitData();
   199 	virtual TInt Loaded(TCodeSegCreateInfo& aInfo);
   200 	virtual TInt DoCreateRam(TCodeSegCreateInfo& aInfo, DProcess* aProcess)=0;
   201 	virtual TInt DoCreateXIP(DProcess* aProcess)=0;
   202 public:
   203 	inline SRamCodeInfo& RamInfo()
   204 		{return *(SRamCodeInfo*)iInfo;}
   205 	inline const TRomImageHeader& RomInfo()
   206 		{return *(const TRomImageHeader*)iInfo;}
   207 	void GetDataSizeAndBase(TInt& aTotalDataSizeOut, TLinAddr& aDataBaseOut);
   208 public:
   209 	TUint8 iXIP;		// TRUE for XIP ROM code
   210 	const TAny* iInfo;	// pointer to TRomImageHeader or SRamCodeInfo
   211 	DEpocCodeSegMemory* iMemory;
   212 	TCodeSegLoaderCookieList* iLoaderCookie;
   213 	};
   214 
   215 /********************************************
   216  * Process control block
   217  ********************************************/
   218 
   219 /**
   220 @internalComponent
   221 */
   222 class DEpocProcess : public DProcess
   223 	{
   224 public:
   225 	virtual TInt AttachExistingCodeSeg(TProcessCreateInfo& aInfo);
   226 	};
   227 
   228 /**
   229 @internalComponent
   230 */
   231 inline const TRomHeader& TheRomHeader()
   232 	{return *((const TRomHeader *)RomHeaderAddress);}
   233 
   234 #endif