|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32test\defrag\t_pagemove.cia |
|
15 // All rights reserved. |
|
16 // This code is used to test code mofication while moving a page. |
|
17 // |
|
18 // |
|
19 |
|
20 #include <u32std.h> |
|
21 |
|
22 #ifdef __CPU_ARM |
|
23 |
|
24 /* |
|
25 * Assembly code to test pagemove while writing to code section. |
|
26 * NOTE: Do not change instruction ordering without looking at t_pagemove.cpp |
|
27 * Look at TestCodeModification and TestCodeAsync (TestCodeModificationAsync) |
|
28 */ |
|
29 __NAKED__ TInt TestCodeModFunc(void) |
|
30 { |
|
31 asm("mov r0, #5 "); |
|
32 asm("b 1f"); |
|
33 /* Need to put 3f here because this jump will move up by one instruction */ |
|
34 asm("b 3f"); |
|
35 asm("1: "); |
|
36 asm("mov r0, #1 "); |
|
37 asm("b 3f"); |
|
38 asm("2: "); |
|
39 asm("mov r0, #2 "); |
|
40 asm("3: "); |
|
41 __JUMP(,lr); |
|
42 } |
|
43 |
|
44 |
|
45 __NAKED__ TInt Increment(TInt) |
|
46 { |
|
47 asm("add r0, r0, #1 "); |
|
48 __JUMP(,lr); |
|
49 asm("Increment__Fi_end: "); |
|
50 } |
|
51 |
|
52 __NAKED__ TUint Increment_Length() |
|
53 { |
|
54 asm("adr r0, Increment__Fi_end "); |
|
55 asm("adr r1, Increment__Fi "); |
|
56 asm("sub r0, r0, r1 "); |
|
57 __JUMP(,lr); |
|
58 } |
|
59 |
|
60 __NAKED__ TInt Decrement(TInt) |
|
61 { |
|
62 asm("sub r0, r0, #1 "); |
|
63 __JUMP(,lr); |
|
64 asm("Decrement__Fi_end: "); |
|
65 } |
|
66 |
|
67 __NAKED__ TUint Decrement_Length() |
|
68 { |
|
69 asm("adr r0, Decrement__Fi_end "); |
|
70 asm("adr r1, Decrement__Fi "); |
|
71 asm("sub r0, r0, r1 "); |
|
72 __JUMP(,lr); |
|
73 } |
|
74 |
|
75 #endif |