source: rtems/cpukit/score/cpu/arm/arm_exc_handler_high.c @ 0acc9af

4.104.11
Last change on this file since 0acc9af was 0acc9af, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 27, 2010 at 3:01:19 PM

2010-03-27 Joel Sherrill <joel.sherrill@…>

  • arm_exc_abort.S, arm_exc_handler_high.c, arm_exc_handler_low.S, arm_exc_interrupt.S, cpu.c, cpu_asm.S: Add include of config.h
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/**
2 * @file
3 *
4 * ARM exception support code.
5 */
6
7/*
8 *  COPYRIGHT (c) 2000 Canon Research Centre France SA.
9 *  Emmanuel Raguet, mailto:raguet@crf.canon.fr
10 *
11 *  Copyright (c) 2002 Advent Networks, Inc
12 *      Jay Monkman <jmonkman@adventnetworks.com>
13 *
14 *  Copyright (c) 2007 Ray xu <rayx.cn@gmail.com>
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.rtems.com/license/LICENSE.
19 *
20 *  Moved from file 'cpukit/score/cpu/arm/cpu.c'.
21 *
22 *  $Id$
23 */
24
25#ifdef HAVE_CONFIG_H
26#include "config.h"
27#endif
28
29#include <rtems/system.h>
30#include <rtems.h>
31#include <rtems/bspIo.h>
32#include <rtems/score/isr.h>
33#include <rtems/score/wkspace.h>
34#include <rtems/score/thread.h>
35#include <rtems/score/cpu.h>
36
37static void _defaultExcHandler (CPU_Exception_frame *ctx)
38{
39    printk("\n\r");
40    printk("----------------------------------------------------------\n\r");
41#if 1
42    printk("Exception 0x%x caught at PC 0x%x by thread %d\n",
43           ctx->register_ip, ctx->register_lr - 4,
44           _Thread_Executing->Object.id);
45#endif
46    printk("----------------------------------------------------------\n\r");
47    printk("Processor execution context at time of the fault was  :\n\r");
48    printk("----------------------------------------------------------\n\r");
49#if 0
50    printk(" r0  = %8x  r1  = %8x  r2  = %8x  r3  = %8x\n\r",
51           ctx->register_r0, ctx->register_r1,
52           ctx->register_r2, ctx->register_r3);
53    printk(" r4  = %8x  r5  = %8x  r6  = %8x  r7  = %8x\n\r",
54           ctx->register_r4, ctx->register_r5,
55           ctx->register_r6, ctx->register_r7);
56    printk(" r8  = %8x  r9  = %8x  r10 = %8x\n\r",
57           ctx->register_r8, ctx->register_r9, ctx->register_r10);
58    printk(" fp  = %8x  ip  = %8x  sp  = %8x  pc  = %8x\n\r",
59           ctx->register_fp, ctx->register_ip,
60           ctx->register_sp, ctx->register_lr - 4);
61    printk("----------------------------------------------------------\n\r");
62#endif
63    if (_ISR_Nest_level > 0) {
64        /*
65         * In this case we shall not delete the task interrupted as
66         * it has nothing to do with the fault. We cannot return either
67         * because the eip points to the faulty instruction so...
68         */
69        printk("Exception while executing ISR!!!. System locked\n\r");
70        while(1);
71    }
72    else {
73        printk("*********** FAULTY THREAD WILL BE DELETED **************\n\r");
74        rtems_task_delete(_Thread_Executing->Object.id);
75    }
76}
77
78typedef void (*cpuExcHandlerType) (CPU_Exception_frame*);
79
80cpuExcHandlerType _currentExcHandler = _defaultExcHandler;
81
82extern void _Exception_Handler_Undef_Swi(void);
83extern void _Exception_Handler_Abort(void);
84extern void _exc_data_abort(void);
85
86
87
88/* FIXME: put comments here */
89void rtems_exception_init_mngt(void)
90{
91        ISR_Level level;
92
93      _CPU_ISR_Disable(level);
94      _CPU_ISR_install_vector(ARM_EXCEPTION_UNDEF,
95                              _Exception_Handler_Undef_Swi,
96                              NULL);
97
98      _CPU_ISR_install_vector(ARM_EXCEPTION_SWI,
99                              _Exception_Handler_Undef_Swi,
100                              NULL);
101
102      _CPU_ISR_install_vector(ARM_EXCEPTION_PREF_ABORT,
103                              _Exception_Handler_Abort,
104                              NULL);
105
106      _CPU_ISR_install_vector(ARM_EXCEPTION_DATA_ABORT,
107                              _exc_data_abort,
108                              NULL);
109
110      _CPU_ISR_install_vector(ARM_EXCEPTION_FIQ,
111                              _Exception_Handler_Abort,
112                              NULL);
113
114      _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ,
115                              _Exception_Handler_Abort,
116                              NULL);
117
118      _CPU_ISR_Enable(level);
119}
Note: See TracBrowser for help on using the repository browser.