source: rtems/cpukit/score/cpu/arm/arm_exc_abort.S @ 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: 2.0 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.extern rtems_fatal_error_occurred
30
31.globl arm_exc_data_abort_set_handler
32.globl arm_exc_data_abort
33
34.globl arm_exc_prefetch_abort_set_handler
35.globl arm_exc_prefetch_abort
36
37.section ".bss"
38
39data_abort_handler:
40.long 0
41
42prefetch_abort_handler:
43.long 0
44
45.section ".text"
46
47#ifdef __thumb__
48        .thumb_func
49#endif
50
51arm_exc_data_abort_set_handler:
52        ldr     r1, =data_abort_handler
53        str     r0, [r1]
54        bx      lr
55
56#ifdef __thumb__
57        .thumb_func
58#endif
59
60arm_exc_prefetch_abort_set_handler:
61        ldr     r1, =prefetch_abort_handler
62        str     r0, [r1]
63        bx      lr
64
65.arm
66
67arm_exc_prefetch_abort:
68
69        /* Save context and load handler */
70        sub     sp, #16
71        stmdb   sp!, {r0-r12}
72        ldr     r6, =prefetch_abort_handler
73
74        b       save_more_context
75
76arm_exc_data_abort:
77
78        /* Save context and load handler */
79        sub     sp, #16
80        stmdb   sp!, {r0-r12}
81        ldr     r6, =data_abort_handler
82
83save_more_context:
84
85        /* Save more context */
86        mov     r2, lr
87        mrs     r3, spsr
88        mrs     r4, cpsr
89        orr     r5, r3, #ARM_PSR_I
90        bic     r5, #ARM_PSR_T
91        msr     cpsr, r5
92        mov     r0, sp
93        mov     r1, lr
94        msr     cpsr, r4
95        add     r5, sp, #68
96        stmdb   r5!, {r0-r3}
97
98        /* Call high level handler */
99        ldr     r2, [r6]
100        cmp     r2, #0
101        ldreq   r2, =rtems_fatal_error_occurred
102        movne   r0, sp
103        moveq   r0, #0xaa
104#ifndef __thumb__
105        mov     lr, pc
106        bx      r2
107#else /* __thumb__ */
108        SWITCH_FROM_ARM_TO_THUMB        r1
109        bl      call_handler
110        SWITCH_FROM_THUMB_TO_ARM
111#endif /* __thumb__ */
112
113        /* Restore context */
114        ldmia   r5!, {r0-r3}
115        mov     lr, r2
116        msr     spsr, r3
117        ldmia   sp!, {r0-r12}
118        add     sp, #16
119
120        /* Return from interrupt */
121        subs    pc, lr, #8
122
123#ifdef __thumb__
124.thumb
125call_handler:
126        bx      r2
127#endif /* __thumb__ */
Note: See TracBrowser for help on using the repository browser.