sl@0: // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\nkern\arm\ncmonitor.cia sl@0: // Kernel crash debugger - NKERN ARM specific portion sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "nk_priv.h" sl@0: #include sl@0: sl@0: #ifdef __CPU_HAS_MMU sl@0: #define __USE_CP15_FAULT_INFO__ sl@0: #endif sl@0: sl@0: EXPORT_C __NAKED__ void Monitor::HandleException() sl@0: // sl@0: // Handle an exception while the monitor is running sl@0: // sl@0: { sl@0: asm("mov r3, r1 "); // exception type sl@0: asm("ldr r0, [sp, #24] "); // code address sl@0: #ifdef __USE_CP15_FAULT_INFO__ sl@0: #ifdef __CPU_ARM_HAS_SPLIT_FSR sl@0: asm("cmp r1, #%a0 " : : "i" ((TInt)EArmExceptionPrefetchAbort)); sl@0: asm("mrceq p15, 0, r2, c5, c0, 1"); // r2=instruction fault status sl@0: asm("mrcne p15, 0, r2, c5, c0, 0"); // r2=data fault status sl@0: #ifdef __CPU_ARM_HAS_CP15_IFAR sl@0: asm("mrceq p15, 0, r1, c6, c0, 2"); // r1= IFAR fault address sl@0: asm("mrcne p15, 0, r1, c6, c0, 0"); // r1= DFAR fault address sl@0: #else sl@0: asm("mrc p15, 0, r1, c6, c0"); // r1= FAR fault address sl@0: #endif // __CPU_ARM_HAS_CP15_IFAR sl@0: #else sl@0: asm("mrc p15, 0, r1, c6, c0"); // r1=fault address sl@0: asm("mrc p15, 0, r2, c5, c0"); // r2=fault status sl@0: #endif // __CPU_ARM_HAS_SPLIT_FSR sl@0: #endif // __USE_CP15_FAULT_INFO__ sl@0: asm("add sp, sp, #28 "); // restore mode_abt/mode_und stack balance sl@0: asm("mov r12, #0xd1 "); // back into mode_fiq sl@0: asm("msr cpsr, r12 "); sl@0: asm("ldr r12, __TheMonitorPtr "); sl@0: asm("ldr r12, [r12] "); sl@0: asm("add r12, r12, #%a0" : : "i" _FOFF(Monitor,iExceptionInfo)); sl@0: asm("stmia r12, {r0-r3} "); // store exc info sl@0: asm("mov r0, #%a0" : : "i" ((TInt)KErrAbort)); sl@0: asm("b " CSM_ZN7Monitor5LeaveEi ); sl@0: sl@0: asm("__TheMonitorPtr: "); sl@0: asm(".word TheMonitorPtr "); sl@0: } sl@0: