0
|
1 |
// Copyright (c) 2005-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\debug\t_codemodifier.cia
|
|
15 |
// See e32test\debug\t_codemodifier.cpp for details
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#include <u32std.h>
|
|
20 |
|
|
21 |
#ifdef __CPU_ARM
|
|
22 |
const TUint32 KArmBreakPoint = 0xE7F123F4;
|
|
23 |
|
|
24 |
|
|
25 |
#define BRK_4() \
|
|
26 |
asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
|
|
27 |
asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
|
|
28 |
asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
|
|
29 |
asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
|
|
30 |
|
|
31 |
#define BRK_16() \
|
|
32 |
BRK_4() \
|
|
33 |
BRK_4() \
|
|
34 |
BRK_4() \
|
|
35 |
BRK_4() \
|
|
36 |
|
|
37 |
#define BRK_64() \
|
|
38 |
BRK_16() \
|
|
39 |
BRK_16() \
|
|
40 |
BRK_16() \
|
|
41 |
BRK_16() \
|
|
42 |
|
|
43 |
#define BRK_256() \
|
|
44 |
BRK_64() \
|
|
45 |
BRK_64() \
|
|
46 |
BRK_64() \
|
|
47 |
BRK_64() \
|
|
48 |
|
|
49 |
#define BRK_1024() \
|
|
50 |
BRK_256() \
|
|
51 |
BRK_256() \
|
|
52 |
BRK_256() \
|
|
53 |
BRK_256() \
|
|
54 |
|
|
55 |
__NAKED__ void CodeArea()
|
|
56 |
{
|
|
57 |
//These 1025 breakpoints will go accross page boundaries.
|
|
58 |
asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
|
|
59 |
BRK_1024();
|
|
60 |
__JUMP(,lr);
|
|
61 |
}
|
|
62 |
|
|
63 |
/**
|
|
64 |
The function will run in the server and is coded to cause panic.
|
|
65 |
However, it will be altered remotely by the client before it runs.
|
|
66 |
*/
|
|
67 |
__NAKED__ void TestFunc()
|
|
68 |
{
|
|
69 |
asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); //This would panic but it will be replaced by NOP
|
|
70 |
asm("nop");
|
|
71 |
__JUMP(,lr);
|
|
72 |
}
|
|
73 |
#endif
|