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