kerneltest/e32test/debug/d_eventtracker.cia
changeset 9 96e5fb8b040d
equal deleted inserted replaced
-1:000000000000 9:96e5fb8b040d
       
     1 // Copyright (c) 2004-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 // e32test\debug\d_eventtracker.cia
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <arm.h>
       
    19 #include "d_eventtracker.h"
       
    20 
       
    21 //////////////////////////////////////////////////////////////////////////////
       
    22 
       
    23 // CIA symbol macros for Gcc98r2
       
    24 #if defined(__GCC32__)
       
    25 
       
    26 #define CSM_ZN13DEventTracker11HandleEventE12TKernelEventPvS1 " HandleEvent__13DEventTracker12TKernelEventPvT2"
       
    27 
       
    28 // CIA symbol macros for RVCT
       
    29 #elif defined(__ARMCC__)
       
    30 
       
    31 #define CSM_ZN13DEventTracker11HandleEventE12TKernelEventPvS1 " __cpp(DEventTracker::HandleEvent)"
       
    32 
       
    33 // CIA symbol macros for EABI assemblers
       
    34 #else
       
    35 
       
    36 #define CSM_ZN13DEventTracker11HandleEventE12TKernelEventPvS1 " _ZN13DEventTracker11HandleEventE12TKernelEventPvS1_"
       
    37 
       
    38 #endif
       
    39 
       
    40 //////////////////////////////////////////////////////////////////////////////
       
    41 
       
    42 __NAKED__ void DEventTracker::BranchToEventHandler()
       
    43 //
       
    44 // Breakpoint to call our event handler
       
    45 //
       
    46 	{
       
    47 	asm("breakstart: ");													// start of breakpoint.
       
    48 	asm("mov r3, r2");														// set up regs for call to our handler...
       
    49 	asm("mov r2, r1");														//
       
    50 	asm("mov r1, r0");														//
       
    51 	asm("ldr r0, __TheEventTracker ");										// fiddle this pointer
       
    52 	asm("ldr r0, [r0] ");													// load from TheEventTracker
       
    53 	asm("ldr pc, [pc, #-4]" );												// do an absolute jump...
       
    54 	asm(".word " CSM_ZN13DEventTracker11HandleEventE12TKernelEventPvS1 );	//  to DEventTracker::HandleEvent
       
    55 	asm("__TheEventTracker: ");												// address of global variable:
       
    56 	asm(".word %a0" : : "i" (&TheEventTracker));							//  TheEventTracker
       
    57 	asm("breakend: ");														// end of breakpoint.
       
    58 	}
       
    59 
       
    60 __NAKED__ TUint DEventTracker::BreakPointSize()
       
    61 //
       
    62 // Size of breakpoint
       
    63 //
       
    64 	{
       
    65 	asm("ldr r0, = breakend - breakstart");
       
    66 	__JUMP(,lr);
       
    67 	}
       
    68 
       
    69 __NAKED__ TUint DEventTracker::DummyHandler(TKernelEvent /*aEvent*/, TAny* /*a1*/, TAny* /*a2*/)
       
    70 //
       
    71 // Debugger breakpoint-able callback.  Will be copied into RAM
       
    72 //
       
    73 	{
       
    74 	//
       
    75 	// r0=aEvent, r1=a1, r2=a2
       
    76 	//
       
    77 	asm("dummystart: ");											// start of fn.
       
    78 	asm("nop");														// breakpoint-able instruction for the debugger to replace
       
    79 	asm("nop");														// landing zone
       
    80 	asm("nop");														// landing zone
       
    81 	asm("nop");														// landing zone
       
    82 	asm("nop");														// landing zone
       
    83 	asm("nop");														// landing zone
       
    84 	asm("nop");														// landing zone
       
    85 	asm("mov r0, #%a0" : : "i" (DKernelEventHandler::ERunNext));	// return value
       
    86 	__JUMP(,lr);													// return
       
    87 	asm("dummyend:");												// end of fn.
       
    88 	}
       
    89 
       
    90 __NAKED__ TUint DEventTracker::DummyHandlerSize()
       
    91 //
       
    92 // Size of debugger breakpoint-able callback.
       
    93 //
       
    94 	{
       
    95 	asm("ldr r0, = dummyend - dummystart");
       
    96 	__JUMP(,lr);
       
    97 	}