kernel/eka/memmodel/epoc/flexible/mmu/mmanager.h
branchRCL_3
changeset 110 c734af59ce98
parent 87 2f92ad2dc5db
equal deleted inserted replaced
97:41f0cfe18c80 110:c734af59ce98
   240 			KErrInUse if the page became pinned or was subject to a page fault,
   240 			KErrInUse if the page became pinned or was subject to a page fault,
   241 			KErrNotSupported if the manager doesn't support this function,
   241 			KErrNotSupported if the manager doesn't support this function,
   242 			otherwise one of the system wide error codes.
   242 			otherwise one of the system wide error codes.
   243 
   243 
   244  	@pre RamAllocLock held.
   244  	@pre RamAllocLock held.
       
   245 	@pre If the page is dirty the PageCleaning lock must be held.
   245 	@pre MmuLock held.
   246 	@pre MmuLock held.
   246 	*/
   247 	*/
   247 	virtual TInt StealPage(DMemoryObject* aMemory, SPageInfo* aPageInfo);
   248 	virtual TInt StealPage(DMemoryObject* aMemory, SPageInfo* aPageInfo);
   248 
   249 
   249 	/**
   250 	/**
   263 			otherwise one of the system wide error codes.
   264 			otherwise one of the system wide error codes.
   264 	*/
   265 	*/
   265 	virtual TInt RestrictPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TRestrictPagesType aRestriction);
   266 	virtual TInt RestrictPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TRestrictPagesType aRestriction);
   266 
   267 
   267 	/**
   268 	/**
   268 	Clean a page of RAM by saving any modifications to it out to backing store.
   269 	Clean multiple pages of RAM by saving any modifications to it out to backing store.
   269 
   270 
   270 	This function must only be called when there are no writable MMU mappings of the page.
   271 	This function must only be called when there are no writable MMU mappings of the pages.
   271 
   272 
   272 	The function must only return a success after determining no writable MMU mappings
   273 	The function takes an array of SPageInfo pointers indicating the pages to clean.  On return, the
   273 	were created for the page, in which case it should also mark the page as clean using
   274 	elements of this array are unchanged if the page was successfully cleaned, or set to NULL if
   274 	SPageInfo::SetClean.
   275 	cleaning was abandoned (by the page being written to, for example).
   275 
   276 
   276 	This is only intended for use by #StealPage.
   277 	The pages passed must be sequential in their page colour (index & KPageColourMask).
   277 
   278 
   278 	@param aMemory			A memory object associated with this manager.
   279 	Those pages that are successfully cleaned are marked as clean using SPageInfo::SetClean.
   279 	@param aPageInfo		The page information structure of the page to be cleaned.
   280 
   280 							This must be owned by \a aMemory.
   281 	This is intended for use by #StealPage and #CleanSomePages.
   281 	@param aPageArrayEntry	Reference to the page's page array entry in \a aMemory->iPages.
   282 
   282 
   283 	@param aPageCount		Number of pages to clean.
   283 	@return KErrNone if successful,
   284 	@param aPageInfos		Pointer to an array of aPageCount page info pointers.
   284 			KErrInUse if the page state changed, e.g. became pinned or was subject to a page fault making it writable,
   285 	@param aBackground      Whether the activity should be ignored when determining whether the
   285 			KErrNotSupported if the manager doesn't support this function,
   286 	                        paging device is busy.
   286 			otherwise one of the system wide error codes.
       
   287 
   287 
   288 	@pre MmuLock held
   288 	@pre MmuLock held
       
   289 	@pre PageCleaning lock held
   289 	@pre The memory page must not have any writeable MMU mappings.
   290 	@pre The memory page must not have any writeable MMU mappings.
   290 	@post MmuLock held (but may have been released by this function)
   291 	@post MmuLock held (but may have been released by this function)
   291 	*/
   292 	*/
   292 	virtual TInt CleanPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TPhysAddr*& aPageArrayEntry);
   293 	virtual void CleanPages(TUint aPageCount, SPageInfo** aPageInfos, TBool aBackground);
   293 
   294 
   294 	/**
   295 	/**
   295 	Process a page fault in memory associated with this manager.
   296 	Process a page fault in memory associated with this manager.
   296 
   297 
   297 	This is only intended for use by #DPager::HandlePageFault.
   298 	This is only intended for use by #DPager::HandlePageFault.
   356 					unpinned.
   357 					unpinned.
   357 	*/
   358 	*/
   358 	virtual void Unpin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs) =0;
   359 	virtual void Unpin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs) =0;
   359 
   360 
   360 	/**
   361 	/**
   361 	@todo
   362 	Attempt to move the page specified to a new physical location.  The new physical
       
   363 	location for the page to be moved to is allocated by this method.  However,
       
   364 	aBlockZoneId and aBlockRest can be used to control which RAM zone the new
       
   365 	location is in.
       
   366 
       
   367 	@param aMemory		The memory object that owns the page.
       
   368 	@param aOldPageInfo	The page info for the physical page to move.
       
   369 	@param aNewPage 	On success this will hold the physical address of the new 
       
   370 						location for the page.
       
   371 	@param aBlockZoneId The ID of a RAM zone not to allocate the new page into.
       
   372 	@param aBlockRest 	When set to ETrue the search for a new page will stop if it 
       
   373 						ever needs to look at aBlockZoneId.
       
   374 	@return KErrNone on success, KErrInUse if the page couldn't be moved, 
       
   375 			or KErrNoMemory if it wasn't possible to allocate a new page.
   362 	*/
   376 	*/
   363 	virtual TInt MovePage(DMemoryObject* aMemory, SPageInfo* aOldPageInfo, TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest);
   377 	virtual TInt MovePage(DMemoryObject* aMemory, SPageInfo* aOldPageInfo, TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest);
       
   378 
       
   379 	/**
       
   380 	Move the page specified to a new physical location and mark the page as 
       
   381 	allocated as type aPageType.
       
   382 	
       
   383 	@param aMemory		The memory object that owns the page.
       
   384 	@param aPageInfo	The page info for the physical page to move.
       
   385 	@param aPageType	The type of the page to allocate into the orignal physical 
       
   386 						location of the page to move.
       
   387 	@return KErrNone on success, KErrInUse if the page couldn't be moved, 
       
   388 			or KErrNoMemory if it wasn't possible to allocate a new page.
       
   389 	*/
       
   390 	virtual TInt MoveAndAllocPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TZonePageType aPageType);
   364 
   391 
   365 	/**
   392 	/**
   366 	Return the TZonePageType of the pages that the memory manager can allocate and free.
   393 	Return the TZonePageType of the pages that the memory manager can allocate and free.
   367 	*/
   394 	*/
   368 	virtual TZonePageType PageType();
   395 	virtual TZonePageType PageType();
   565 			otherwise one of the system wide error codes.
   592 			otherwise one of the system wide error codes.
   566 	*/
   593 	*/
   567 	virtual TInt ReadPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages, DPageReadRequest* aRequest) =0;
   594 	virtual TInt ReadPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages, DPageReadRequest* aRequest) =0;
   568 
   595 
   569 	/**
   596 	/**
   570 	Save the data content of a specified region of a memory object by writing it to
       
   571 	storage media. This is intended for use by an implementation of #CleanPage.
       
   572 
       
   573 	The memory region must be the same as, or a subset of, the region used when obtaining
       
   574 	the request object \a aRequest.
       
   575 
       
   576 	@param aMemory	A memory object associated with this manager.
       
   577 	@param aIndex	Page index for the start of the region.
       
   578 	@param aCount	Number of pages in the region.
       
   579 	@param aPages	Pointer to array of pages to read into. This must contain \a aCount
       
   580 					number of physical page addresses which are each page aligned.
       
   581 	@param aRequest	A request object previously obtained with #AcquirePageWriteRequest.
       
   582 
       
   583 	@return KErrNone if successful,
       
   584 			otherwise one of the system wide error codes.
       
   585 	*/
       
   586 	virtual TInt WritePages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages, DPageWriteRequest* aRequest);
       
   587 
       
   588 	/**
       
   589 	Check if a region of a memory object has been allocated. E.g. that #Alloc
   597 	Check if a region of a memory object has been allocated. E.g. that #Alloc
   590 	has reserved backing store for the memory and this has has not yet been freed
   598 	has reserved backing store for the memory and this has has not yet been freed
   591 	by #Free or #Destruct.
   599 	by #Free or #Destruct.
   592 
   600 
   593 	@param aMemory	A memory object associated with this manager.
   601 	@param aMemory	A memory object associated with this manager.