source: rtems/cpukit/score/cpu/arm/arm_exc_handler_high.c @ 4f5d1c9f

4.104.115
Last change on this file since 4f5d1c9f was 5bb38e15, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/04/09 at 05:25:30

Whitespace removal.

  • 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#include <rtems/system.h>
26#include <rtems.h>
27#include <rtems/bspIo.h>
28#include <rtems/score/isr.h>
29#include <rtems/score/wkspace.h>
30#include <rtems/score/thread.h>
31#include <rtems/score/cpu.h>
32
33static void _defaultExcHandler (CPU_Exception_frame *ctx)
34{
35    printk("\n\r");
36    printk("----------------------------------------------------------\n\r");
37#if 1
38    printk("Exception 0x%x caught at PC 0x%x by thread %d\n",
39           ctx->register_ip, ctx->register_lr - 4,
40           _Thread_Executing->Object.id);
41#endif
42    printk("----------------------------------------------------------\n\r");
43    printk("Processor execution context at time of the fault was  :\n\r");
44    printk("----------------------------------------------------------\n\r");
45#if 0
46    printk(" r0  = %8x  r1  = %8x  r2  = %8x  r3  = %8x\n\r",
47           ctx->register_r0, ctx->register_r1,
48           ctx->register_r2, ctx->register_r3);
49    printk(" r4  = %8x  r5  = %8x  r6  = %8x  r7  = %8x\n\r",
50           ctx->register_r4, ctx->register_r5,
51           ctx->register_r6, ctx->register_r7);
52    printk(" r8  = %8x  r9  = %8x  r10 = %8x\n\r",
53           ctx->register_r8, ctx->register_r9, ctx->register_r10);
54    printk(" fp  = %8x  ip  = %8x  sp  = %8x  pc  = %8x\n\r",
55           ctx->register_fp, ctx->register_ip,
56           ctx->register_sp, ctx->register_lr - 4);
57    printk("----------------------------------------------------------\n\r");
58#endif
59    if (_ISR_Nest_level > 0) {
60        /*
61         * In this case we shall not delete the task interrupted as
62         * it has nothing to do with the fault. We cannot return either
63         * because the eip points to the faulty instruction so...
64         */
65        printk("Exception while executing ISR!!!. System locked\n\r");
66        while(1);
67    }
68    else {
69        printk("*********** FAULTY THREAD WILL BE DELETED **************\n\r");
70        rtems_task_delete(_Thread_Executing->Object.id);
71    }
72}
73
74typedef void (*cpuExcHandlerType) (CPU_Exception_frame*);
75
76cpuExcHandlerType _currentExcHandler = _defaultExcHandler;
77
78extern void _Exception_Handler_Undef_Swi(void);
79extern void _Exception_Handler_Abort(void);
80extern void _exc_data_abort(void);
81
82
83
84/* FIXME: put comments here */
85void rtems_exception_init_mngt(void)
86{
87        ISR_Level level;
88
89      _CPU_ISR_Disable(level);
90      _CPU_ISR_install_vector(ARM_EXCEPTION_UNDEF,
91                              _Exception_Handler_Undef_Swi,
92                              NULL);
93
94      _CPU_ISR_install_vector(ARM_EXCEPTION_SWI,
95                              _Exception_Handler_Undef_Swi,
96                              NULL);
97
98      _CPU_ISR_install_vector(ARM_EXCEPTION_PREF_ABORT,
99                              _Exception_Handler_Abort,
100                              NULL);
101
102      _CPU_ISR_install_vector(ARM_EXCEPTION_DATA_ABORT,
103                              _exc_data_abort,
104                              NULL);
105
106      _CPU_ISR_install_vector(ARM_EXCEPTION_FIQ,
107                              _Exception_Handler_Abort,
108                              NULL);
109
110      _CPU_ISR_install_vector(ARM_EXCEPTION_IRQ,
111                              _Exception_Handler_Abort,
112                              NULL);
113
114      _CPU_ISR_Enable(level);
115}
Note: See TracBrowser for help on using the repository browser.