Update contrib.
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.
15 // Support for mapping memory with section mappings and large pages.
17 // This adds the following new classes:
19 // DLargeMappedMemory - a subclass of DCoarseMemory that holds information about which areas of
20 // memory are contiguous, and contains the page tables to use to map the
23 // DLargeMapping - a subclass of DCoarseMapping used to map areas of a DLargeMappedMemory
26 // todo: currently only section mappings are supported.
34 #ifndef MLAGEMAPPINGS_H
35 #define MLAGEMAPPINGS_H
40 // todo: Think of a better name than DLargeMappedMemory for a coarse memory object that supports
44 A coarse memory object that supports mappings larger than 4K pages.
46 All the contraints of coarse memory objects also apply to large memory objects.
48 Fine memory mappings (DFineMapping) may also be attached to this memory object but these will be
49 mapped using 4K pages and won't benefit from page table sharing.
51 class DLargeMappedMemory : public DCoarseMemory
55 Create a new DLargeMappedMemory object.
57 @param aManager The manager object for this memory.
58 @param aSizeInPages Size of the memory object, in number of pages. (Must represent an exact
60 @param aAttributes Bitmask of values from enum #TMemoryAttributes.
61 @param aCreateFlags Bitmask of option flags from enum #TMemoryCreateFlags.
63 @return The newly created DLargeMemory or the null pointer if there was insufficient memory.
65 static DLargeMappedMemory* New(DMemoryManager* aManager, TUint aSizeInPages, TMemoryAttributes aAttributes, TMemoryCreateFlags aCreateFlags);
68 DLargeMappedMemory(DMemoryManager* aManager, TUint aSizeInPages, TMemoryAttributes aAttributes, TMemoryCreateFlags aCreateFlags);
71 // from DMemoryObject...
72 virtual ~DLargeMappedMemory();
73 virtual TInt ClaimInitialPages(TLinAddr aBase, TUint aSize, TMappingPermissions aPermissions, TBool aAllowGaps, TBool aAllowNonRamPages);
74 virtual TInt MapPages(RPageArray::TIter aPages);
75 virtual void RemapPage(TPhysAddr& aPageArray, TUint aIndex, TBool aInvalidateTLB);
76 virtual void UnmapPages(RPageArray::TIter aPages, TBool aDecommitting);
77 virtual void RestrictPages(RPageArray::TIter aPages, TRestrictPagesType aRestriction);
78 virtual DMemoryMapping* CreateMapping(TUint aIndex, TUint aCount);
81 TBool IsChunkContiguous(TInt aChunkIndex);
83 void SetChunkContiguous(TInt aChunkIndex, TBool aIsContiguous);
85 TUint32 iContiguousState[1];
90 A memory mapping to map a 'chunk' aligned region of a DLargeMappedMemory object into an address
91 space, which allows use of mappings larger than a single page.
93 Currently this only supports section mapping, and only then when the memory is initially mapped in
94 sections by the bootstrap.
96 class DLargeMapping: public DCoarseMapping
102 // from DMemoryMappingBase...
103 virtual TInt DoMap();
104 virtual void RemapPage(TPhysAddr& aPageArray, TUint aIndex, TUint aMapInstanceCount, TBool aInvalidateTLB);
105 virtual TInt PageIn(RPageArray::TIter aPages, TPinArgs& aPinArgs, TUint aMapInstanceCount);
106 virtual TBool MovingPageIn(TPhysAddr& aPageArrayPtr, TUint aIndex);
108 // from DMemoryMapping...
109 virtual TPte* FindPageTable(TLinAddr aLinAddr, TUint aMemoryIndex);