271 |
271 |
272 @param aMappingList The list that the mapping appears on. |
272 @param aMappingList The list that the mapping appears on. |
273 */ |
273 */ |
274 void UnlinkFromMemory(TMappingList& aMappingList); |
274 void UnlinkFromMemory(TMappingList& aMappingList); |
275 |
275 |
|
276 /** |
|
277 Get the physical address(es) for a region of pages in this mapping. |
|
278 |
|
279 @param aIndex Page index, within the mapping, for start of the region. |
|
280 @param aCount Number of pages in the region. |
|
281 @param aPhysicalAddress On success, this value is set to one of two values. |
|
282 If the specified region is physically contiguous, |
|
283 the value is the physical address of the first page |
|
284 in the region. If the region is discontiguous, the |
|
285 value is set to KPhysAddrInvalid. |
|
286 @param aPhysicalPageList If not zero, this points to an array of TPhysAddr |
|
287 objects. On success, this array will be filled |
|
288 with the addresses of the physical pages which |
|
289 contain the specified region. If aPageList is |
|
290 zero, then the function will fail with |
|
291 KErrNotFound if the specified region is not |
|
292 physically contiguous. |
|
293 |
|
294 @return 0 if successful and the whole region is physically contiguous. |
|
295 1 if successful but the region isn't physically contiguous. |
|
296 KErrNotFound, if any page in the region is not present, |
|
297 otherwise one of the system wide error codes. |
|
298 |
|
299 @pre This mapping must have been attached to a memory object with #Pin. |
|
300 */ |
|
301 TInt PhysAddr(TUint aIndex, TUint aCount, TPhysAddr& aPhysicalAddress, TPhysAddr* aPhysicalPageList); |
|
302 |
276 protected: |
303 protected: |
277 /** |
304 /** |
278 @param aType Initial value for #Flags. |
305 @param aType Initial value for #Flags. |
279 */ |
306 */ |
280 DMemoryMappingBase(TUint aType); |
307 DMemoryMappingBase(TUint aType); |
672 /** |
699 /** |
673 This destructor removes the mapping from any address space it was added to and |
700 This destructor removes the mapping from any address space it was added to and |
674 frees any virtual addresses allocated to it. |
701 frees any virtual addresses allocated to it. |
675 */ |
702 */ |
676 ~DMemoryMapping(); |
703 ~DMemoryMapping(); |
|
704 |
|
705 /** |
|
706 Free any resources owned by this mapping, i.e. allow Construct() to be used |
|
707 on this mapping at a new address etc. |
|
708 */ |
|
709 void Destruct(); |
677 |
710 |
678 /** |
711 /** |
679 Allocatate virtual addresses for this mapping to use. |
712 Allocatate virtual addresses for this mapping to use. |
680 This is called from #Construct and the arguments to this function are the same. |
713 This is called from #Construct and the arguments to this function are the same. |
681 |
714 |
870 */ |
903 */ |
871 void FreePageTable(TPde* aPdeAddress); |
904 void FreePageTable(TPde* aPdeAddress); |
872 }; |
905 }; |
873 |
906 |
874 |
907 |
|
908 /** |
|
909 A mapping which maps any memory into the kernel address space and provides access to |
|
910 the physical address used by a memory object. |
|
911 |
|
912 These mappings are always of the 'pinned' type to prevent the obtained physical addresses |
|
913 from becoming invalid. |
|
914 */ |
|
915 class DKernelPinMapping : public DFineMapping |
|
916 { |
|
917 public: |
|
918 DKernelPinMapping(); |
|
919 TInt Construct(TUint aReserveSize); |
|
920 TInt MapAndPin(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TMappingPermissions aPermissions); |
|
921 void UnmapAndUnpin(); |
|
922 |
|
923 public: |
|
924 TInt iReservePages; ///< The number of pages this mapping is able to map with its reserved resources(page tables etc). |
|
925 }; |
|
926 |
875 |
927 |
876 /** |
928 /** |
877 A mapping which provides access to the physical address used by a memory object |
929 A mapping which provides access to the physical address used by a memory object |
878 without mapping these at any virtual address accessible to software. |
930 without mapping these at any virtual address accessible to software. |
879 |
931 |
912 |
964 |
913 Most of the action of this method is performed by #Detach. |
965 Most of the action of this method is performed by #Detach. |
914 */ |
966 */ |
915 virtual void Unpin(); |
967 virtual void Unpin(); |
916 |
968 |
917 /** |
|
918 Get the physical address(es) for a region of pages in this mapping. |
|
919 |
|
920 @param aIndex Page index, within the mapping, for start of the region. |
|
921 @param aCount Number of pages in the region. |
|
922 @param aPhysicalAddress On success, this value is set to one of two values. |
|
923 If the specified region is physically contiguous, |
|
924 the value is the physical address of the first page |
|
925 in the region. If the region is discontiguous, the |
|
926 value is set to KPhysAddrInvalid. |
|
927 @param aPhysicalPageList If not zero, this points to an array of TPhysAddr |
|
928 objects. On success, this array will be filled |
|
929 with the addresses of the physical pages which |
|
930 contain the specified region. If aPageList is |
|
931 zero, then the function will fail with |
|
932 KErrNotFound if the specified region is not |
|
933 physically contiguous. |
|
934 |
|
935 @return 0 if successful and the whole region is physically contiguous. |
|
936 1 if successful but the region isn't physically contiguous. |
|
937 KErrNotFound, if any page in the region is not present, |
|
938 otherwise one of the system wide error codes. |
|
939 |
|
940 @pre This mapping must have been attached to a memory object with #Pin. |
|
941 */ |
|
942 TInt PhysAddr(TUint aIndex, TUint aCount, TPhysAddr& aPhysicalAddress, TPhysAddr* aPhysicalPageList); |
|
943 private: |
969 private: |
944 // from DMemoryMappingBase... |
970 // from DMemoryMappingBase... |
945 virtual TInt MapPages(RPageArray::TIter aPages, TUint aMapInstanceCount); ///< Not implemented. Faults in debug builds. |
971 virtual TInt MapPages(RPageArray::TIter aPages, TUint aMapInstanceCount); ///< Not implemented. Faults in debug builds. |
946 virtual void UnmapPages(RPageArray::TIter aPages, TUint aMapInstanceCount); ///< Does nothing |
972 virtual void UnmapPages(RPageArray::TIter aPages, TUint aMapInstanceCount); ///< Does nothing |
947 virtual void RemapPage(TPhysAddr& aPageArray, TUint aIndex, TUint aMapInstanceCount, TBool aInvalidateTLB); ///< Not implemented. Faults in debug builds. |
973 virtual void RemapPage(TPhysAddr& aPageArray, TUint aIndex, TUint aMapInstanceCount, TBool aInvalidateTLB); ///< Not implemented. Faults in debug builds. |