os/kernelhwsrv/kernel/eka/include/memmodel/epoc/moving/memmodel.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/memmodel/epoc/moving/memmodel.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,438 @@
     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 +// e32\include\memmodel\epoc\moving\memmodel.h
    1.18 +// 
    1.19 +// WARNING: This file contains some APIs which are internal and are subject
    1.20 +//          to change without notice. Such APIs should therefore not be used
    1.21 +//          outside the Kernel and Hardware Services package.
    1.22 +//
    1.23 +
    1.24 +#ifndef __MEMMODEL_H__
    1.25 +#define __MEMMODEL_H__
    1.26 +#include <memmodel/epoc/mmubase/mmubase.h>
    1.27 +
    1.28 +/********************************************
    1.29 + * Deterministic Scheduler Implementation
    1.30 + ********************************************/
    1.31 +
    1.32 +/**
    1.33 +@internalComponent
    1.34 +*/
    1.35 +#define TheCurrentAddressSpace			((DMemModelProcess*&)TheScheduler.iAddressSpace)
    1.36 +
    1.37 +/**
    1.38 +@internalComponent
    1.39 +*/
    1.40 +#define TheCurrentVMProcess				((DMemModelProcess*&)TheScheduler.iExtras[0])
    1.41 +
    1.42 +/**
    1.43 +@internalComponent
    1.44 +*/
    1.45 +#define TheCurrentDataSectionProcess	((DMemModelProcess*&)TheScheduler.iExtras[1])
    1.46 +
    1.47 +/**
    1.48 +@internalComponent
    1.49 +*/
    1.50 +#define TheCompleteDataSectionProcess	((DMemModelProcess*&)TheScheduler.iExtras[2])
    1.51 +
    1.52 +/**
    1.53 +@internalComponent
    1.54 +*/
    1.55 +#define FlushProgress					((TInt&)TheScheduler.iExtras[3])
    1.56 +
    1.57 +
    1.58 +/********************************************
    1.59 + * Process Control Block
    1.60 + ********************************************/
    1.61 +/**
    1.62 +@internalComponent
    1.63 +*/
    1.64 +const TInt KMaxChunksInProcess=16;
    1.65 +
    1.66 +class DMemModelChunk;
    1.67 +/**
    1.68 +@internalComponent
    1.69 +*/
    1.70 +class DMemModelProcess : public DEpocProcess
    1.71 +	{
    1.72 +public:
    1.73 +	void Destruct();
    1.74 +public:
    1.75 +	virtual TInt DoCreate(TBool aKernelProcess, TProcessCreateInfo& aInfo);
    1.76 +	virtual TInt NewChunk(DChunk*& aChunk, SChunkCreateInfo& anInfo, TLinAddr& aRunAddr);
    1.77 +	virtual TInt AddChunk(DChunk* aChunk,TBool isReadOnly);
    1.78 +	virtual TInt NewShPool(DShPool*& aPool, TShPoolCreateInfo& aInfo);
    1.79 +	virtual TInt CreateDataBssStackArea(TProcessCreateInfo& aInfo);
    1.80 +	virtual TInt MapCodeSeg(DCodeSeg* aCodeSeg);
    1.81 +	virtual void UnmapCodeSeg(DCodeSeg* aCodeSeg);
    1.82 +	virtual void RemoveDllData();
    1.83 +	virtual void FinalRelease();
    1.84 +public:
    1.85 +	virtual TInt GetNewChunk(DMemModelChunk*& aChunk, SChunkCreateInfo& anInfo)=0;
    1.86 +	virtual TInt AddFixedAccessChunk(DMemModelChunk *aChunk)=0;
    1.87 +	virtual TInt RemoveFixedAccessChunk(DMemModelChunk *aChunk)=0;
    1.88 +	virtual void CheckForFixedAccess()=0;
    1.89 +	virtual void DoAttributeChange()=0;
    1.90 +public:
    1.91 +	TInt AddChunk(DMemModelChunk* aChunk, TLinAddr& aDataSectionBase, TBool isReadOnly);
    1.92 +	TInt AllocateDataSectionBase(DMemModelChunk& aChunk, TUint& aBase);
    1.93 +	TUint8* DataSectionBase(DMemModelChunk* aChunk);
    1.94 +	void RemoveChunk(DMemModelChunk *aChunk);
    1.95 +	void DoRemoveChunk(TInt aIndex);
    1.96 +	TInt ChunkIndex(DMemModelChunk* aChunk,TInt& aPos);
    1.97 +	TInt CreateDllDataChunk();
    1.98 +	void FreeDllDataChunk();
    1.99 +	TInt CommitDllData(TLinAddr aBase, TInt aSize);
   1.100 +	void DecommitDllData(TLinAddr aBase, TInt aSize);
   1.101 +public:
   1.102 +	enum TMemModelProcessAttributes
   1.103 +		{
   1.104 +		EFixedAddress=1,
   1.105 +		EMoving=0x40000000,
   1.106 +		EVariableAccess=0x20000000,
   1.107 +//		EMovingCode=0x10000000,		NEVER USED
   1.108 +		EVariableCode=0x04000000,
   1.109 +		EMMProcessAttributesMask = EFixedAddress|EMoving|EVariableAccess|EVariableCode,
   1.110 +		};
   1.111 +
   1.112 +	struct SChunkInfo
   1.113 +		{
   1.114 +		TLinAddr iDataSectionBase;
   1.115 +		DMemModelChunk *iChunk;
   1.116 +		TInt16 iAccessCount;
   1.117 +		TInt16 isReadOnly;
   1.118 +		};
   1.119 +
   1.120 +	TInt iNumChunks;
   1.121 +	SChunkInfo iChunks[KMaxChunksInProcess];
   1.122 +	TInt iNumMovingChunks;
   1.123 +	TInt iNumNonFixedAccessChunks;
   1.124 +	TInt iNumNonFixedAccessCodeChunks;
   1.125 +	DMemModelChunk* iDllDataChunk;
   1.126 +public:
   1.127 +	friend class Monitor;
   1.128 +	};
   1.129 +
   1.130 +
   1.131 +/********************************************
   1.132 + * Chunk Control Block
   1.133 + ********************************************/
   1.134 +/**
   1.135 +@internalComponent
   1.136 +*/
   1.137 +class DMemModelChunk : public DChunk
   1.138 +	{
   1.139 +public:
   1.140 +	/**
   1.141 +	@see DChunk::TChunkAttributes for generic attribute flags
   1.142 +	*/
   1.143 +	enum TMemModelChunkAttributes
   1.144 +		{
   1.145 +		EFixedAccess	=0x80000000,
   1.146 +		EFixedAddress	=0x40000000,
   1.147 +		EPrivate		=0x10000000,
   1.148 +		ECode			=0x08000000,
   1.149 +
   1.150 +		EMMChunkAttributesMask = EFixedAccess | EFixedAddress | EPrivate | ECode,
   1.151 +		};
   1.152 +
   1.153 +	enum TChunkState {ENotRunning=0, ERunningRO=1, ERunningRW=2};
   1.154 +public:
   1.155 +	DMemModelChunk();
   1.156 +	void Destruct();
   1.157 +public:
   1.158 +	virtual TInt Close(TAny* aPtr);
   1.159 +	virtual TInt DoCreate(SChunkCreateInfo& anInfo);
   1.160 +	virtual TInt Adjust(TInt aNewSize);
   1.161 +	virtual TInt AdjustDoubleEnded(TInt aBottom, TInt aTop);
   1.162 +	virtual TInt CheckAccess();
   1.163 +	virtual TInt Commit(TInt anOffset, TInt aSize, TCommitType aCommitType=DChunk::ECommitDiscontiguous, TUint32* aExtraArg=0);
   1.164 +	virtual TInt Allocate(TInt aSize, TInt aGuard=0, TInt aAlign=0);
   1.165 +	TInt Decommit(TInt anOffset, TInt aSize);
   1.166 +	virtual TInt Lock(TInt anOffset, TInt aSize);
   1.167 +	virtual TInt Unlock(TInt anOffset, TInt aSize);
   1.168 +	virtual TInt Address(TInt aOffset, TInt aSize, TLinAddr& aKernelAddress);
   1.169 +	virtual TInt PhysicalAddress(TInt aOffset, TInt aSize, TLinAddr& aKernelAddress, TUint32& aPhysicalAddress, TUint32* aPhysicalPageList=NULL);
   1.170 +	virtual void BTracePrime(TInt aCategory);
   1.171 +	virtual void Substitute(TInt aOffset, TPhysAddr aOldAddr, TPhysAddr aNewAddr);
   1.172 +	virtual TUint8* Base(DProcess* aProcess);
   1.173 +	inline TUint8* Base() const { return DChunk::Base(); }
   1.174 +public:
   1.175 +	TInt Decommit(TInt aOffset, TInt aSize, TDecommitType aDecommitType);
   1.176 +	TInt FindFree(TInt aSize, TInt aGuard, TInt aAlign);
   1.177 +	void SetFixedAddress(TLinAddr anAddr, TInt anInitialSize);
   1.178 +	TInt Reserve(TInt anInitialSize);
   1.179 +	TUint32 ApplyTopLevelPermissions(TChunkState aChunkState);
   1.180 +	TUint32 MoveToRunAddress(TLinAddr aLinearAddr,TChunkState aChunkState);
   1.181 +	TUint32 MoveToHomeSection();
   1.182 +	TZonePageType GetPageType();
   1.183 +protected:
   1.184 +	TInt DoCommit(TInt aOffset, TInt aSize, TCommitType aCommitType=DChunk::ECommitDiscontiguous, TUint32* aExtraArg=0);
   1.185 +	void DoDecommit(TInt aOffset, TInt aSize, TDecommitType aDecommitType=EDecommitNormal);
   1.186 +private:
   1.187 +	void ClaimInitialPages();
   1.188 +	TInt ExpandHomeRegion(TInt anOffset, TInt aSize);
   1.189 +	TLinAddr AllocateHomeAddress(TInt aSize);
   1.190 +	void DeallocateHomeAddress();
   1.191 +	TLinAddr ReallocateHomeAddress(TInt aNewSize);
   1.192 +	TInt DoAllocate(TInt aSize, TInt aGuard, TInt aAlign, TBool aCommit);
   1.193 +private:
   1.194 +	virtual TInt SetupPermissions()=0;
   1.195 +	virtual void AddPde(TInt anOffset)=0;
   1.196 +	virtual void RemovePde(TInt anOffset)=0;
   1.197 +	virtual void MoveHomePdes(TLinAddr anOldAddr, TLinAddr aNewAddr)=0;
   1.198 +	virtual void MoveCurrentPdes(TLinAddr anOldAddr, TLinAddr aNewAddr)=0;
   1.199 +public:
   1.200 +	TChunkState iChunkState;
   1.201 +	TPte iPtePermissions;
   1.202 +	TPde iPdePermissions[3];	// indexed by iChunkState
   1.203 +	TInt iHomeRegionOffset;
   1.204 +	TInt iHomeRegionSize;
   1.205 +	TLinAddr iHomeRegionBase;
   1.206 +	TLinAddr iHomeBase;
   1.207 +	TInt iNumPdes;
   1.208 +	TPde* iPdes;
   1.209 +	TPde* iHomePdes;
   1.210 +	TUint32* iPdeBitMap;
   1.211 +	TBitMapAllocator* iPageBitMap;
   1.212 +	TBitMapAllocator* iPermanentPageBitMap;
   1.213 +public:
   1.214 +	friend class Monitor;
   1.215 +	};
   1.216 +
   1.217 +
   1.218 +/********************************************
   1.219 + * Code segment
   1.220 + ********************************************/
   1.221 +
   1.222 +class DMemModelCodeSegMemory : public DMmuCodeSegMemory
   1.223 +	{
   1.224 +public:
   1.225 +	DMemModelCodeSegMemory(DEpocCodeSeg* aCodeSeg);
   1.226 +	~DMemModelCodeSegMemory();
   1.227 +	TInt Create(TCodeSegCreateInfo& aInfo);
   1.228 +	TInt Loaded(TCodeSegCreateInfo& aInfo);
   1.229 +	void Destroy();
   1.230 +	};
   1.231 +
   1.232 +/**
   1.233 +@internalComponent
   1.234 +*/
   1.235 +class DMemModelCodeSeg: public DEpocCodeSeg
   1.236 +	{
   1.237 +public:
   1.238 +	DMemModelCodeSeg();
   1.239 +	virtual ~DMemModelCodeSeg();
   1.240 +	virtual TInt DoCreateRam(TCodeSegCreateInfo& aInfo, DProcess* aProcess);
   1.241 +	virtual TInt DoCreateXIP(DProcess* aProcess);
   1.242 +	virtual TInt Loaded(TCodeSegCreateInfo& aInfo);
   1.243 +	virtual void ReadExportDir(TUint32* aDest);
   1.244 +	virtual TBool FindCheck(DProcess* aProcess);
   1.245 +	virtual TBool OpenCheck(DProcess* aProcess);
   1.246 +	inline DMemModelCodeSegMemory* Memory()
   1.247 +		{ return (DMemModelCodeSegMemory*)iMemory; }
   1.248 +public:
   1.249 +	TInt iCodeAllocBase;
   1.250 +	TInt iDataAllocBase;
   1.251 +	TAny* iKernelData;			// only for kernel modules
   1.252 +	};
   1.253 +
   1.254 +
   1.255 +/********************************************
   1.256 + * MMU stuff
   1.257 + ********************************************/
   1.258 +
   1.259 +typedef void (*TCopyPageFn)(TLinAddr aDest, TLinAddr aSrc);
   1.260 +
   1.261 +/**
   1.262 +@internalComponent
   1.263 +*/
   1.264 +class Mmu : public MmuBase
   1.265 +	{
   1.266 +public:
   1.267 +	enum TFlushFlags	{
   1.268 +						EFlushDTLB=0x01,
   1.269 +						EFlushDCache=0x02,
   1.270 +						EFlushITLB=0x04,
   1.271 +						EFlushICache=0x08,
   1.272 +						EFlushDDecommit=0x80000000,
   1.273 +						EFlushDPermChg=0x20000000,		// =DProcess::EVariableAccess
   1.274 +						EFlushDMove=0x40000000,			// =DProcess::EMoving
   1.275 +						EFlushIPermChg=0x04000000,		// =DProcess::EVariableCode
   1.276 +						EFlushIMove=0x10000000,			// =DProcess::EMovingCode
   1.277 +						EFlushInheritMask=EFlushDPermChg|EFlushDMove|EFlushIPermChg|EFlushIMove,
   1.278 +						};
   1.279 +
   1.280 +	enum TPanic
   1.281 +		{
   1.282 +		EBadInitialPageAddr,
   1.283 +		EAssignPageTableInvalidUsage,
   1.284 +		EUserCodeAllocatorCreateFailed,
   1.285 +		EDllDataAllocatorCreateFailed,
   1.286 +		ERomUserDataAddressInvalid,
   1.287 +		ERomUserDataSizeInvalid,
   1.288 +		ERomLinearAddressInvalid,
   1.289 +		ERemapPageFailed,
   1.290 +		ERemapPageTableFailed,
   1.291 +		ENoCopyPageFunction,
   1.292 +		EFixupXPTFailed,
   1.293 +		ECacheMaintenance,
   1.294 +		EDefragDisablePageFailed,
   1.295 +		EDefragFaultWhilstFMHeld,
   1.296 +		EDefragKernelChunkNoPageTable,
   1.297 +		};
   1.298 +
   1.299 +public:
   1.300 +	inline TPde& PDE(TLinAddr aAddr)
   1.301 +		{return *(((TPde*)iPdeBase)+(aAddr>>iChunkShift));}
   1.302 +
   1.303 +	// virtual - inherited/overridden from MmuBase
   1.304 +	virtual void Init1();
   1.305 +//	virtual void Init2();
   1.306 +	virtual void DoInit2();
   1.307 +//	virtual TBool PteIsPresent(TPte aPte)=0;
   1.308 +//	virtual TPhysAddr PtePhysAddr(TPte aPte, TInt aPteIndex)=0;
   1.309 +//	virtual TPhysAddr PdePhysAddr(TLinAddr aAddr)=0;
   1.310 +	virtual void SetupInitialPageInfo(SPageInfo* aPageInfo, TLinAddr aChunkAddr, TInt aPdeIndex);
   1.311 +	virtual void SetupInitialPageTableInfo(TInt aId, TLinAddr aChunkAddr, TInt aNumPtes);
   1.312 +	virtual void AssignPageTable(TInt aId, TInt aUsage, TAny* aObject, TLinAddr aAddr, TPde aPdePerm);
   1.313 +	virtual TInt UnassignPageTable(TLinAddr aAddr);
   1.314 +//	virtual void BootstrapPageTable(TInt aXptId, TPhysAddr aXptPhys, TInt aId, TPhysAddr aPhysAddr)=0;
   1.315 +	virtual TInt PageTableId(TLinAddr aAddr);
   1.316 +//	virtual TInt BootPageTableId(TLinAddr aAddr, TPhysAddr& aPtPhys)=0;
   1.317 +//	virtual void ClearPageTable(TInt aId, TInt aFirstIndex=0)=0;
   1.318 +//	virtual TPhysAddr LinearToPhysical(TLinAddr aAddr)=0;
   1.319 +//	virtual TInt LinearToPhysical(TLinAddr aAddr, TInt aSize, TPhysAddr& aPhysicalAddress, TPhysAddr* aPhysicalPageList=NULL)=0;
   1.320 +//	virtual void MapRamPages(TInt aId, SPageInfo::TType aType, TAny* aPtr, TUint32 aOffset, const TPhysAddr* aPageList, TInt aNumPages, TPte aPtePerm)=0;
   1.321 +//	virtual void MapPhysicalPages(TInt aId, SPageInfo::TType aType, TAny* aPtr, TUint32 aOffset, TPhysAddr aPhysAddr, TInt aNumPages, TPte aPtePerm)=0;
   1.322 +//	virtual TInt UnmapPages(TInt aId, TUint32 aAddr, TInt aNumPages, TPhysAddr* aPageList, TBool aSetPagesFree, TInt& aNumPtes, TInt& aNumFree, DProcess* aProcess)=0;
   1.323 +//	virtual void ClearRamDrive(TLinAddr aStart)=0;
   1.324 +//	virtual TInt PdePtePermissions(TUint& aMapAttr, TPde& aPde, TPte& aPte)=0;
   1.325 +//	virtual void Map(TLinAddr aLinAddr, TPhysAddr aPhysAddr, TInt aSize, TPde aPdePerm, TPte aPtePerm, TInt aMapShift)=0;
   1.326 +//	virtual void Unmap(TLinAddr aLinAddr, TInt aSize)=0;
   1.327 +//	virtual void InitShadowPageTable(TInt aId, TLinAddr aRomAddr, TPhysAddr aOrigPhys)=0;
   1.328 +//	virtual void InitShadowPage(TPhysAddr aShadowPhys, TLinAddr aRomAddr)=0;
   1.329 +//	virtual void DoUnmapShadowPage(TInt aId, TLinAddr aRomAddr, TPhysAddr aOrigPhys)=0;
   1.330 +//	virtual TInt UnassignShadowPageTable(TLinAddr aRomAddr, TPhysAddr aOrigPhys)=0;
   1.331 +//	virtual void DoFreezeShadowPage(TInt aId, TLinAddr aRomAddr)=0;
   1.332 +//	virtual void FlushShadow(TLinAddr aRomAddr)=0;
   1.333 +//	virtual void AssignShadowPageTable(TInt aId, TLinAddr aRomAddr)=0;
   1.334 +//	virtual void ClearPages(TInt aNumPages, TPhysAddr* aPageList)=0;
   1.335 +	virtual TPte PtePermissions(TChunkType aChunkType)=0;
   1.336 +	virtual TInt MoveKernelPage(DChunk* aChunk, TUint32 aOffset, TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest);
   1.337 +	virtual TInt MoveCodeSegMemoryPage(DMemModelCodeSegMemory* aCodeSegMemory, TUint32 aOffset, TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest);
   1.338 +	virtual TInt MoveCodeChunkPage(DChunk* aChunk, TUint32 aOffset, TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest);
   1.339 +	virtual TInt MoveDataChunkPage(DChunk* aChunk, TUint32 aOffset, TPhysAddr aOld, TPhysAddr& aNew, TUint aBlockZoneId, TBool aBlockRest);
   1.340 +
   1.341 +	// pure virtual - new in Mmu
   1.342 +	virtual void DoAssignPageTable(TInt aId, TLinAddr aAddr, TPde aPdePerm)=0;
   1.343 +	virtual void RemapPageTable(TPhysAddr aOld, TPhysAddr aNewId, TLinAddr aAddr)=0;
   1.344 +	virtual void DoUnassignPageTable(TLinAddr aAddr)=0;
   1.345 +	virtual void MoveChunk(TLinAddr anInitAddr, TUint aSize, TLinAddr aFinalAddr, TPde aPermissions)=0;
   1.346 +	virtual void MoveChunk(TLinAddr anInitAddr, TLinAddr aFinalAddr, TInt aNumPdes)=0;
   1.347 +	virtual void ApplyTopLevelPermissions(TLinAddr anAddr, TUint aChunkSize, TPde aPermissions)=0;
   1.348 +	virtual void ApplyPagePermissions(TInt aId, TInt aPageOffset, TInt aNumPages, TPte aPtePerm)=0;
   1.349 +	virtual void SyncCodeMappings()=0;
   1.350 +	virtual void GenericFlush(TUint32 aMask)=0;
   1.351 +	virtual TPde PdePermissions(TChunkType aChunkType, TInt aChunkState)=0;
   1.352 +	virtual TInt UnlockRamCachePages(TUint8* volatile & aBase, TInt aFirstPage, TInt aNumPages)=0;
   1.353 +	virtual TInt LockRamCachePages(TUint8* volatile & aBase, TInt aFirstPage, TInt aNumPages)=0;
   1.354 +	virtual void MapVirtual(TInt aId, TInt aNumPages)=0;
   1.355 +	virtual TInt UnmapVirtual(TInt aId, TUint32 aAddr, TInt aNumPages, TPhysAddr* aPageList, TBool aSetPagesFree, TInt& aNumPtes, TInt& aNumFree, DProcess* aProcess)=0;
   1.356 +	virtual TLinAddr MapTemp(TPhysAddr aPage, TBool aCached)=0;
   1.357 +	virtual TLinAddr MapSecondTemp(TPhysAddr aPage, TBool aCached)=0;
   1.358 +	virtual void UnmapTemp()=0;
   1.359 +	virtual void UnmapSecondTemp()=0;
   1.360 +	virtual void RemapKernelPage(TInt aId, TLinAddr aSrc, TLinAddr aDest, TPhysAddr aNewPhys, TPte aPtePerm)=0;
   1.361 +	virtual TInt PreparePagesForDMA(TLinAddr aAddr, TInt aSize, TPhysAddr* aPhysicalPageList)=0;
   1.362 +	virtual TInt ReleasePagesFromDMA(TPhysAddr* aPhysicalPageList, TInt aPageCount)=0;
   1.363 +	
   1.364 +public:
   1.365 +	TInt GetPageTableId(TLinAddr aAddr);
   1.366 +public:
   1.367 +	inline static Mmu& Get()
   1.368 +		{return *(Mmu*)TheMmu;}
   1.369 +	inline void CopyPageForRemap(TLinAddr aDest, TLinAddr aSrc)
   1.370 +		{iCopyPageFn(aDest, aSrc);}
   1.371 +	static void Panic(TPanic aPanic);
   1.372 +public:
   1.373 +	TLinAddr iDataSectionBase;		// lowest data section address
   1.374 +	TLinAddr iDllDataBase;			// start of DLL static data area
   1.375 +	TLinAddr iDataSectionEnd;		// highest data section address + 1
   1.376 +	TInt iMaxDllDataSize;
   1.377 +	TLinAddr iUserCodeBase;
   1.378 +	TInt iMaxUserCodeSize;
   1.379 +	TLinAddr iKernelCodeBase;
   1.380 +	TInt iMaxKernelCodeSize;
   1.381 +	TLinAddr iPdeBase;
   1.382 +	TPte iUserCodeLoadPtePerm;
   1.383 +	TPte iKernelCodePtePerm;
   1.384 +	TUint32* iHomePdeMap;
   1.385 +	TCopyPageFn iCopyPageFn;
   1.386 +	TPte* iSecondTempPte;		// second PTE used for temporary mappings
   1.387 +	TLinAddr iSecondTempAddr;	// address corresponding to iSecondTempPte
   1.388 +	};
   1.389 +
   1.390 +
   1.391 +/********************************************
   1.392 + * Functions/Data defined in memory model
   1.393 + ********************************************/
   1.394 +
   1.395 +/**
   1.396 +@internalComponent
   1.397 +*/
   1.398 +class MM
   1.399 +	{
   1.400 +public:
   1.401 +	enum TMemModelPanic
   1.402 +		{
   1.403 +		EUserCodeNotFixed=0,
   1.404 +		EClaimInitialPagesBadPageTable=1,
   1.405 +		EFreeInvalidDomain=2,
   1.406 +		EFreeDomainNotAllocated=3,
   1.407 +		EFixedChunkMoving=4,
   1.408 +		EChunkDecommitNoPageTable=5,
   1.409 +		ECommitInvalidDllDataAddress=6,
   1.410 +		EDecommitInvalidDllDataAddress=7,
   1.411 +		EPdeAlreadyInUse=8,
   1.412 +		EPteAlreadyInUse=9,
   1.413 +		EMmuMapNoPageTable=10,
   1.414 +		EUnmapBadAlignment=11,
   1.415 +		EBootstrapPageTableBadAddr=12,
   1.416 +		EAddFixedBadPerm=13,
   1.417 +		ERemoveFixedBadPerm=14,
   1.418 +		EUnexpectedPageType=15,
   1.419 +		EOperationNotImplemented=16,
   1.420 +		ECodeAddressOutOfRange=17,
   1.421 +		ETempMappingAlreadyInUse=18,
   1.422 +		EChunkRemapNoPageTable=19,
   1.423 +		EChunkRemapWrongPageTable=20,
   1.424 +		};
   1.425 +
   1.426 +	static void Panic(TMemModelPanic aPanic);
   1.427 +public:
   1.428 +	static void Init1();
   1.429 +	static TAny* CurrentAddress(DThread* aThread, const TAny* aAddress, TInt aSize, TBool aWrite);
   1.430 +	static void StartCrashDebugger();
   1.431 +	static TInt CreateCodeChunk(TBool aKernel);
   1.432 +public:
   1.433 +	static TInt MaxPagesInOneGo;
   1.434 +	static DMemModelChunk* SvStackChunk;
   1.435 +	static DMemModelChunk* TheRamDriveChunk;
   1.436 +	static DMemModelChunk* UserCodeChunk;
   1.437 +	static DMemModelChunk* KernelCodeChunk;
   1.438 +	static TBitMapAllocator* DllDataAllocator;
   1.439 +	};
   1.440 +
   1.441 +#endif