diff -r 000000000000 -r bde4ae8d615e os/kernelhwsrv/kerneltest/e32test/debug/d_codemodifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/os/kernelhwsrv/kerneltest/e32test/debug/d_codemodifier.h Fri Jun 15 03:10:57 2012 +0200 @@ -0,0 +1,95 @@ +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\debug\d_codemodifier.h +// +// + +#ifndef __D_CODEMODIFIER_H__ +#define __D_CODEMODIFIER_H__ + +#include +#ifndef __KERNEL_MODE__ +#include +#endif + +_LIT(KCodeModifierName,"d_codemodifier"); + +/** +The user side class for controlling trace handler hook. +*/ +class RCodeModifierDevice : public RBusLogicalChannel + { +public: + enum TControl + { + EControlThreadId, + + EInitialiseCodeModifier, + ECloseCodeModifier, + + EControlWriteCode, + EControlRestoreCode, + + EControlReadWord, + EControlWriteWord, + + EControlAllocShadowPage, + EControlFreeShadowPage + }; + + //Used by all device calls + struct TData + { + TData(){}; + TData(TInt aServer, TInt aThreadId, TUint aAddress, TInt aSize): + iServer(aServer),iThreadId(aThreadId),iAddress(aAddress),iSize(aSize){}; + + TInt iServer; //0-XIP server, otherwise - NONXIP server + TInt iThreadId; //threadID + TUint iAddress; + TInt iSize; + }; +public: +#ifndef __KERNEL_MODE__ + TInt Open() + {return DoCreate(KCodeModifierName,TVersion(1,0,0),KNullUnit,NULL,NULL);} + + TInt InitialiseCodeModifier(TInt aSize) + {TData data(0,0,0,aSize);return DoControl(EInitialiseCodeModifier, reinterpret_cast(&data));} + TInt CloseCodeModifier() + {TData data(0,0,0,0);return DoControl(ECloseCodeModifier, reinterpret_cast(&data));} + + TInt ThreadId(TInt aServer, TInt aThreadId) + {TData data(aServer,aThreadId,0,0); return DoControl(EControlThreadId, reinterpret_cast(&data));} + + TInt ReadWord(TInt aServer, TInt aAddress, TInt* aValue) + {TData data(aServer,0,aAddress,0); return DoControl(EControlReadWord, reinterpret_cast(&data), reinterpret_cast(aValue));} + TInt WriteWord(TInt aServer, TInt aAddress, TInt aValue) + {TData data(aServer,0,aAddress,0); return DoControl(EControlWriteWord, reinterpret_cast(&data), reinterpret_cast(aValue));} + + TInt WriteCode(TInt aServer, TUint aAddress, TInt aValue, TInt aSize) + {TData data(aServer,0,aAddress,aSize);return DoControl(EControlWriteCode, reinterpret_cast(&data), reinterpret_cast(aValue));} + TInt RestoreCode(TInt aServer, TUint aAddress) + {TData data(aServer,0,aAddress,0); return DoControl(EControlRestoreCode, reinterpret_cast(&data));} + + + TInt AllocShadowPage(TInt aAddress) + {TData data(0,0,aAddress,0);return DoControl(EControlAllocShadowPage, reinterpret_cast(&data));} + TInt FreeShadowPage(TInt aAddress) + {TData data(0,0,aAddress,0);return DoControl(EControlFreeShadowPage, reinterpret_cast(&data));} + +#endif //__KERNEL_MODE__ + }; + +#endif //__D_LOGTOFILE_H__