os/kernelhwsrv/kernel/eka/drivers/trace/arm/btracex.cia
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2005-2009 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 the License "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 // e32\drivers\trace\arm\btracex.cia
    15 // 
    16 //
    17 
    18 #include <e32cia.h>
    19 #include <kernel/kern_priv.h>
    20 #include "drivers/btrace.h"
    21 #ifndef __SMP__
    22 #include "highrestimer.h"
    23 #endif
    24 
    25 #ifdef BTRACE_DRIVER_MACHINE_CODED
    26 
    27 #ifndef HAS_HIGH_RES_TIMER
    28 //#undef BTRACE_INCLUDE_TIMESTAMPS
    29 #endif
    30 
    31 __NAKED__ TBool TBTraceBufferK::TraceWithTimestamp2(TUint32 aHeader,TUint32 aHeader2,TUint32 aContext,TUint32 a1,TUint32 a2,TUint32 a3,TUint32 aExtra,TUint32 aPc)
    32 	{
    33 #ifdef BTRACE_INCLUDE_TIMESTAMPS
    34 #define USE_TIMESTAMP2 
    35 #include "btracex_impl.cia"
    36 #undef USE_TIMESTAMP2
    37 #endif // If compiling without timestamp support this function falls through to the normal Trace()...
    38 	}
    39 
    40 __NAKED__ TBool TBTraceBufferK::Trace(TUint32 aHeader,TUint32 aHeader2,TUint32 aContext,TUint32 a1,TUint32 a2,TUint32 a3,TUint32 aExtra,TUint32 aPc)
    41 	{
    42 #include "btracex_impl.cia"
    43 
    44 	asm("trace_dropped: ");		// get here with r5 = &user_buffer
    45 	asm("mov	r0, #0 ");
    46 	asm("str	r0, [r10, #%a0]" : : "i" _FOFF(TBTraceBufferK,iRequestDataSize));
    47 
    48 	asm("trace_off:");			// get here with r5 = &user_buffer
    49 	asm("ldr	r7, [r5, #%a0]" : : "i" _FOFF(TBTraceBuffer,iGeneration));
    50 	asm("str	r10, [r10,#%a0]" : : "i" _FOFF(TBTraceBufferK,iDropped));	// flag we dropped a trace
    51 #ifdef __SMP__
    52 	__DATA_MEMORY_BARRIER_Z__(r8);		// make sure head pointer update seen before generation update
    53 #endif
    54 	asm("add	r7, r7, #1 ");
    55 	asm("str	r7, [r5, #%a0]" : : "i" _FOFF(TBTraceBuffer,iGeneration));	// make sure iGeneration doesn't go out of sync
    56 
    57 	asm("done:");
    58 	asm("add	sp, sp, #16 ");			// drop args
    59 	asm("ldmfd	sp!, {r4-r12,lr} ");
    60 	asm("mov	r0, #1 ");				// return TRUE
    61 #ifndef __SMP__
    62 	asm("msr	cpsr_c, r12 ");			// restore interrupts
    63 #endif
    64 	__JUMP(,lr);
    65 
    66 	asm("__Buffer: ");
    67 	asm(".word Buffer ");
    68 	asm("__03020100: ");
    69 	asm(".word 0x03020100 ");
    70 	asm("__04040404: ");
    71 	asm(".word 0x04040404 ");
    72 	}
    73 
    74 
    75 
    76 
    77 #endif // BTRACE_DRIVER_MACHINE_CODED