sl@0: // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\debug\t_codemodifier.cia sl@0: // See e32test\debug\t_codemodifier.cpp for details sl@0: // sl@0: // sl@0: sl@0: #include sl@0: sl@0: #ifdef __CPU_ARM sl@0: const TUint32 KArmBreakPoint = 0xE7F123F4; sl@0: sl@0: sl@0: #define BRK_4() \ sl@0: asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \ sl@0: asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \ sl@0: asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \ sl@0: asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \ sl@0: sl@0: #define BRK_16() \ sl@0: BRK_4() \ sl@0: BRK_4() \ sl@0: BRK_4() \ sl@0: BRK_4() \ sl@0: sl@0: #define BRK_64() \ sl@0: BRK_16() \ sl@0: BRK_16() \ sl@0: BRK_16() \ sl@0: BRK_16() \ sl@0: sl@0: #define BRK_256() \ sl@0: BRK_64() \ sl@0: BRK_64() \ sl@0: BRK_64() \ sl@0: BRK_64() \ sl@0: sl@0: #define BRK_1024() \ sl@0: BRK_256() \ sl@0: BRK_256() \ sl@0: BRK_256() \ sl@0: BRK_256() \ sl@0: sl@0: __NAKED__ void CodeArea() sl@0: { sl@0: //These 1025 breakpoints will go accross page boundaries. sl@0: asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \ sl@0: BRK_1024(); sl@0: __JUMP(,lr); sl@0: } sl@0: sl@0: /** sl@0: The function will run in the server and is coded to cause panic. sl@0: However, it will be altered remotely by the client before it runs. sl@0: */ sl@0: __NAKED__ void TestFunc() sl@0: { sl@0: asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); //This would panic but it will be replaced by NOP sl@0: asm("nop"); sl@0: __JUMP(,lr); sl@0: } sl@0: #endif