sl@0: // Copyright (c) 2007-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\defrag\t_pagemove.cia sl@0: // All rights reserved. sl@0: // This code is used to test code mofication while moving a page. sl@0: // sl@0: // sl@0: sl@0: #include sl@0: sl@0: #ifdef __CPU_ARM sl@0: sl@0: /* sl@0: * Assembly code to test pagemove while writing to code section. sl@0: * NOTE: Do not change instruction ordering without looking at t_pagemove.cpp sl@0: * Look at TestCodeModification and TestCodeAsync (TestCodeModificationAsync) sl@0: */ sl@0: __NAKED__ TInt TestCodeModFunc(void) sl@0: { sl@0: asm("mov r0, #5 "); sl@0: asm("b 1f"); sl@0: /* Need to put 3f here because this jump will move up by one instruction */ sl@0: asm("b 3f"); sl@0: asm("1: "); sl@0: asm("mov r0, #1 "); sl@0: asm("b 3f"); sl@0: asm("2: "); sl@0: asm("mov r0, #2 "); sl@0: asm("3: "); sl@0: __JUMP(,lr); sl@0: } sl@0: sl@0: sl@0: __NAKED__ TInt Increment(TInt) sl@0: { sl@0: asm("add r0, r0, #1 "); sl@0: __JUMP(,lr); sl@0: asm("Increment__Fi_end: "); sl@0: } sl@0: sl@0: __NAKED__ TUint Increment_Length() sl@0: { sl@0: asm("adr r0, Increment__Fi_end "); sl@0: asm("adr r1, Increment__Fi "); sl@0: asm("sub r0, r0, r1 "); sl@0: __JUMP(,lr); sl@0: } sl@0: sl@0: __NAKED__ TInt Decrement(TInt) sl@0: { sl@0: asm("sub r0, r0, #1 "); sl@0: __JUMP(,lr); sl@0: asm("Decrement__Fi_end: "); sl@0: } sl@0: sl@0: __NAKED__ TUint Decrement_Length() sl@0: { sl@0: asm("adr r0, Decrement__Fi_end "); sl@0: asm("adr r1, Decrement__Fi "); sl@0: asm("sub r0, r0, r1 "); sl@0: __JUMP(,lr); sl@0: } sl@0: sl@0: #endif