kernel/eka/memmodel/epoc/flexible/mmu/mm.h
changeset 121 661475905584
parent 0 a41df078684a
child 176 af6ec97d9189
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mm.h	Fri Apr 23 22:02:01 2010 +0100
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mm.h	Fri Apr 23 22:08:41 2010 +0100
@@ -28,6 +28,7 @@
 class DMemoryObject;
 class DMemoryMapping;
 class DMemModelThread;
+class DMemModelProcess;
 class DPhysicalPinMapping;
 
 /**
@@ -84,6 +85,9 @@
 	EMemoryObjectMovable but with the additional option of marking pages as
 	'discardable'. Discardable pages may be reclaimed (remove) by the system at
 	any time, this state is controlled using the functions:
+	- MM::MemoryAlloc
+	- MM::MemoryAllocContiguous
+	- MM::MemoryFree
 	- MM::MemoryAllowDiscard
 	- MM::MemoryDisallowDiscard
 	*/
@@ -157,7 +161,7 @@
 	/**
 	Memory object contents are to be demand paged. 
 	*/
-	EMemoryCreateDemandPaged			= 1<<31
+	EMemoryCreateDemandPaged			= 1U<<31
 	};
 
 
@@ -308,7 +312,7 @@
 	specified address.
 	@internalTechnology
 	*/
-	EMappingCreateFixedVirtual	= 1<<31
+	EMappingCreateFixedVirtual	= 1U<<31
 	};
 
 
@@ -485,7 +489,7 @@
 			KErrNotSupported, if the memory object doesn't support this operation;
 			otherwise another of the system wide error codes.
 	*/
-	static TInt MemoryAddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages);
+	static TInt MemoryAddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, const TPhysAddr* aPages);
 
 	/**
 	Add a contiguous range of pages to a region in a memory object.
@@ -880,6 +884,26 @@
 	Find and open the mapping that maps a virtual address in the address space of the specified
 	process.
 
+	The caller must close the mapping when it has finished using it.
+
+	@param aProcess The process whose address space is to be searched.
+	@param aAddr The virtual address for which the mapping is to be found.
+	@param aSize The size, in bytes, of the region at aAddr.
+	@param aOffsetInMapping A reference which is set to the offset, in bytes, into the
+							mapping of the start address.
+	@param aInstanceCount	The instance count of the found mapping.
+
+	@return The mapping, or NULL if no mapping was found.
+
+	@pre Calling thread must be in a critical section.
+	*/
+	static DMemoryMapping* FindMappingInProcess(DMemModelProcess* aProcess, TLinAddr aAddr, TUint aSize, 
+												TUint& aOffsetInMapping, TUint& aInstanceCount);
+
+	/**
+	Find and open the mapping that maps a virtual address in the address space of the specified
+	process.
+
 	The caller must close the mapping when it has finished using it.  The caller must ensure that
 	the process can't be destroyed while calling this method.
 
@@ -1044,6 +1068,18 @@
 	static TInt VirtualAlloc(TInt aOsAsid, TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged);
 	static void VirtualFree(TInt aOsAsid, TLinAddr aLinAddr, TUint aSize);
 
+#ifdef _DEBUG
+	/**
+	Force a region of paged memory to be paged out.
+
+	If the memory is not paged this call has no effect.
+
+	@return KErrNone, or KErrBadDescriptor if a single mapping containing the region could not be
+	        found.
+	*/
+	static TInt FlushRegion(DMemModelProcess*, TLinAddr aStartAddress, TUint aSize);
+#endif
+
 	/**
 	Enumeration of panic values for category "MemModel".
 	*/