perfsrv/memspy/Driver/Shared/heaputils.h
changeset 55 f2950aff7424
parent 48 516af714ebb4
child 54 a151135b0cf9
--- a/perfsrv/memspy/Driver/Shared/heaputils.h	Fri Sep 17 08:38:31 2010 +0300
+++ b/perfsrv/memspy/Driver/Shared/heaputils.h	Mon Oct 04 02:45:59 2010 +0300
@@ -41,6 +41,7 @@
 public:
 	HUIMPORT_C RAllocatorHelper();
 #ifdef __KERNEL_MODE__
+	TLinAddr GetKernelAllocator(DChunk* aKernelChunk);
 	TInt OpenKernelHeap();
 #else
 	HUIMPORT_C TInt Open(RAllocator* aAllocator);
@@ -123,6 +124,12 @@
 #endif
 	virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
 	virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
+
+#ifndef __KERNEL_MODE__
+protected:
+#else
+public:
+#endif	
 	virtual TInt TryLock();
 	virtual void TryUnlock();
 
@@ -171,22 +178,40 @@
 
 #ifdef __KERNEL_MODE__
 
-class RKernelSideAllocatorHelper : public RAllocatorHelper
-	{
+class RUserAllocatorHelper : public RAllocatorHelper
+    {
 public:
-	RKernelSideAllocatorHelper();
-	TInt OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb);
-	virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
-	virtual void Close();
+    RUserAllocatorHelper();
+    TInt OpenUserHeap(TUint aThreadId, TLinAddr aAllocatorAddress, TBool aEuserIsUdeb);
+    virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
+    virtual void Close();
 
 protected:
-	virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
-	virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
-	virtual TInt TryLock();
-	virtual void TryUnlock();
+    virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
+    virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
+    virtual TInt TryLock();
+    virtual void TryUnlock();
 private:
-	DThread* iThread;
-	};
+    DThread* iThread;
+    };
+
+class RKernelCopyAllocatorHelper : public RAllocatorHelper
+    {
+public:
+    RKernelCopyAllocatorHelper();
+    TInt OpenCopiedHeap(DChunk* aOriginalChunk, DChunk* aCopiedChunk, TInt aOffset);
+    virtual DChunk* OpenUnderlyingChunk(); // Must be in CS
+    virtual void Close();
+
+protected:
+    virtual TInt ReadData(TLinAddr aLocation, TAny* aResult, TInt aSize) const;
+    virtual TInt WriteData(TLinAddr aLocation, const TAny* aData, TInt aSize);
+    virtual TInt TryLock();
+    virtual void TryUnlock();
+private:
+    DChunk* iCopiedChunk;
+    TInt iOffset; // from the original kernel heap to the copied heap
+    };
 
 #else