tracesrv/tracecore/writers/xti/common/src/TraceCoreRegisterWriter.cia
changeset 56 aa2539c91954
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 // Copyright (c) 2007-2010 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 "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 
       
    15 #include "TraceCoreRegisterWriter.h"
       
    16 
       
    17 /**
       
    18  * InterrupsDisabled
       
    19  * Check if interrupts IRQ/FIQ disabled
       
    20  * Return 0x08 if only IRQ disabled, 0x04 if only FIQ disabled, 0x0C if both disabled.
       
    21  * @return true if interrupt(s) disabled, otherwise 0 (false)
       
    22  */
       
    23 /*EXPORT_C*/ __NAKED__ TUint32 DTraceCoreRegisterWriter::InterruptsDisabled() 
       
    24     {
       
    25     // save work regs
       
    26     asm( "stmfd sp!, {r2, r4}" );
       
    27 	
       
    28     // check if interrupts disabled
       
    29     asm( "mrs r2,cpsr" );
       
    30     asm( "and r0,r2,#0xc0" ); // 0b11000000 IRQ disabled bit 7, FIQ disabled bit 6
       
    31 		
       
    32     // restore work regs
       
    33     asm( "ldmfd sp!,{r2,r4}" );
       
    34 	
       
    35     // move pc,lr
       
    36     asm( "bx lr" );
       
    37     }
       
    38