os/kernelhwsrv/kerneltest/e32test/defrag/t_pagemove.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) 2007-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\defrag\t_pagemove.cia
sl@0
    15
// All rights reserved.
sl@0
    16
// This code is used to test code mofication while moving a page.
sl@0
    17
// 
sl@0
    18
//
sl@0
    19
sl@0
    20
#include <u32std.h>
sl@0
    21
sl@0
    22
#ifdef __CPU_ARM
sl@0
    23
sl@0
    24
/*
sl@0
    25
 * Assembly code to test pagemove while writing to code section. 
sl@0
    26
 * NOTE: Do not change instruction ordering without looking at t_pagemove.cpp 
sl@0
    27
 * Look at TestCodeModification and TestCodeAsync (TestCodeModificationAsync)
sl@0
    28
 */
sl@0
    29
__NAKED__ TInt TestCodeModFunc(void)
sl@0
    30
	{
sl@0
    31
	asm("mov     r0, #5 ");
sl@0
    32
	asm("b 1f");
sl@0
    33
	/* Need to put 3f here because this jump will move up by one instruction */
sl@0
    34
	asm("b 3f");
sl@0
    35
	asm("1: ");
sl@0
    36
	asm("mov     r0, #1 ");
sl@0
    37
	asm("b 3f");
sl@0
    38
	asm("2: ");
sl@0
    39
	asm("mov     r0, #2 ");
sl@0
    40
	asm("3: ");
sl@0
    41
	__JUMP(,lr);
sl@0
    42
	}
sl@0
    43
sl@0
    44
sl@0
    45
__NAKED__ TInt Increment(TInt)
sl@0
    46
	{
sl@0
    47
	asm("add r0, r0, #1 ");
sl@0
    48
	__JUMP(,lr);
sl@0
    49
	asm("Increment__Fi_end: ");
sl@0
    50
	}
sl@0
    51
sl@0
    52
__NAKED__ TUint Increment_Length()
sl@0
    53
	{
sl@0
    54
	asm("adr r0, Increment__Fi_end ");
sl@0
    55
	asm("adr r1, Increment__Fi ");
sl@0
    56
	asm("sub r0, r0, r1 ");
sl@0
    57
	__JUMP(,lr);
sl@0
    58
	}
sl@0
    59
sl@0
    60
__NAKED__ TInt Decrement(TInt)
sl@0
    61
	{
sl@0
    62
	asm("sub r0, r0, #1 ");
sl@0
    63
	__JUMP(,lr);
sl@0
    64
	asm("Decrement__Fi_end: ");
sl@0
    65
	}
sl@0
    66
sl@0
    67
__NAKED__ TUint Decrement_Length()
sl@0
    68
	{
sl@0
    69
	asm("adr r0, Decrement__Fi_end ");
sl@0
    70
	asm("adr r1, Decrement__Fi ");
sl@0
    71
	asm("sub r0, r0, r1 ");
sl@0
    72
	__JUMP(,lr);
sl@0
    73
	}
sl@0
    74
sl@0
    75
#endif