perfsrv/memspy/Driver/Shared/heaputils.h
changeset 62 1c2bb2fc7c87
parent 54 a151135b0cf9
equal deleted inserted replaced
56:aa2539c91954 62:1c2bb2fc7c87
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 // 
     8 // 
     9 // Initial Contributors:
     9 // Initial Contributors:
    10 // Accenture - Initial contribution
    10 // Accenture - Initial contribution
    11 //
    11 //
    12 
    12 // Contributors:
       
    13 // Adrian Issott (Nokia) - Updates for kernel-side alloc helper & RHybridHeap v2
       
    14 //
    13 
    15 
    14 #ifndef FSHELL_HEAP_UTILS_H
    16 #ifndef FSHELL_HEAP_UTILS_H
    15 #define FSHELL_HEAP_UTILS_H
    17 #define FSHELL_HEAP_UTILS_H
    16 
    18 
    17 #include <e32cmn.h>
    19 #include <e32cmn.h>
    39 HUCLASS(RAllocatorHelper) // class RAllocatorHelper
    41 HUCLASS(RAllocatorHelper) // class RAllocatorHelper
    40 	{
    42 	{
    41 public:
    43 public:
    42 	HUIMPORT_C RAllocatorHelper();
    44 	HUIMPORT_C RAllocatorHelper();
    43 #ifdef __KERNEL_MODE__
    45 #ifdef __KERNEL_MODE__
    44 	TLinAddr GetKernelAllocator(DChunk* aKernelChunk);
    46 	static TLinAddr GetKernelAllocator(DChunk* aKernelChunk);
    45 	TInt OpenKernelHeap();
    47 	TInt OpenKernelHeap();
    46 #else
    48 #else
    47 	HUIMPORT_C TInt Open(RAllocator* aAllocator);
    49 	HUIMPORT_C TInt Open(RAllocator* aAllocator);
    48 #endif
    50 #endif
    49 	HUIMPORT_C TInt SetCellNestingLevel(TAny* aCell, TInt aNestingLevel);
    51 	HUIMPORT_C TInt SetCellNestingLevel(TAny* aCell, TInt aNestingLevel);
   109 	enum TType
   111 	enum TType
   110 		{
   112 		{
   111 		ETypeUnknown,
   113 		ETypeUnknown,
   112 		ETypeRHeap,
   114 		ETypeRHeap,
   113 		ETypeRHybridHeap,
   115 		ETypeRHybridHeap,
       
   116         ETypeRHybridHeapV2,
   114 		};
   117 		};
   115 	TType GetType() const; // This is for information only, nothing should care about the return value
   118 	TType GetType() const; // This is for information only, nothing should care about the return value
   116 #endif
   119 #endif
   117 
   120 
   118 protected:
   121 protected:
   122 #ifndef __KERNEL_MODE__
   125 #ifndef __KERNEL_MODE__
   123 	static TInt EuserIsUdeb();
   126 	static TInt EuserIsUdeb();
   124 #endif
   127 #endif
   125 	virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
   128 	virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
   126 	virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
   129 	virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
   127 
   130 	
       
   131 	void SetIsKernelHeapAllocator(TBool aIsKernelHeapAllocator);
       
   132 	TBool GetIsKernelHeapAllocator() const;	
       
   133 	
   128 #ifndef __KERNEL_MODE__
   134 #ifndef __KERNEL_MODE__
   129 protected:
   135 protected:
   130 #else
   136 #else
   131 public:
   137 public:
   132 #endif	
   138 #endif	
   148 	TUint PageMapOperatorBrackets(unsigned ix, TInt& err) const;
   154 	TUint PageMapOperatorBrackets(unsigned ix, TInt& err) const;
   149 	TInt PageMapFind(TUint start, TUint bit, TInt& err);
   155 	TInt PageMapFind(TUint start, TUint bit, TInt& err);
   150 	TUint PageMapBits(unsigned ix, unsigned len, TInt& err);
   156 	TUint PageMapBits(unsigned ix, unsigned len, TInt& err);
   151 	TUint PagedDecode(TUint pos, TInt& err);
   157 	TUint PagedDecode(TUint pos, TInt& err);
   152 	TInt TreeWalk(TUint32 aSlabRoot, TInt aSlabType, TWalkFunc3 aCallbackFn, TAny* aContext, TBool& shouldContinue);
   158 	TInt TreeWalk(TUint32 aSlabRoot, TInt aSlabType, TWalkFunc3 aCallbackFn, TAny* aContext, TBool& shouldContinue);
       
   159 
       
   160 private:
       
   161 	TInt PageMapOffset() const;
       
   162     TInt MallocStateOffset() const;
       
   163     TInt SparePageOffset() const;
       
   164     TInt PartialPageOffset() const;
       
   165     TInt FullSlabOffset() const;
       
   166     TInt SlabAllocOffset() const;
       
   167     TInt UserInitialHeapMetaDataSize() const;
       
   168 
   153 protected:
   169 protected:
   154 	TLinAddr iAllocatorAddress;
   170 	TLinAddr iAllocatorAddress;
   155 	enum TAllocatorType
   171 	enum TAllocatorType
   156 		{
   172 		{
   157 		EUnknown,
   173 		EAllocatorNotSet,
   158 		EAllocator,
   174 		EAllocatorUnknown,
   159 		EUrelOldRHeap,
   175 		EUrelOldRHeap,
   160 		EUdebOldRHeap,
   176 		EUdebOldRHeap,
   161 		EUrelHybridHeap,
   177 		EUrelHybridHeap,
   162 		EUdebHybridHeap,
   178 		EUdebHybridHeap,
       
   179         EUrelHybridHeapV2,
       
   180         EUdebHybridHeapV2,
   163 		};
   181 		};
   164 	TAllocatorType iAllocatorType;
   182 	TAllocatorType iAllocatorType;
       
   183 	
   165 private:
   184 private:
   166 	THeapInfo* iInfo;
   185 	THeapInfo* iInfo;
   167 	TUint iValidInfo;
   186 	TBool iIsKernelHeapAllocator;
   168 	TUint8* iTempSlabBitmap;
   187 	TUint8* iTempSlabBitmap;
   169 	mutable TAny* iPageCache;
   188 	mutable TAny* iPageCache;
   170 	mutable TLinAddr iPageCacheAddr;
   189 	mutable TLinAddr iPageCacheAddr;
   171 #ifdef __KERNEL_MODE__
   190 #ifdef __KERNEL_MODE__
   172 	DChunk* iChunk;
   191 	DChunk* iChunk;