source: rtems/cpukit/score/cpu/arm/arm_exc_abort.S @ 2d7ae960

4.115
Last change on this file since 2d7ae960 was c5ed148, checked in by Sebastian Huber <sebastian.huber@…>, on 09/24/11 at 12:56:51

2011-09-24 Sebastian Huber <sebastian.huber@…>

  • rtems/score/armv7m.h, armv7m-context-initialize.c, armv7m-context-restore.c, armv7m-context-switch.c, armv7m-exception-handler-get.c, armv7m-exception-handler-set.c, armv7m-exception-priority-get.c, armv7m-exception-priority-set.c, armv7m-initialize.c, armv7m-isr-dispatch.c, armv7m-isr-enter-leave.c, armv7m-isr-level-get.c, armv7m-isr-level-set.c, armv7m-isr-vector-install.c, armv7m-multitasking-start-stop.c: New files.
  • Makefile.am, preinstall.am: Reflect changes above.
  • rtems/score/arm.h: Define ARM_MULTILIB_ARCH_V4 and ARM_MULTILIB_ARCH_V7M.
  • rtems/score/cpu.h, cpu_asm.S, cpu.c, arm_exc_abort.S, arm_exc_handler_high.c, arm_exc_handler_low.S, arm_exc_interrupt.S: Define CPU_HAS_HARDWARE_INTERRUPT_STACK to FALSE. Use ARM_MULTILIB_ARCH_V4 and ARM_MULTILIB_ARCH_V7M.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreCPU
5 *
6 * @brief ARM data and prefetch abort exception prologue and epilogue.
7 */
8
9/*
10 * Copyright (c) 2009
11 * embedded brains GmbH
12 * Obere Lagerstr. 30
13 * D-82178 Puchheim
14 * Germany
15 * <rtems@embedded-brains.de>
16 *
17 * The license and distribution terms for this file may be
18 * found in the file LICENSE in this distribution or at
19 * http://www.rtems.com/license/LICENSE.
20 */
21
22#ifdef HAVE_CONFIG_H
23#include "config.h"
24#endif
25
26#include <rtems/asm.h>
27#include <rtems/system.h>
28
29#ifdef ARM_MULTILIB_ARCH_V4
30
31.extern rtems_fatal_error_occurred
32
33.globl arm_exc_data_abort_set_handler
34.globl arm_exc_data_abort
35
36.globl arm_exc_prefetch_abort_set_handler
37.globl arm_exc_prefetch_abort
38
39.section ".bss"
40
41data_abort_handler:
42.long 0
43
44prefetch_abort_handler:
45.long 0
46
47.section ".text"
48
49#ifdef __thumb__
50        .thumb_func
51#endif
52
53arm_exc_data_abort_set_handler:
54        ldr     r1, =data_abort_handler
55        str     r0, [r1]
56#ifdef __thumb__
57        bx      lr
58#else
59        mov     pc, lr
60#endif
61
62#ifdef __thumb__
63        .thumb_func
64#endif
65
66arm_exc_prefetch_abort_set_handler:
67        ldr     r1, =prefetch_abort_handler
68        str     r0, [r1]
69#ifdef __thumb__
70        bx      lr
71#else
72        mov     pc, lr
73#endif
74
75.arm
76
77arm_exc_prefetch_abort:
78
79        /* Save context and load handler */
80        sub     sp, #16
81        stmdb   sp!, {r0-r12}
82        ldr     r6, =prefetch_abort_handler
83
84        b       save_more_context
85
86arm_exc_data_abort:
87
88        /* Save context and load handler */
89        sub     sp, #16
90        stmdb   sp!, {r0-r12}
91        ldr     r6, =data_abort_handler
92
93save_more_context:
94
95        /* Save more context */
96        mov     r2, lr
97        mrs     r3, spsr
98        mrs     r4, cpsr
99        orr     r5, r3, #ARM_PSR_I
100        bic     r5, #ARM_PSR_T
101        msr     cpsr, r5
102        mov     r0, sp
103        mov     r1, lr
104        msr     cpsr, r4
105        add     r5, sp, #68
106        stmdb   r5!, {r0-r3}
107
108        /* Call high level handler */
109        ldr     r2, [r6]
110        cmp     r2, #0
111        ldreq   r2, =rtems_fatal_error_occurred
112        movne   r0, sp
113        moveq   r0, #0xaa
114#ifndef __thumb__
115        mov     lr, pc
116        mov     pc, r2
117#else /* __thumb__ */
118        SWITCH_FROM_ARM_TO_THUMB        r1
119        bl      call_handler
120        SWITCH_FROM_THUMB_TO_ARM
121#endif /* __thumb__ */
122
123        /* Restore context */
124        ldmia   r5!, {r0-r3}
125        mov     lr, r2
126        msr     spsr, r3
127        ldmia   sp!, {r0-r12}
128        add     sp, #16
129
130        /* Return from interrupt */
131        subs    pc, lr, #8
132
133#ifdef __thumb__
134.thumb
135call_handler:
136        bx      r2
137#endif /* __thumb__ */
138
139#endif /* ARM_MULTILIB_ARCH_V4 */
Note: See TracBrowser for help on using the repository browser.