os/kernelhwsrv/kerneltest/e32test/debug/t_codemodifier.cia
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32test\debug\t_codemodifier.cia
sl@0
    15
// See e32test\debug\t_codemodifier.cpp for details
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
#include <u32std.h>
sl@0
    20
sl@0
    21
#ifdef __CPU_ARM
sl@0
    22
const TUint32 KArmBreakPoint = 0xE7F123F4;
sl@0
    23
sl@0
    24
sl@0
    25
#define BRK_4()	\
sl@0
    26
	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
sl@0
    27
	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
sl@0
    28
	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
sl@0
    29
	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
sl@0
    30
sl@0
    31
#define BRK_16()	\
sl@0
    32
	BRK_4()	\
sl@0
    33
	BRK_4()	\
sl@0
    34
	BRK_4()	\
sl@0
    35
	BRK_4()	\
sl@0
    36
sl@0
    37
#define BRK_64()	\
sl@0
    38
	BRK_16()	\
sl@0
    39
	BRK_16()	\
sl@0
    40
	BRK_16()	\
sl@0
    41
	BRK_16()	\
sl@0
    42
sl@0
    43
#define BRK_256()	\
sl@0
    44
	BRK_64()	\
sl@0
    45
	BRK_64()	\
sl@0
    46
	BRK_64()	\
sl@0
    47
	BRK_64()	\
sl@0
    48
sl@0
    49
#define BRK_1024()	\
sl@0
    50
	BRK_256()	\
sl@0
    51
	BRK_256()	\
sl@0
    52
	BRK_256()	\
sl@0
    53
	BRK_256()	\
sl@0
    54
sl@0
    55
__NAKED__ void CodeArea()
sl@0
    56
	{
sl@0
    57
	//These 1025 breakpoints will go accross page boundaries.
sl@0
    58
	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); \
sl@0
    59
	BRK_1024();
sl@0
    60
	__JUMP(,lr);
sl@0
    61
	}
sl@0
    62
sl@0
    63
/**
sl@0
    64
The function will run in the server and is coded to cause panic.
sl@0
    65
However, it will be altered remotely by the client before it runs.
sl@0
    66
*/
sl@0
    67
__NAKED__ void TestFunc()
sl@0
    68
	{
sl@0
    69
	asm(".word %a0" : : "i" ((TInt)KArmBreakPoint)); //This would panic but it will be replaced by NOP
sl@0
    70
	asm("nop");
sl@0
    71
	__JUMP(,lr);
sl@0
    72
	}
sl@0
    73
#endif