os/kernelhwsrv/kerneltest/e32test/debug/t_codemodifier.cia
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/debug/t_codemodifier.cia	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,73 @@
     1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\debug\t_codemodifier.cia
    1.18 +// See e32test\debug\t_codemodifier.cpp for details
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#include <u32std.h>
    1.23 +
    1.24 +#ifdef __CPU_ARM
    1.25 +const TUint32 KArmBreakPoint = 0xE7F123F4;
    1.26 +
    1.27 +
    1.28 +#define BRK_4()	\
    1.29 +	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
    1.30 +	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
    1.31 +	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
    1.32 +	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
    1.33 +
    1.34 +#define BRK_16()	\
    1.35 +	BRK_4()	\
    1.36 +	BRK_4()	\
    1.37 +	BRK_4()	\
    1.38 +	BRK_4()	\
    1.39 +
    1.40 +#define BRK_64()	\
    1.41 +	BRK_16()	\
    1.42 +	BRK_16()	\
    1.43 +	BRK_16()	\
    1.44 +	BRK_16()	\
    1.45 +
    1.46 +#define BRK_256()	\
    1.47 +	BRK_64()	\
    1.48 +	BRK_64()	\
    1.49 +	BRK_64()	\
    1.50 +	BRK_64()	\
    1.51 +
    1.52 +#define BRK_1024()	\
    1.53 +	BRK_256()	\
    1.54 +	BRK_256()	\
    1.55 +	BRK_256()	\
    1.56 +	BRK_256()	\
    1.57 +
    1.58 +__NAKED__ void CodeArea()
    1.59 +	{
    1.60 +	//These 1025 breakpoints will go accross page boundaries.
    1.61 +	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
    1.62 +	BRK_1024();
    1.63 +	__JUMP(,lr);
    1.64 +	}
    1.65 +
    1.66 +/**
    1.67 +The function will run in the server and is coded to cause panic.
    1.68 +However, it will be altered remotely by the client before it runs.
    1.69 +*/
    1.70 +__NAKED__ void TestFunc()
    1.71 +	{
    1.72 +	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); //This would panic but it will be replaced by NOP
    1.73 +	asm("nop");
    1.74 +	__JUMP(,lr);
    1.75 +	}
    1.76 +#endif