kernel/eka/nkernsmp/arm/ncmonitor.cia
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2008-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\nkernsmp\arm\ncmonitor.cia
       
    15 // Kernel crash debugger - NKERNSMP ARM specific portion
       
    16 // 
       
    17 //
       
    18 
       
    19 #include <e32cia.h>
       
    20 #include <kernel/monitor.h>
       
    21 #include "nk_priv.h"
       
    22 #include <arm.h>
       
    23 
       
    24 EXPORT_C __NAKED__ void Monitor::HandleException()
       
    25 //
       
    26 // Handle an exception while the monitor is running
       
    27 //
       
    28 	{
       
    29 	asm("mov	r3, r1 ");					// exception type
       
    30 	asm("ldr	r0, [sp, #24] ");			// code address
       
    31 	asm("cmp	r1, #%a0 " : : "i" ((TInt)EArmExceptionPrefetchAbort));
       
    32 	asm("mrceq	p15, 0, r2, c5, c0, 1 ");	// r2=instruction fault status
       
    33 	asm("mrcne	p15, 0, r2, c5, c0, 0 ");	// r2=data fault status
       
    34 #ifdef __CPU_ARM_HAS_CP15_IFAR
       
    35 	asm("mrceq	p15, 0, r1, c6, c0, 2 ");	// r1= IFAR fault address
       
    36 #else
       
    37 	asm("moveq	r1, r0 ");					// if no IFAR, must be equal to code address
       
    38 #endif
       
    39 	asm("mrcne	p15, 0, r1, c6, c0, 0 ");	// r1= DFAR fault address
       
    40 	asm("add	sp, sp, #28 ");				// restore mode_abt/mode_und stack balance
       
    41 	__ASM_CLI_MODE(MODE_FIQ);				// back into mode_fiq
       
    42 	asm("ldr	r12, __TheMonitorPtr ");
       
    43 	asm("ldr	r12, [r12] ");
       
    44 	asm("add	r12, r12, #%a0" : : "i" _FOFF(Monitor,iExceptionInfo));
       
    45 	asm("stmia	r12, {r0-r3} ");			// store exc info
       
    46 	asm("mov	r0, #%a0" : : "i" ((TInt)KErrAbort));
       
    47 	asm("b "	CSM_ZN7Monitor5LeaveEi );
       
    48 
       
    49 	asm("__TheMonitorPtr: ");
       
    50 	asm(".word	TheMonitorPtr ");
       
    51 	}
       
    52