diff -r 516af714ebb4 -r f2950aff7424 perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h --- a/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h Fri Sep 17 08:38:31 2010 +0300 +++ b/perfsrv/memspy/Driver/Kernel/Include/MemSpyDriverHeap.h Mon Oct 04 02:45:59 2010 +0300 @@ -26,6 +26,7 @@ // User includes #include "MemSpyDriverObjectsInternal.h" +#include "MemSpyDriverOSAdaption.h" // Constants // We shouldn't be using any of these any more! -Tomsci @@ -34,7 +35,6 @@ const TUint KRHeapMemberDataSize = KRHeapObjectSize - KRAllocatorAndRHeapMemberDataOffset; // Classes referenced -class DMemSpyDriverOSAdaption; namespace LtkUtils { class RAllocatorHelper; @@ -58,49 +58,12 @@ virtual void Close(); virtual DChunk& Chunk() = 0; virtual const DChunk& Chunk() const = 0; + virtual const TLinAddr ChunkBase() const = 0; protected: LtkUtils::RAllocatorHelper* iHelper; }; - - - -class RMemSpyDriverRHeapReadFromCopy : public RMemSpyDriverRHeapBase - { -protected: - RMemSpyDriverRHeapReadFromCopy( DMemSpyDriverOSAdaption& aOSAdaption ); - -public: // New API - void AssociateWithKernelChunk( DChunk* aChunk, TLinAddr aAddress, TUint32 aMappingAttributes ); - -public: // From RMemSpyDriverRHeapBase - void Reset(); - DChunk& Chunk(); - const DChunk& Chunk() const; - -protected: - inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; } - -private: - DMemSpyDriverOSAdaption& iOSAdaption; - - // Copy of the client's heap data - DChunk* iChunk; - TLinAddr iChunkAddress; - TUint32 iChunkMappingAttributes; - - // Calculated delta between client's address space values and actual kernel - // address of the heap chunk. - //TUint iClientToKernelDelta; - }; - - - - - - - class RMemSpyDriverRHeapUser : public RMemSpyDriverRHeapBase { public: @@ -109,9 +72,11 @@ DChunk& Chunk() { return *iChunk; } const DChunk& Chunk() const { return *iChunk; } + const TLinAddr ChunkBase() const { return (TLinAddr)OSAdaption().DChunk().GetBase(*iChunk); } private: inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; } + inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; } private: DMemSpyDriverOSAdaption& iOSAdaption; @@ -119,29 +84,39 @@ }; - -class RMemSpyDriverRHeapKernelFromCopy : public RMemSpyDriverRHeapReadFromCopy +class RMemSpyDriverRHeapKernelFromCopy : public RMemSpyDriverRHeapBase { public: RMemSpyDriverRHeapKernelFromCopy( DMemSpyDriverOSAdaption& aOSAdaption ); public: // API - void SetKernelHeap( RHeapK& aKernelHeap ); + TInt AssociateWithKernelChunk( DChunk* aKernelChunk, DChunk* aCopiedChunk, TLinAddr aCopiedChunkBase, TInt aOffset ); + TBool IsOpen(); public: // From RMemSpyDriverRHeapBase - //void DisassociateWithKernelChunk(); - void Close(); + void Reset(); + void Close(); + DChunk& Chunk(); + const DChunk& Chunk() const; + const TLinAddr ChunkBase() const { return iChunkBase; } private: - RHeapK* iKernelHeap; + inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; } + inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; } + +private: + DMemSpyDriverOSAdaption& iOSAdaption; + + // Copy of the client's heap data + DChunk* iChunk; + TLinAddr iChunkBase; }; - class RMemSpyDriverRHeapKernelInPlace : public RMemSpyDriverRHeapBase { public: - RMemSpyDriverRHeapKernelInPlace(); + RMemSpyDriverRHeapKernelInPlace( DMemSpyDriverOSAdaption& aOSAdaption ); TInt OpenKernelHeap(); @@ -150,10 +125,17 @@ DChunk& Chunk(); const DChunk& Chunk() const; + const TLinAddr ChunkBase() const { return (TLinAddr)OSAdaption().DChunk().GetBase(*iChunk); } - // Only important member data is the base class's RAllocatorHelper - // We do cache the chunk though +private: + inline DMemSpyDriverOSAdaption& OSAdaption() { return iOSAdaption; } + inline const DMemSpyDriverOSAdaption& OSAdaption() const { return iOSAdaption; } + private: + DMemSpyDriverOSAdaption& iOSAdaption; + + // Only important member data is the base class's RAllocatorHelper + // We do cache the chunk though DChunk* iChunk; };