82 /** |
83 /** |
83 Memory object containing normal program memory (RAM) in the same way as |
84 Memory object containing normal program memory (RAM) in the same way as |
84 EMemoryObjectMovable but with the additional option of marking pages as |
85 EMemoryObjectMovable but with the additional option of marking pages as |
85 'discardable'. Discardable pages may be reclaimed (remove) by the system at |
86 'discardable'. Discardable pages may be reclaimed (remove) by the system at |
86 any time, this state is controlled using the functions: |
87 any time, this state is controlled using the functions: |
|
88 - MM::MemoryAlloc |
|
89 - MM::MemoryAllocContiguous |
|
90 - MM::MemoryFree |
87 - MM::MemoryAllowDiscard |
91 - MM::MemoryAllowDiscard |
88 - MM::MemoryDisallowDiscard |
92 - MM::MemoryDisallowDiscard |
89 */ |
93 */ |
90 EMemoryObjectDiscardable = 4 |
94 EMemoryObjectDiscardable = 4 |
91 }; |
95 }; |
483 KErrAlreadyExists, if any part of the region already contains pages; |
487 KErrAlreadyExists, if any part of the region already contains pages; |
484 KErrArgument, if the region exceeds the bounds of the memory object; |
488 KErrArgument, if the region exceeds the bounds of the memory object; |
485 KErrNotSupported, if the memory object doesn't support this operation; |
489 KErrNotSupported, if the memory object doesn't support this operation; |
486 otherwise another of the system wide error codes. |
490 otherwise another of the system wide error codes. |
487 */ |
491 */ |
488 static TInt MemoryAddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, TPhysAddr* aPages); |
492 static TInt MemoryAddPages(DMemoryObject* aMemory, TUint aIndex, TUint aCount, const TPhysAddr* aPages); |
489 |
493 |
490 /** |
494 /** |
491 Add a contiguous range of pages to a region in a memory object. |
495 Add a contiguous range of pages to a region in a memory object. |
492 |
496 |
493 This function acquires and releases the memory objects lock. |
497 This function acquires and releases the memory objects lock. |
878 |
882 |
879 /** |
883 /** |
880 Find and open the mapping that maps a virtual address in the address space of the specified |
884 Find and open the mapping that maps a virtual address in the address space of the specified |
881 process. |
885 process. |
882 |
886 |
|
887 The caller must close the mapping when it has finished using it. |
|
888 |
|
889 @param aProcess The process whose address space is to be searched. |
|
890 @param aAddr The virtual address for which the mapping is to be found. |
|
891 @param aSize The size, in bytes, of the region at aAddr. |
|
892 @param aOffsetInMapping A reference which is set to the offset, in bytes, into the |
|
893 mapping of the start address. |
|
894 @param aInstanceCount The instance count of the found mapping. |
|
895 |
|
896 @return The mapping, or NULL if no mapping was found. |
|
897 |
|
898 @pre Calling thread must be in a critical section. |
|
899 */ |
|
900 static DMemoryMapping* FindMappingInProcess(DMemModelProcess* aProcess, TLinAddr aAddr, TUint aSize, |
|
901 TUint& aOffsetInMapping, TUint& aInstanceCount); |
|
902 |
|
903 /** |
|
904 Find and open the mapping that maps a virtual address in the address space of the specified |
|
905 process. |
|
906 |
883 The caller must close the mapping when it has finished using it. The caller must ensure that |
907 The caller must close the mapping when it has finished using it. The caller must ensure that |
884 the process can't be destroyed while calling this method. |
908 the process can't be destroyed while calling this method. |
885 |
909 |
886 @param aOsAsid The identifier for the address space in which the mapping appears. |
910 @param aOsAsid The identifier for the address space in which the mapping appears. |
887 @param aAddr The virtual address for which the mapping is to be found. |
911 @param aAddr The virtual address for which the mapping is to be found. |
1041 static void AsyncAddressSpaceFree(TUint aOsAsid); |
1065 static void AsyncAddressSpaceFree(TUint aOsAsid); |
1042 static TInt VirtualAllocCommon(TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged); |
1066 static TInt VirtualAllocCommon(TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged); |
1043 static void VirtualFreeCommon(TLinAddr aLinAddr, TUint aSize); |
1067 static void VirtualFreeCommon(TLinAddr aLinAddr, TUint aSize); |
1044 static TInt VirtualAlloc(TInt aOsAsid, TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged); |
1068 static TInt VirtualAlloc(TInt aOsAsid, TLinAddr& aLinAddr, TUint aSize, TBool aDemandPaged); |
1045 static void VirtualFree(TInt aOsAsid, TLinAddr aLinAddr, TUint aSize); |
1069 static void VirtualFree(TInt aOsAsid, TLinAddr aLinAddr, TUint aSize); |
|
1070 |
|
1071 #ifdef _DEBUG |
|
1072 /** |
|
1073 Force a region of paged memory to be paged out. |
|
1074 |
|
1075 If the memory is not paged this call has no effect. |
|
1076 |
|
1077 @return KErrNone, or KErrBadDescriptor if a single mapping containing the region could not be |
|
1078 found. |
|
1079 */ |
|
1080 static TInt FlushRegion(DMemModelProcess*, TLinAddr aStartAddress, TUint aSize); |
|
1081 #endif |
1046 |
1082 |
1047 /** |
1083 /** |
1048 Enumeration of panic values for category "MemModel". |
1084 Enumeration of panic values for category "MemModel". |
1049 */ |
1085 */ |
1050 enum TMemModelPanic |
1086 enum TMemModelPanic |