| author | Mike Kinghan <mikek@symbian.org> |
| Wed, 04 Aug 2010 13:51:27 +0100 | |
| branch | GCC_SURGE |
| changeset 238 | 959c796a6191 |
| parent 228 | ca2d72b7d125 |
| permissions | -rw-r--r-- |
| 0 | 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); |
|
|
228
ca2d72b7d125
Fix for bug3379 - [GCCE] Possibly the most obscure undefined symbols in existence.
Mike Kinghan <mikek@symbian.org>
parents:
0
diff
changeset
|
49 |
asm("_Z9Incrementi_end: ");
|
| 0 | 50 |
} |
51 |
||
52 |
__NAKED__ TUint Increment_Length() |
|
53 |
{
|
|
|
228
ca2d72b7d125
Fix for bug3379 - [GCCE] Possibly the most obscure undefined symbols in existence.
Mike Kinghan <mikek@symbian.org>
parents:
0
diff
changeset
|
54 |
asm("adr r0, _Z9Incrementi_end ");
|
|
ca2d72b7d125
Fix for bug3379 - [GCCE] Possibly the most obscure undefined symbols in existence.
Mike Kinghan <mikek@symbian.org>
parents:
0
diff
changeset
|
55 |
asm("adr r1, _Z9Incrementi ");
|
| 0 | 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); |
|
|
228
ca2d72b7d125
Fix for bug3379 - [GCCE] Possibly the most obscure undefined symbols in existence.
Mike Kinghan <mikek@symbian.org>
parents:
0
diff
changeset
|
64 |
asm("_Z9Decrementi_end: ");
|
| 0 | 65 |
} |
66 |
||
67 |
__NAKED__ TUint Decrement_Length() |
|
68 |
{
|
|
|
228
ca2d72b7d125
Fix for bug3379 - [GCCE] Possibly the most obscure undefined symbols in existence.
Mike Kinghan <mikek@symbian.org>
parents:
0
diff
changeset
|
69 |
asm("adr r0, _Z9Decrementi_end ");
|
|
ca2d72b7d125
Fix for bug3379 - [GCCE] Possibly the most obscure undefined symbols in existence.
Mike Kinghan <mikek@symbian.org>
parents:
0
diff
changeset
|
70 |
asm("adr r1, _Z9Decrementi ");
|
| 0 | 71 |
asm("sub r0, r0, r1 ");
|
72 |
__JUMP(,lr); |
|
73 |
} |
|
74 |
||
75 |
#endif |