kernel/eka/memmodel/epoc/flexible/mmu/mm.h
changeset 121 661475905584
parent 0 a41df078684a
child 176 af6ec97d9189
equal deleted inserted replaced
120:b42b9ce90ea9 121:661475905584
    26 
    26 
    27 
    27 
    28 class DMemoryObject;
    28 class DMemoryObject;
    29 class DMemoryMapping;
    29 class DMemoryMapping;
    30 class DMemModelThread;
    30 class DMemModelThread;
       
    31 class DMemModelProcess;
    31 class DPhysicalPinMapping;
    32 class DPhysicalPinMapping;
    32 
    33 
    33 /**
    34 /**
    34 Memory object types for MM::MemoryNew which indicates how the
    35 Memory object types for MM::MemoryNew which indicates how the
    35 contents of a memory object are to be managed.
    36 contents of a memory object are to be managed.
    82 	/**
    83 	/**
    83 	Memory object containing normal program memory (RAM) in the same way as
    84 	Memory object containing normal program memory (RAM) in the same way as
    84 	EMemoryObjectMovable but with the additional option of marking pages as
    85 	EMemoryObjectMovable but with the additional option of marking pages as
    85 	'discardable'. Discardable pages may be reclaimed (remove) by the system at
    86 	'discardable'. Discardable pages may be reclaimed (remove) by the system at
    86 	any time, this state is controlled using the functions:
    87 	any time, this state is controlled using the functions:
       
    88 	- MM::MemoryAlloc
       
    89 	- MM::MemoryAllocContiguous
       
    90 	- MM::MemoryFree
    87 	- MM::MemoryAllowDiscard
    91 	- MM::MemoryAllowDiscard
    88 	- MM::MemoryDisallowDiscard
    92 	- MM::MemoryDisallowDiscard
    89 	*/
    93 	*/
    90 	EMemoryObjectDiscardable			= 4
    94 	EMemoryObjectDiscardable			= 4
    91 	};
    95 	};
   155 	EMemoryCreateCustomManager			= 1<<30,
   159 	EMemoryCreateCustomManager			= 1<<30,
   156 
   160 
   157 	/**
   161 	/**
   158 	Memory object contents are to be demand paged. 
   162 	Memory object contents are to be demand paged. 
   159 	*/
   163 	*/
   160 	EMemoryCreateDemandPaged			= 1<<31
   164 	EMemoryCreateDemandPaged			= 1U<<31
   161 	};
   165 	};
   162 
   166 
   163 
   167 
   164 /**
   168 /**
   165 Attributes that the memory in a memory object has.
   169 Attributes that the memory in a memory object has.
   306 	/**
   310 	/**
   307 	Don't allocate any virtual memory in the address space, just used the
   311 	Don't allocate any virtual memory in the address space, just used the
   308 	specified address.
   312 	specified address.
   309 	@internalTechnology
   313 	@internalTechnology
   310 	*/
   314 	*/
   311 	EMappingCreateFixedVirtual	= 1<<31
   315 	EMappingCreateFixedVirtual	= 1U<<31
   312 	};
   316 	};
   313 
   317 
   314 
   318 
   315 class DMemModelChunk;
   319 class DMemModelChunk;
   316 class TPagedCodeInfo;
   320 class TPagedCodeInfo;
   483 			KErrAlreadyExists, if any part of the region already contains pages;
   487 			KErrAlreadyExists, if any part of the region already contains pages;
   484 			KErrArgument, if the region exceeds the bounds of the memory object;
   488 			KErrArgument, if the region exceeds the bounds of the memory object;
   485 			KErrNotSupported, if the memory object doesn't support this operation;
   489 			KErrNotSupported, if the memory object doesn't support this operation;
   486 			otherwise another of the system wide error codes.
   490 			otherwise another of the system wide error codes.
   487 	*/
   491 	*/
   488 	static TInt MemoryAddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages);
   492 	static TInt MemoryAddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, const TPhysAddr* aPages);
   489 
   493 
   490 	/**
   494 	/**
   491 	Add a contiguous range of pages to a region in a memory object.
   495 	Add a contiguous range of pages to a region in a memory object.
   492 
   496 
   493 	This function acquires and releases the memory objects lock.
   497 	This function acquires and releases the memory objects lock.
   878 
   882 
   879 	/**
   883 	/**
   880 	Find and open the mapping that maps a virtual address in the address space of the specified
   884 	Find and open the mapping that maps a virtual address in the address space of the specified
   881 	process.
   885 	process.
   882 
   886 
       
   887 	The caller must close the mapping when it has finished using it.
       
   888 
       
   889 	@param aProcess The process whose address space is to be searched.
       
   890 	@param aAddr The virtual address for which the mapping is to be found.
       
   891 	@param aSize The size, in bytes, of the region at aAddr.
       
   892 	@param aOffsetInMapping A reference which is set to the offset, in bytes, into the
       
   893 							mapping of the start address.
       
   894 	@param aInstanceCount	The instance count of the found mapping.
       
   895 
       
   896 	@return The mapping, or NULL if no mapping was found.
       
   897 
       
   898 	@pre Calling thread must be in a critical section.
       
   899 	*/
       
   900 	static DMemoryMapping* FindMappingInProcess(DMemModelProcess* aProcess, TLinAddr aAddr, TUint aSize, 
       
   901 												TUint& aOffsetInMapping, TUint& aInstanceCount);
       
   902 
       
   903 	/**
       
   904 	Find and open the mapping that maps a virtual address in the address space of the specified
       
   905 	process.
       
   906 
   883 	The caller must close the mapping when it has finished using it.  The caller must ensure that
   907 	The caller must close the mapping when it has finished using it.  The caller must ensure that
   884 	the process can't be destroyed while calling this method.
   908 	the process can't be destroyed while calling this method.
   885 
   909 
   886 	@param aOsAsid The identifier for the address space in which the mapping appears.
   910 	@param aOsAsid The identifier for the address space in which the mapping appears.
   887 	@param aAddr The virtual address for which the mapping is to be found.
   911 	@param aAddr The virtual address for which the mapping is to be found.
  1041 	static void AsyncAddressSpaceFree(TUint aOsAsid);
  1065 	static void AsyncAddressSpaceFree(TUint aOsAsid);
  1042 	static TInt VirtualAllocCommon(TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged);
  1066 	static TInt VirtualAllocCommon(TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged);
  1043 	static void VirtualFreeCommon(TLinAddr aLinAddr, TUint aSize);
  1067 	static void VirtualFreeCommon(TLinAddr aLinAddr, TUint aSize);
  1044 	static TInt VirtualAlloc(TInt aOsAsid, TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged);
  1068 	static TInt VirtualAlloc(TInt aOsAsid, TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged);
  1045 	static void VirtualFree(TInt aOsAsid, TLinAddr aLinAddr, TUint aSize);
  1069 	static void VirtualFree(TInt aOsAsid, TLinAddr aLinAddr, TUint aSize);
       
  1070 
       
  1071 #ifdef _DEBUG
       
  1072 	/**
       
  1073 	Force a region of paged memory to be paged out.
       
  1074 
       
  1075 	If the memory is not paged this call has no effect.
       
  1076 
       
  1077 	@return KErrNone, or KErrBadDescriptor if a single mapping containing the region could not be
       
  1078 	        found.
       
  1079 	*/
       
  1080 	static TInt FlushRegion(DMemModelProcess*, TLinAddr aStartAddress, TUint aSize);
       
  1081 #endif
  1046 
  1082 
  1047 	/**
  1083 	/**
  1048 	Enumeration of panic values for category "MemModel".
  1084 	Enumeration of panic values for category "MemModel".
  1049 	*/
  1085 	*/
  1050 	enum TMemModelPanic
  1086 	enum TMemModelPanic