| @@ -1,124 +1,128 @@ | | | @@ -1,124 +1,128 @@ |
1 | /* $NetBSD: vectors.S,v 1.5 2013/06/12 07:17:23 matt Exp $ */ | | 1 | /* $NetBSD: vectors.S,v 1.6 2013/06/12 15:10:13 matt Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 1994-1997 Mark Brinicombe | | 4 | * Copyright (C) 1994-1997 Mark Brinicombe |
5 | * Copyright (C) 1994 Brini | | 5 | * Copyright (C) 1994 Brini |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
15 | * documentation and/or other materials provided with the distribution. | | 15 | * documentation and/or other materials provided with the distribution. |
16 | * 3. All advertising materials mentioning features or use of this software | | 16 | * 3. All advertising materials mentioning features or use of this software |
17 | * must display the following acknowledgement: | | 17 | * must display the following acknowledgement: |
18 | * This product includes software developed by Brini. | | 18 | * This product includes software developed by Brini. |
19 | * 4. The name of Brini may not be used to endorse or promote products | | 19 | * 4. The name of Brini may not be used to endorse or promote products |
20 | * derived from this software without specific prior written permission. | | 20 | * derived from this software without specific prior written permission. |
21 | * | | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR | | 22 | * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR |
23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
25 | * IN NO EVENT SHALL BRINI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | | 25 | * IN NO EVENT SHALL BRINI BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | | 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | | 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | | 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include "assym.h" | | 34 | #include "assym.h" |
35 | #include "opt_cputypes.h" | | 35 | #include "opt_cputypes.h" |
36 | #include <machine/asm.h> | | 36 | #include <machine/asm.h> |
37 | | | 37 | |
38 | /* | | 38 | /* |
39 | * These are the exception vectors copied down to page 0. | | 39 | * These are the exception vectors copied down to page 0. |
40 | * | | 40 | * |
41 | * Note that FIQs are special; rather than using a level of | | 41 | * Note that FIQs are special; rather than using a level of |
42 | * indirection, we actually copy the FIQ code down into the | | 42 | * indirection, we actually copy the FIQ code down into the |
43 | * vector page. | | 43 | * vector page. |
44 | */ | | 44 | */ |
45 | | | 45 | |
46 | .text | | 46 | .text |
47 | .align 0 | | 47 | .align 0 |
48 | .global _C_LABEL(page0), _C_LABEL(page0_data), _C_LABEL(page0_end) | | 48 | .global _C_LABEL(page0), _C_LABEL(page0_data), _C_LABEL(page0_end) |
49 | .global _C_LABEL(fiqvector) | | 49 | .global _C_LABEL(fiqvector) |
50 | | | 50 | |
51 | #if defined(CPU_ARMV7) || defined(CPU_ARM11) | | 51 | #if defined(CPU_ARMV7) || defined(CPU_ARM11) |
52 | /* | | 52 | /* |
53 | * ARMv[67] processors with the Security Extension have the VBAR | | 53 | * ARMv[67] processors with the Security Extension have the VBAR |
54 | * which redirects the low vector to any 32-byte aligned address. | | 54 | * which redirects the low vector to any 32-byte aligned address. |
55 | * Since we are in kernel, we can just do a relative branch to the | | 55 | * Since we are in kernel, we can just do a relative branch to the |
56 | * exception code and avoid the intermediate load. | | 56 | * exception code and avoid the intermediate load. |
57 | */ | | 57 | */ |
58 | .global _C_LABEL(page0rel) | | 58 | .global _C_LABEL(page0rel) |
59 | .p2align 5 | | 59 | .p2align 5 |
60 | _C_LABEL(page0rel): | | 60 | _C_LABEL(page0rel): |
61 | b reset_entry | | 61 | b reset_entry |
62 | b undefined_entry | | 62 | b undefined_entry |
63 | b swi_entry | | 63 | b swi_entry |
64 | b prefetch_abort_entry | | 64 | b prefetch_abort_entry |
65 | b data_abort_entry | | 65 | b data_abort_entry |
66 | b address_exception_entry | | 66 | b address_exception_entry |
67 | b irq_entry | | 67 | b irq_entry |
| | | 68 | #ifdef __ARM_FIQ_INDIRECT |
68 | b _C_LABEL(fiqvector) | | 69 | b _C_LABEL(fiqvector) |
| | | 70 | #else |
| | | 71 | b .Lfiqvector |
| | | 72 | #endif |
69 | #endif | | 73 | #endif |
70 | | | 74 | |
71 | _C_LABEL(page0): | | 75 | _C_LABEL(page0): |
72 | ldr pc, .Lreset_target | | 76 | ldr pc, .Lreset_target |
73 | ldr pc, .Lundefined_target | | 77 | ldr pc, .Lundefined_target |
74 | ldr pc, .Lswi_target | | 78 | ldr pc, .Lswi_target |
75 | ldr pc, .Lprefetch_abort_target | | 79 | ldr pc, .Lprefetch_abort_target |
76 | ldr pc, .Ldata_abort_target | | 80 | ldr pc, .Ldata_abort_target |
77 | ldr pc, .Laddress_exception_target | | 81 | ldr pc, .Laddress_exception_target |
78 | ldr pc, .Lirq_target | | 82 | ldr pc, .Lirq_target |
79 | #ifdef __ARM_FIQ_INDIRECT | | 83 | #ifdef __ARM_FIQ_INDIRECT |
80 | ldr pc, .Lfiq_target | | 84 | ldr pc, .Lfiq_target |
81 | #else | | 85 | #else |
82 | .Lfiqvector: | | 86 | .Lfiqvector: |
83 | .set _C_LABEL(fiqvector), . - _C_LABEL(page0) | | 87 | .set _C_LABEL(fiqvector), . - _C_LABEL(page0) |
84 | subs pc, lr, #4 | | 88 | subs pc, lr, #4 |
85 | .org .Lfiqvector + 0x100 | | 89 | .org .Lfiqvector + 0x100 |
86 | #endif | | 90 | #endif |
87 | | | 91 | |
88 | _C_LABEL(page0_data): | | 92 | _C_LABEL(page0_data): |
89 | .Lreset_target: | | 93 | .Lreset_target: |
90 | .word reset_entry | | 94 | .word reset_entry |
91 | | | 95 | |
92 | .Lundefined_target: | | 96 | .Lundefined_target: |
93 | .word undefined_entry | | 97 | .word undefined_entry |
94 | | | 98 | |
95 | .Lswi_target: | | 99 | .Lswi_target: |
96 | .word swi_entry | | 100 | .word swi_entry |
97 | | | 101 | |
98 | .Lprefetch_abort_target: | | 102 | .Lprefetch_abort_target: |
99 | .word prefetch_abort_entry | | 103 | .word prefetch_abort_entry |
100 | | | 104 | |
101 | .Ldata_abort_target: | | 105 | .Ldata_abort_target: |
102 | .word data_abort_entry | | 106 | .word data_abort_entry |
103 | | | 107 | |
104 | .Laddress_exception_target: | | 108 | .Laddress_exception_target: |
105 | .word address_exception_entry | | 109 | .word address_exception_entry |
106 | | | 110 | |
107 | .Lirq_target: | | 111 | .Lirq_target: |
108 | .word irq_entry | | 112 | .word irq_entry |
109 | | | 113 | |
110 | #ifdef __ARM_FIQ_INDIRECT | | 114 | #ifdef __ARM_FIQ_INDIRECT |
111 | .Lfiq_target: | | 115 | .Lfiq_target: |
112 | .word _C_LABEL(fiqvector) | | 116 | .word _C_LABEL(fiqvector) |
113 | #else | | 117 | #else |
114 | .word 0 /* pad it out */ | | 118 | .word 0 /* pad it out */ |
115 | #endif | | 119 | #endif |
116 | _C_LABEL(page0_end): | | 120 | _C_LABEL(page0_end): |
117 | | | 121 | |
118 | #ifdef __ARM_FIQ_INDIRECT | | 122 | #ifdef __ARM_FIQ_INDIRECT |
119 | .data | | 123 | .data |
120 | .align 0 | | 124 | .align 0 |
121 | _C_LABEL(fiqvector): | | 125 | _C_LABEL(fiqvector): |
122 | subs pc, lr, #4 | | 126 | subs pc, lr, #4 |
123 | .org _C_LABEL(fiqvector) + 0x100 | | 127 | .org _C_LABEL(fiqvector) + 0x100 |
124 | #endif | | 128 | #endif |