os/kernelhwsrv/kerneltest/e32test/defrag/t_pagemove.cia
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/defrag/t_pagemove.cia	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,75 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32test\defrag\t_pagemove.cia
    1.18 +// All rights reserved.
    1.19 +// This code is used to test code mofication while moving a page.
    1.20 +// 
    1.21 +//
    1.22 +
    1.23 +#include <u32std.h>
    1.24 +
    1.25 +#ifdef __CPU_ARM
    1.26 +
    1.27 +/*
    1.28 + * Assembly code to test pagemove while writing to code section. 
    1.29 + * NOTE: Do not change instruction ordering without looking at t_pagemove.cpp 
    1.30 + * Look at TestCodeModification and TestCodeAsync (TestCodeModificationAsync)
    1.31 + */
    1.32 +__NAKED__ TInt TestCodeModFunc(void)
    1.33 +	{
    1.34 +	asm("mov     r0, #5 ");
    1.35 +	asm("b 1f");
    1.36 +	/* Need to put 3f here because this jump will move up by one instruction */
    1.37 +	asm("b 3f");
    1.38 +	asm("1: ");
    1.39 +	asm("mov     r0, #1 ");
    1.40 +	asm("b 3f");
    1.41 +	asm("2: ");
    1.42 +	asm("mov     r0, #2 ");
    1.43 +	asm("3: ");
    1.44 +	__JUMP(,lr);
    1.45 +	}
    1.46 +
    1.47 +
    1.48 +__NAKED__ TInt Increment(TInt)
    1.49 +	{
    1.50 +	asm("add r0, r0, #1 ");
    1.51 +	__JUMP(,lr);
    1.52 +	asm("Increment__Fi_end: ");
    1.53 +	}
    1.54 +
    1.55 +__NAKED__ TUint Increment_Length()
    1.56 +	{
    1.57 +	asm("adr r0, Increment__Fi_end ");
    1.58 +	asm("adr r1, Increment__Fi ");
    1.59 +	asm("sub r0, r0, r1 ");
    1.60 +	__JUMP(,lr);
    1.61 +	}
    1.62 +
    1.63 +__NAKED__ TInt Decrement(TInt)
    1.64 +	{
    1.65 +	asm("sub r0, r0, #1 ");
    1.66 +	__JUMP(,lr);
    1.67 +	asm("Decrement__Fi_end: ");
    1.68 +	}
    1.69 +
    1.70 +__NAKED__ TUint Decrement_Length()
    1.71 +	{
    1.72 +	asm("adr r0, Decrement__Fi_end ");
    1.73 +	asm("adr r1, Decrement__Fi ");
    1.74 +	asm("sub r0, r0, r1 ");
    1.75 +	__JUMP(,lr);
    1.76 +	}
    1.77 +
    1.78 +#endif