First public contribution.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
24 #include "mpagearray.h"
28 class DMemoryMappingBase;
29 class DPageReadRequest;
30 class DPageWriteRequest;
33 An abstract interface for performing operations on a memory object, such as allocating
36 There are different concrete implementations of this class for memory being managed in
37 different ways, e.g. demand paged versus unpaged memory.
39 Any particular instance of a manager will only support a subset of the methods provided.
40 The default implementations of these in this base class return KErrErrNotSupported.
42 class DMemoryManager : public DBase
46 Create a new memory object for use with this manager.
48 @param[out] aMemory On success this is set to the address of the created memory object.
49 @param aSizeInPages Size of the memory object, in number of pages.
50 @param aAttributes Bitmask of values from enum #TMemoryAttributes.
51 @param aCreateFlags Bitmask of option flags from enum #TMemoryCreateFlags.
53 @return KErrNone if successful, otherwise one of the system wide error codes.
55 virtual TInt New(DMemoryObject*& aMemory, TUint aSizeInPages, TMemoryAttributes aAttributes, TMemoryCreateFlags aCreateFlags);
58 Remove all memory from a memory object and close a reference on it.
60 If there are no longer any mappings to the memory, or other references,
61 this will result in the memory object being destroyed. However whilst
62 other references exist, cleanup of memory and other resources may be
65 @param aMemory A memory object associated with this manager.
67 virtual void Destruct(DMemoryObject* aMemory) =0;
70 Allocate memory resources for a specified region of a memory object.
72 Depending on the manager, this may involve allocating physical RAM pages or
73 reserving space in a backing store.
75 @param aMemory A memory object associated with this manager.
76 @param aIndex Page index for the start of the region.
77 @param aCount Number of pages in the region.
79 @return KErrNone if successful,
80 KErrAlreadyExists if any part of the region was already allocated,
81 KErrNotSupported if the manager doesn't support this function,
82 otherwise one of the system wide error codes.
84 virtual TInt Alloc(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
87 Allocate physically contiguous RAM for a specified region of a memory object.
89 Important note, this function can unexpectedly fail with KErrAlreadyExists
90 if any part of the the region previously contained allocated memory which
91 had been freed but which was pinned. It is therefore not suitable for general
94 @param aMemory A memory object associated with this manager.
95 @param aIndex Page index for the start of the region.
96 @param aCount Number of pages in the region.
97 @param aAlign Log2 of the alignment (in bytes) that the address of the
98 allocated physical RAM must have.
99 @param[out] aPhysAddr On success, this is set to the start address of the
100 allocated physical RAM.
102 @return KErrNone if successful,
103 KErrAlreadyExists if any part of the region was already allocated,
104 KErrNotSupported if the manager doesn't support this function,
105 otherwise one of the system wide error codes.
107 virtual TInt AllocContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TUint aAlign, TPhysAddr& aPhysAddr);
110 Free any memory resources used for a specified region of a memory object.
111 This is the inverse operation to #Alloc and #AllocContiguous.
113 Depending on the manager, this may involve freeing space in a backing store
114 as well as freeing any currently committed RAM.
116 If part of the memory is currently pinned then resource freeing may be delayed
119 @param aMemory A memory object associated with this manager.
120 @param aIndex Page index for the start of the region.
121 @param aCount Number of pages in the region.
123 virtual void Free(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
126 Wipe the entire memory contents of the memory object so they are in the
127 same state as if the memory had been newly allocated with #Alloc.
129 This doesn't allocate any new memory, just fills the existing contents
130 with the appropriate wipe byte which is used with the memory object.
132 @param aMemory A memory object associated with this manager.
134 @see EMemoryCreateUseCustomWipeByte
135 @see EMemoryCreateNoWipe
137 @return KErrNone, if successful;
138 otherwise KErrNotSupported, to indicate the memory object doesn't support this operation.
140 virtual TInt Wipe(DMemoryObject* aMemory);
143 Add a specified set of physical memory pages to a region of a memory object.
145 @param aMemory A memory object associated with this manager.
146 @param aIndex Page index for the start of the region.
147 @param aCount Number of pages in the region.
148 @param aPages Pointer to array of pages to add. This must contain \a aCount
149 number of physical page addresses which are each page aligned.
151 @return KErrNone if successful,
152 KErrAlreadyExists if any part of the region was already allocated,
153 KErrNotSupported if the manager doesn't support this function,
154 otherwise one of the system wide error codes.
156 virtual TInt AddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages);
159 Add a contiguous range of physical memory pages to a region of a memory object.
161 @param aMemory A memory object associated with this manager.
162 @param aIndex Page index for the start of the region.
163 @param aCount Number of pages in the region.
164 @param aPhysAddr The page aligned start address of the pages to be added.
166 @return KErrNone if successful,
167 KErrAlreadyExists if any part of the region was already allocated,
168 KErrNotSupported if the manager doesn't support this function,
169 otherwise one of the system wide error codes.
171 virtual TInt AddContiguous(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr aPhysAddr);
174 Remove the memory pages from a specified region of a memory object.
175 This is the inverse operation to #AddPages and #AddContiguous.
177 @param aMemory A memory object associated with this manager.
178 @param aIndex Page index for the start of the region.
179 @param aCount Number of pages in the region.
180 @param[out] aPages Pointer to an array of physical addresses which has a
181 length of \a aCount. The contents of this will be set to
182 the addresses of the pages which were removed by this
183 function. The number of valid entries in this array is
184 given by the return value of this function.
185 aPages may be the null-pointer, to indicate that these
186 page addresses aren't required by the caller.
188 @return The number of pages successfully removed from the memory object.
189 This gives the number of valid entries in the array \a aPages and is
190 less-than or equal to \a aCount.
192 virtual TInt RemovePages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages);
195 Mark the specified region of a memory object as discardable.
196 The system may remove discardable pages from the memory object at any time,
197 to be reused for other purposes.
199 @param aMemory A memory object associated with this manager.
200 @param aIndex Page index for the start of the region.
201 @param aCount Number of pages in the region.
203 @return KErrNone if successful,
204 KErrNotSupported if the manager doesn't support this function,
205 otherwise one of the system wide error codes.
207 virtual TInt AllowDiscard(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
210 Mark the specified region of a memory object as no longer discardable.
211 This undoes the operation of #AllowDiscard.
213 If any pages in the region are no longer present, then the operation will
214 fail with KErrNotFound. In this case, the state of the pages in the region
215 is indeterminate; they may be either still discardable, not discardable, or
218 @param aMemory A memory object associated with this manager.
219 @param aIndex Page index for the start of the region.
220 @param aCount Number of pages in the region.
222 @return KErrNone if successful,
223 KErrNotFound if any page in the region was no longer present,
224 KErrNotSupported if the manager doesn't support this function,
225 otherwise one of the system wide error codes.
227 virtual TInt DisallowDiscard(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
230 Remove a page of RAM from a memory object.
232 This is only intended for use by #DPager::StealPage when it removes a page
233 from the demand paging live list.
235 @param aMemory A memory object associated with this manager.
236 @param aPageInfo The page information structure of the page to be stolen.
237 This must be owned by \a aMemory.
239 @return KErrNone if successful,
240 KErrInUse if the page became pinned or was subject to a page fault,
241 KErrNotSupported if the manager doesn't support this function,
242 otherwise one of the system wide error codes.
244 @pre RamAllocLock held.
247 virtual TInt StealPage(DMemoryObject* aMemory, SPageInfo* aPageInfo);
250 Restrict the access permissions for a page of RAM.
252 This is only intended for use by #DPager::RestrictPage when it restricts
253 access to a page in the demand paging live list.
255 @param aMemory A memory object associated with this manager.
256 @param aPageInfo The page information structure of the page to be restricted.
257 This must be owned by \a aMemory.
258 @param aRestriction The restriction type to apply.
260 @return KErrNone if successful,
261 KErrInUse if the page state changed, e.g. became pinned or was subject to a page fault,
262 KErrNotSupported if the manager doesn't support this function,
263 otherwise one of the system wide error codes.
265 virtual TInt RestrictPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TRestrictPagesType aRestriction);
268 Clean a page of RAM by saving any modifications to it out to backing store.
270 This function must only be called when there are no writable MMU mappings of the page.
272 The function must only return a success after determining no writable MMU mappings
273 were created for the page, in which case it should also mark the page as clean using
276 This is only intended for use by #StealPage.
278 @param aMemory A memory object associated with this manager.
279 @param aPageInfo The page information structure of the page to be cleaned.
280 This must be owned by \a aMemory.
281 @param aPageArrayEntry Reference to the page's page array entry in \a aMemory->iPages.
283 @return KErrNone if successful,
284 KErrInUse if the page state changed, e.g. became pinned or was subject to a page fault making it writable,
285 KErrNotSupported if the manager doesn't support this function,
286 otherwise one of the system wide error codes.
289 @pre The memory page must not have any writeable MMU mappings.
290 @post MmuLock held (but may have been released by this function)
292 virtual TInt CleanPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TPhysAddr*& aPageArrayEntry);
295 Process a page fault in memory associated with this manager.
297 This is only intended for use by #DPager::HandlePageFault.
299 @param aMemory A memory object associated with this manager whose memory was
300 accessed by the page fault.
301 @param aIndex Page index, within the memory, at which the page fault occurred.
302 @param aMapping The memory mapping in which the page fault occurred.
303 @param aMapInstanceCount The instance count of the mapping that took the page fault.
304 @param aAccessPermissions Flags from enum #TMappingPermissions indicating the memory
305 access permissions used by the page fault. E.g. the #EReadWrite
306 flag will be set for a write access.
308 @return KErrNone if the fault was handled successfully and the running program should
309 restart at the faulting instruction.
310 Otherwise, one of the system wide error codes indicating that the program generating
311 the page fault attempted an invalid memory access.
313 virtual TInt HandleFault( DMemoryObject* aMemory, TUint aIndex, DMemoryMapping* aMapping,
314 TUint aMapInstanceCount, TUint aAccessPermissions);
317 Pin the region of a memory object covered by a specified memory mapping.
319 This function should ensure that the memory pages covered by the mapping are
320 present in the memory object and will not be removed again until an #Unpin
321 operation is issued. Additionally, for demand paged memory, the pages
322 must be mapped into \a aMapping using DMemoryMappingBase::PageIn.
324 This function is only intended to be called via DMemoryMappingBase::DoPin
325 which is itself called from DMemoryMappingBase::Attach.
327 @param aMemory A memory object associated with this manager.
328 @param aMapping A mapping with the DMemoryMappingBase::EPinned attribute which
329 has been attached to \a aMemory.
330 @param aPinArgs The resources to use for pinning. This must have sufficient replacement
331 pages allocated to pin every page the mapping covers. Also, the
332 value of \a aPinArgs.iReadOnly must be set to correspond to the
333 mappings access permissions.
335 @return KErrNone if successful,
336 KErrNotFound if any part of the memory to be pinned was not present,
337 otherwise one of the system wide error codes.
339 virtual TInt Pin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs) =0;
342 Unpin the region of a memory object covered by a specified memory mapping.
344 This reverses the action of #Pin and is only intended to be called from
345 DMemoryMappingBase::Detach.
347 Note, pinning is a reference counting operation, therefore pages must stay
348 resident in memory (pinned) until the number of unpinning operations affecting
349 them equals the number of pinning operations.
351 @param aMemory A memory object associated with this manager.
352 @param aMapping A mapping with the DMemoryMappingBase::EPinned attribute which
353 has been attached to \a aMemory.
354 @param aPinArgs The resources used for pinning. The replacement pages allocated
355 to this will be increased for each page which was became completely
358 virtual void Unpin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs) =0;
363 virtual TInt MovePage(DMemoryObject* aMemory, SPageInfo* aOldPageInfo, TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest);
366 Return the TZonePageType of the pages that the memory manager can allocate and free.
368 virtual TZonePageType PageType();
371 Bitmask representing the different cleanup operations which can be performed
372 on a memory object. The operations are queued with #QueueCleanup and
373 pending operations are stored in each memory object's DMemoryObject::iCleanupFlags.
375 enum TCleanupOperationFlag
378 Execute #DoCleanupDecommitted.
380 ECleanupDecommitted = 1<<0,
383 Internal flag which indicates that cleanup has been queued.
385 ECleanupIsQueued = 1u<<31
389 Queue a cleanup operation to run for a specified memory object.
391 The operations are run from #CleanupFunction which is called
392 from a #TMemoryCleanup callback.
394 @param aMemory The memory object.
395 @param aCleanupOp The operation to perform.
397 static void QueueCleanup(DMemoryObject* aMemory, TCleanupOperationFlag aCleanupOp);
402 Unmap and free the RAM pages used for a specified region of a memory object.
404 Successfully freed pages are returned to the system's free RAM pool.
405 However, pinned pages are placed in the decommitted state
406 (RPageArray::EDecommitted) and remain allocated to the memory object.
407 These decommitted pages may ultimately get freed by #FreeDecommitted
408 or they may become re-allocated with #ReAllocDecommitted.
410 @param aMemory A memory object associated with this manager.
411 @param aIndex Page index for the start of the region.
412 @param aCount Number of pages in the region.
414 static void DoFree(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
417 Re-allocate all decommitted but still present RAM pages in a region of a memory object.
419 When pinned memory is freed from a memory object it is placed in the
420 RPageArray::EDecommitted state. This function is called by #Alloc to place
421 all such memory back into the committed state as if it had been newly allocated.
423 @param aMemory A memory object associated with this manager.
424 @param aIndex Page index for the start of the region.
425 @param aCount Number of pages in the region.
427 static void ReAllocDecommitted(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
430 Attempt to free all decommitted but still present RAM pages in a region of a memory object.
432 When pinned memory is freed from a memory object it is placed in the
433 RPageArray::EDecommitted state. This function is called by #DoCleanupDecommitted
434 to attempt to fully free this memory if it is no longer pinned.
436 @param aMemory A memory object associated with this manager.
437 @param aIndex Page index for the start of the region.
438 @param aCount Number of pages in the region.
440 static void FreeDecommitted(DMemoryObject* aMemory, TUint aIndex, TUint aCount);
443 Implementation factor for #FreeDecommitted and #DoFree.
445 static TInt FreePages(DMemoryObject* aMemory, RPageArray::TIter aPageList);
448 Cleanup any decommitted memory associated with a memory object.
450 This is called for memory objects which were queued for cleanup (#QueueCleanup)
451 with the #ECleanupDecommitted operation. A manager class must override this method
452 if it triggers this cleanup type - the default implementation faults in debug builds.
454 @param aMemory The memory object requiring cleanup.
456 virtual void DoCleanupDecommitted(DMemoryObject* aMemory);
460 Callback function which executes all pending operations queued with #QueueCleanup.
462 static void CleanupFunction(TAny*);
465 Head of a singly linked list of memory objects which require a cleanup operation.
466 Each object in the list is linked using its DMemoryObject::iCleanupNext member.
469 static DMemoryObject* iCleanupHead;
472 Spinlock used during memory cleanup operations to protect object list (#iCleanupHead
473 and DMemoryObject::iCleanupNext) and operation flags (DMemoryObject::iCleanupFlags).
475 static TSpinLock iCleanupLock;
481 The bass class for memory managers implementing the different forms of demand paging.
482 The provides the common functions required to 'page in' and 'page out' memory.
484 class DPagedMemoryManager : public DMemoryManager
487 // from DMemoryManager...
488 virtual TInt New(DMemoryObject*& aMemory, TUint aSizeInPages, TMemoryAttributes aAttributes, TMemoryCreateFlags aCreateFlags);
489 virtual void Destruct(DMemoryObject* aMemory);
490 virtual TInt MovePage(DMemoryObject* aMemory, SPageInfo* aOldPageInfo, TPhysAddr& aNewPage, TUint aBlockZoneId, TBool aBlockRest);
491 virtual TInt StealPage(DMemoryObject* aMemory, SPageInfo* aPageInfo);
492 virtual TInt RestrictPage(DMemoryObject* aMemory, SPageInfo* aPageInfo, TRestrictPagesType aRestriction);
493 virtual TInt HandleFault( DMemoryObject* aMemory, TUint aIndex, DMemoryMapping* aMapping,
494 TUint aMapInstanceCount, TUint aAccessPermissions);
495 virtual TInt Pin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs);
496 virtual void Unpin(DMemoryObject* aMemory, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs);
499 Called by DPager::Init3 during third stage initialisation.
501 virtual void Init3() = 0;
504 Called by Kern::InstallPagingDevice to notify memory managers when a paging device
505 is installed. A manager requires use of these paging devices to access storage media
506 where demand paged content is stored.
508 virtual TInt InstallPagingDevice(DPagingDevice* aDevice) = 0;
513 Acquire a request object suitable for issuing to #ReadPages to
514 obtain the data content of a specified region of a memory object.
516 Once the request object is finished with it must be released (DPagingRequest::Release).
518 Typically this function is implemented by calling DPagingRequestPool::AcquirePageReadRequest
519 on the request pool of the paging device appropriate to the memory object.
521 @param[out] aRequest On success this is set to the address of the request object.
522 @param aMemory A memory object associated with this manager.
523 @param aIndex Page index for the start of the region.
524 @param aCount Number of pages in the region.
526 @return KErrNone if successful,
527 otherwise one of the system wide error codes.
529 virtual TInt AcquirePageReadRequest(DPageReadRequest*& aRequest, DMemoryObject* aMemory, TUint aIndex, TUint aCount) = 0;
532 Acquire a request object suitable for issuing to #WritePages to
533 save the data content of a specified region of a memory object.
535 Once the request object is finished with it must be released (DPagingRequest::Release).
537 Typically this function is implemented by calling DPagingRequestPool::AcquirePageWriteRequest
538 on the request pool of the paging device appropriate to the memory object.
540 @param[out] aRequest On success this is set to the address of the request object.
541 @param aMemory A memory object associated with this manager.
542 @param aIndex Page index for the start of the region.
543 @param aCount Number of pages in the region.
545 @return KErrNone if successful,
546 otherwise one of the system wide error codes.
548 virtual TInt AcquirePageWriteRequest(DPageWriteRequest*& aRequest, DMemoryObject* aMemory, TUint aIndex, TUint aCount);
551 Obtain the data content of a specified region of a memory object by reading it from
554 The memory region must be the same as, or a subset of, the region used when obtaining
555 the request object \a aRequest.
557 @param aMemory A memory object associated with this manager.
558 @param aIndex Page index for the start of the region.
559 @param aCount Number of pages in the region.
560 @param aPages Pointer to array of pages to read into. This must contain \a aCount
561 number of physical page addresses which are each page aligned.
562 @param aRequest A request object previously obtained with #AcquirePageReadRequest.
564 @return KErrNone if successful,
565 otherwise one of the system wide error codes.
567 virtual TInt ReadPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages, DPageReadRequest* aRequest) =0;
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.
573 The memory region must be the same as, or a subset of, the region used when obtaining
574 the request object \a aRequest.
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.
583 @return KErrNone if successful,
584 otherwise one of the system wide error codes.
586 virtual TInt WritePages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages, DPageWriteRequest* aRequest);
589 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
591 by #Free or #Destruct.
593 @param aMemory A memory object associated with this manager.
594 @param aIndex Page index for the start of the region.
595 @param aCount Number of pages in the region.
597 @return True if the whole region has allocated storage, false otherwise.
600 @post #MmuLock held and must not have been released by this function.
602 virtual TBool IsAllocated(DMemoryObject* aMemory, TUint aIndex, TUint aCount) =0;
606 Do the action of #Pin for a subregion of a memory mapping.
607 This is an implementation factor used to implement #Pin.
609 @param aMemory A memory object associated with this manager.
610 @param aIndex Page index for the start of the region.
611 @param aCount Number of pages in the region.
612 @param aMapping A mapping with the DMemoryMappingBase::EPinned attribute which
613 has been attached to \a aMemory.
614 @param aPinArgs The resources to use for pinning. This must have sufficient replacement
615 pages allocated to pin every page the mapping covers, and the
616 value of \a aPinArgs.iReadOnly must be set to correspond to the
617 mappings access permissions.
619 @return KErrNone if successful,
620 KErrNotFound if any part of the memory to be pinned was not present,
621 otherwise one of the system wide error codes.
623 TInt DoPin(DMemoryObject* aMemory, TUint aIndex, TUint aCount, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs);
626 Update a single page in a memory object during memory pinning handling.
628 This includes assigning a new physical page of RAM to the memory object (optional)
629 then updating the pages state to ensure that it is pinned i.e. doesn't take
630 part in demand paging until unpinned again.
632 This is called from #DoPin.
634 @param aMemory A memory object associated with this manager.
635 @param aIndex Page index, within the memory, for the page.
636 @param aPageInfo The page information structure of the new physical page
637 to assign to the \a aMemory. If there was an existing
638 assigned page this new page is freed back to the paging
639 system. Specifying a new page is optional, use the null-pointer
640 to indicate its absence.
641 @param aPageArrayEntry Reference to the page's page array entry in \a aMemory->iPages.
642 @param aPinArgs The resources to use for pinning. This must a replacement
645 @return 1 (one) if the new page was assigned to the memory object.
646 @return 0 (zero) if a page already existed at the specified index.
647 @return KErrNotFound if there no page could be assigned, either because
648 none was given, or because memory is in the process of being
649 decommitted from the memory object.
653 virtual TInt PageInPinnedDone(DMemoryObject* aMemory, TUint aIndex, SPageInfo* aPageInfo, TPhysAddr* aPageArrayEntry, TPinArgs& aPinArgs);
656 Implementation factor for #PageInDone and #PageInPinnedDone.
659 @post #MmuLock held and must not have been released by this function.
661 TInt DoPageInDone(DMemoryObject* aMemory, TUint aIndex, SPageInfo*& aPageInfo, TPhysAddr* aPageArrayEntry, TBool aPinning);
664 Do the action of #Unpin for a subregion of a memory mapping.
665 This is an implementation factor used to implement #Unpin.
667 Must only be used for memory pages already successfully pinned.
669 @param aMemory A memory object associated with this manager.
670 @param aIndex Page index for the start of the region.
671 @param aCount Number of pages in the region.
672 @param aMapping A mapping with the DMemoryMappingBase::EPinned attribute which
673 has been attached to \a aMemory.
674 @param aPinArgs The resources used for pinning. The replacement pages allocated
675 to this will be increased for each page which was became completely
678 virtual void DoUnpin(DMemoryObject* aMemory, TUint aIndex, TUint aCount, DMemoryMappingBase* aMapping, TPinArgs& aPinArgs);
680 // from DMemoryManager...
681 virtual void DoCleanupDecommitted(DMemoryObject* aMemory);
682 virtual TZonePageType PageType();
685 Decompress demand paged data.
687 The compression types supported are:
688 - Byte-Pair, specified with a compression type of
689 SRomPageInfo::EBytePair or KUidCompressionBytePair.
690 - No Compression, specified with a compression type of zero.
692 @param aCompressionType The type of decompression to use.
693 @param aDst The destination address of the decompressed data.
694 @param aDstBytes The expected size of the data once it is decompressed.
695 @param aSrc The address for the data to decompress.
696 @param aSrcBytes The size of the data to decompress.
698 @return The size of decompressed data in bytes or one of the system wide error codes.
700 TInt Decompress(TUint32 aCompressionType, TLinAddr aDst, TUint aDstBytes, TLinAddr aSrc, TUint aSrcBytes);
704 Update a single page in a memory object during page fault handling.
706 This includes assigning a new physical page of RAM to the memory object (optional)
707 then updating the demand paging live list to reflect the fact that the memory page
710 This is called from #HandleFault.
712 @param aMemory A memory object associated with this manager.
713 @param aIndex Page index, within the memory, for the page.
714 @param aPageInfo The page information structure of the new physical page
715 to assign to the \a aMemory. If there was an existing
716 assigned page this new page is freed back to the paging
717 system. Specifying a new page is optional, use the null-pointer
718 to indicate its absence.
719 @param aPageArrayEntry Reference to the page's page array entry in \a aMemory->iPages.
721 @return 1 (one) if the new page was assigned to the memory object.
722 @return 0 (zero) if a page already existed at the specified index.
723 @return KErrNotFound if there no page could be assigned, either because
724 none was given, or because memory is in the process of being
725 decommitted from the memory object.
729 TInt PageInDone(DMemoryObject* aMemory, TUint aIndex, SPageInfo* aPageInfo, TPhysAddr* aPageArrayEntry);
734 extern DMemoryManager* TheUnpagedMemoryManager; ///< The #DUnpagedMemoryManager
735 extern DMemoryManager* TheMovableMemoryManager; ///< The #DMovableMemoryManager
736 extern DMemoryManager* TheDiscardableMemoryManager; ///< The #DDiscardableMemoryManager
737 extern DMemoryManager* TheHardwareMemoryManager; ///< The #DHardwareMemoryManager
738 extern DPagedMemoryManager* TheRomMemoryManager; ///< The #DRomMemoryManager
739 extern DPagedMemoryManager* TheDataPagedMemoryManager; ///< The #DDataPagedMemoryManager
740 extern DPagedMemoryManager* TheCodePagedMemoryManager; ///< The #DCodePagedMemoryManager