source: rtems/cpukit/score/cpu/arm/arm_exc_handler_high.c @ 78623bce

4.104.11
Last change on this file since 78623bce was 78623bce, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on Apr 8, 2010 at 10:13:46 AM

add/adapt documentation

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