os/kernelhwsrv/kernel/eka/nkernsmp/arm/ncmonitor.cia
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/nkernsmp/arm/ncmonitor.cia	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,52 @@
     1.4 +// Copyright (c) 2008-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\nkernsmp\arm\ncmonitor.cia
    1.18 +// Kernel crash debugger - NKERNSMP ARM specific portion
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +#include <e32cia.h>
    1.23 +#include <kernel/monitor.h>
    1.24 +#include "nk_priv.h"
    1.25 +#include <arm.h>
    1.26 +
    1.27 +EXPORT_C __NAKED__ void Monitor::HandleException()
    1.28 +//
    1.29 +// Handle an exception while the monitor is running
    1.30 +//
    1.31 +	{
    1.32 +	asm("mov	r3, r1 ");					// exception type
    1.33 +	asm("ldr	r0, [sp, #24] ");			// code address
    1.34 +	asm("cmp	r1, #%a0 " : : "i" ((TInt)EArmExceptionPrefetchAbort));
    1.35 +	asm("mrceq	p15, 0, r2, c5, c0, 1 ");	// r2=instruction fault status
    1.36 +	asm("mrcne	p15, 0, r2, c5, c0, 0 ");	// r2=data fault status
    1.37 +#ifdef __CPU_ARM_HAS_CP15_IFAR
    1.38 +	asm("mrceq	p15, 0, r1, c6, c0, 2 ");	// r1= IFAR fault address
    1.39 +#else
    1.40 +	asm("moveq	r1, r0 ");					// if no IFAR, must be equal to code address
    1.41 +#endif
    1.42 +	asm("mrcne	p15, 0, r1, c6, c0, 0 ");	// r1= DFAR fault address
    1.43 +	asm("add	sp, sp, #28 ");				// restore mode_abt/mode_und stack balance
    1.44 +	__ASM_CLI_MODE(MODE_FIQ);				// back into mode_fiq
    1.45 +	asm("ldr	r12, __TheMonitorPtr ");
    1.46 +	asm("ldr	r12, [r12] ");
    1.47 +	asm("add	r12, r12, #%a0" : : "i" _FOFF(Monitor,iExceptionInfo));
    1.48 +	asm("stmia	r12, {r0-r3} ");			// store exc info
    1.49 +	asm("mov	r0, #%a0" : : "i" ((TInt)KErrAbort));
    1.50 +	asm("b "	CSM_ZN7Monitor5LeaveEi );
    1.51 +
    1.52 +	asm("__TheMonitorPtr: ");
    1.53 +	asm(".word	TheMonitorPtr ");
    1.54 +	}
    1.55 +