1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/drivers/trace/arm/btracex.cia Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,77 @@
1.4 +// Copyright (c) 2005-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 +// e32\drivers\trace\arm\btracex.cia
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32cia.h>
1.22 +#include <kernel/kern_priv.h>
1.23 +#include "drivers/btrace.h"
1.24 +#ifndef __SMP__
1.25 +#include "highrestimer.h"
1.26 +#endif
1.27 +
1.28 +#ifdef BTRACE_DRIVER_MACHINE_CODED
1.29 +
1.30 +#ifndef HAS_HIGH_RES_TIMER
1.31 +//#undef BTRACE_INCLUDE_TIMESTAMPS
1.32 +#endif
1.33 +
1.34 +__NAKED__ TBool TBTraceBufferK::TraceWithTimestamp2(TUint32 aHeader,TUint32 aHeader2,TUint32 aContext,TUint32 a1,TUint32 a2,TUint32 a3,TUint32 aExtra,TUint32 aPc)
1.35 + {
1.36 +#ifdef BTRACE_INCLUDE_TIMESTAMPS
1.37 +#define USE_TIMESTAMP2
1.38 +#include "btracex_impl.cia"
1.39 +#undef USE_TIMESTAMP2
1.40 +#endif // If compiling without timestamp support this function falls through to the normal Trace()...
1.41 + }
1.42 +
1.43 +__NAKED__ TBool TBTraceBufferK::Trace(TUint32 aHeader,TUint32 aHeader2,TUint32 aContext,TUint32 a1,TUint32 a2,TUint32 a3,TUint32 aExtra,TUint32 aPc)
1.44 + {
1.45 +#include "btracex_impl.cia"
1.46 +
1.47 + asm("trace_dropped: "); // get here with r5 = &user_buffer
1.48 + asm("mov r0, #0 ");
1.49 + asm("str r0, [r10, #%a0]" : : "i" _FOFF(TBTraceBufferK,iRequestDataSize));
1.50 +
1.51 + asm("trace_off:"); // get here with r5 = &user_buffer
1.52 + asm("ldr r7, [r5, #%a0]" : : "i" _FOFF(TBTraceBuffer,iGeneration));
1.53 + asm("str r10, [r10,#%a0]" : : "i" _FOFF(TBTraceBufferK,iDropped)); // flag we dropped a trace
1.54 +#ifdef __SMP__
1.55 + __DATA_MEMORY_BARRIER_Z__(r8); // make sure head pointer update seen before generation update
1.56 +#endif
1.57 + asm("add r7, r7, #1 ");
1.58 + asm("str r7, [r5, #%a0]" : : "i" _FOFF(TBTraceBuffer,iGeneration)); // make sure iGeneration doesn't go out of sync
1.59 +
1.60 + asm("done:");
1.61 + asm("add sp, sp, #16 "); // drop args
1.62 + asm("ldmfd sp!, {r4-r12,lr} ");
1.63 + asm("mov r0, #1 "); // return TRUE
1.64 +#ifndef __SMP__
1.65 + asm("msr cpsr_c, r12 "); // restore interrupts
1.66 +#endif
1.67 + __JUMP(,lr);
1.68 +
1.69 + asm("__Buffer: ");
1.70 + asm(".word Buffer ");
1.71 + asm("__03020100: ");
1.72 + asm(".word 0x03020100 ");
1.73 + asm("__04040404: ");
1.74 + asm(".word 0x04040404 ");
1.75 + }
1.76 +
1.77 +
1.78 +
1.79 +
1.80 +#endif // BTRACE_DRIVER_MACHINE_CODED