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