sysanadatacapture/piprofiler/piprofiler/plugins/GeneralsPlugin/src/GeneralsSampler.cia
changeset 1 3ff3fecb12fe
equal deleted inserted replaced
0:f0f2b8682603 1:3ff3fecb12fe
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <platform.h>
       
    20 
       
    21 #include "GeneralsDriver.h"
       
    22 #include <kern_priv.h>		//temporary
       
    23 
       
    24 #ifdef __WINS__
       
    25 __NAKED__ TUint* IntStackPtr()
       
    26 {
       
    27 	return 0;
       
    28 }
       
    29 
       
    30 __NAKED__ TUint32 SPSR()
       
    31 {
       
    32 	return 0;
       
    33 }
       
    34 __NAKED__ void UsrModLr(TUint32* a)
       
    35 {
       
    36 	*a = 0;
       
    37 }
       
    38 #else
       
    39 
       
    40 __NAKED__ TUint* IntStackPtr()
       
    41 {
       
    42 	asm("mrs r1, cpsr ");
       
    43 	asm("bic r3, r1, #0x1f ");
       
    44 //#ifdef __MISA__
       
    45 //	asm("orr r3, r3, #0xd1 ");		// mode_fiq, all interrupts off
       
    46 //#else
       
    47 	asm("orr r3, r3, #0xd2 ");		// mode_irq, all interrupts off
       
    48 //#endif
       
    49 	asm("msr cpsr, r3 ");
       
    50 	asm("mov r0, sp ");				// r0=sp_irq or sp_fiq
       
    51 	asm("msr cpsr, r1 ");			// restore interrupts
       
    52 	__JUMP(,lr);
       
    53 }
       
    54 
       
    55 __NAKED__ TUint32 SPSR()
       
    56 {
       
    57 	asm("mrs r0, spsr ");
       
    58 	__JUMP(,lr);
       
    59 }
       
    60 __NAKED__ void UsrModLr(TUint32*)
       
    61 {
       
    62 	// r0 = address to store
       
    63 	asm ("stmia r0,{lr}^");
       
    64 	__JUMP(,lr);
       
    65 }
       
    66 
       
    67 #endif