source: rtems/cpukit/score/cpu/arm/arm_exc_abort.S @ 010c09a

4.115
Last change on this file since 010c09a was 010c09a, checked in by Sebastian Huber <sebastian.huber@…>, on 01/04/13 at 12:20:37

arm: Rename type and functions

Rename arm_exc_abort_handler to ARMV4_Exception_abort_handler,
arm_exc_data_abort() to _ARMV4_Exception_data_abort(),
arm_exc_data_abort_set_handler() to
_ARMV4_Exception_data_abort_set_handler(),
arm_exc_prefetch_abort() to _ARMV4_Exception_prefetch_abort(), and
arm_exc_prefetch_abort_set_handler() to
_ARMV4_Exception_prefetch_abort_set_handler(),

  • Property mode set to 100644
File size: 2.2 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 _ARMV4_Exception_data_abort_set_handler
34.globl _ARMV4_Exception_data_abort
35
36.globl _ARMV4_Exception_prefetch_abort_set_handler
37.globl _ARMV4_Exception_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
53_ARMV4_Exception_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
66_ARMV4_Exception_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
77_ARMV4_Exception_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
86_ARMV4_Exception_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.