[e57b0e2] | 1 | /* vectors.s 1.1 - 95/12/04 |
---|
[3235ad9] | 2 | * |
---|
| 3 | * This file contains the assembly code for the PowerPC 403 |
---|
| 4 | * interrupt veneers for RTEMS. |
---|
| 5 | * |
---|
[e57b0e2] | 6 | * Author: Andrew Bray <andy@i-cubed.co.uk> |
---|
[3235ad9] | 7 | * |
---|
| 8 | * COPYRIGHT (c) 1995 by i-cubed ltd. |
---|
| 9 | * |
---|
| 10 | * To anyone who acknowledges that this file is provided "AS IS" |
---|
| 11 | * without any express or implied warranty: |
---|
| 12 | * permission to use, copy, modify, and distribute this file |
---|
| 13 | * for any purpose is hereby granted without fee, provided that |
---|
| 14 | * the above copyright notice and this notice appears in all |
---|
| 15 | * copies, and that the name of i-cubed limited not be used in |
---|
| 16 | * advertising or publicity pertaining to distribution of the |
---|
| 17 | * software without specific, written prior permission. |
---|
| 18 | * i-cubed limited makes no representations about the suitability |
---|
| 19 | * of this software for any purpose. |
---|
| 20 | * |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | /* |
---|
| 24 | * The issue with this file is getting it loaded at the right place. |
---|
| 25 | * The first vector MUST be at address 0x????0100. |
---|
| 26 | * How this is achieved is dependant on the tool chain. |
---|
| 27 | * |
---|
| 28 | * However the basic mechanism for ELF assemblers is to create a |
---|
| 29 | * section called ".vectors", which will be loaded to an address |
---|
| 30 | * between 0x????0000 and 0x????0100 (inclusive) via a link script. |
---|
| 31 | * |
---|
| 32 | * The basic mechanism for XCOFF assemblers is to place it in the |
---|
| 33 | * normal text section, and arrange for this file to be located |
---|
| 34 | * at an appropriate position on the linker command line. |
---|
| 35 | * |
---|
| 36 | * The variable 'PPC_VECTOR_FILE_BASE' must be defined to be the |
---|
| 37 | * offset from 0x????0000 to the first location in the file. This |
---|
| 38 | * will usually be 0x0000 or 0x0100. |
---|
[e57b0e2] | 39 | * |
---|
| 40 | * $Id$ |
---|
[3235ad9] | 41 | */ |
---|
| 42 | |
---|
| 43 | #include "asm.h" |
---|
| 44 | |
---|
| 45 | #ifndef PPC_VECTOR_FILE_BASE |
---|
| 46 | #error "PPC_VECTOR_FILE_BASE is not defined." |
---|
| 47 | #endif |
---|
| 48 | |
---|
| 49 | /* Where this file will be loaded */ |
---|
| 50 | .set file_base, PPC_VECTOR_FILE_BASE |
---|
| 51 | |
---|
| 52 | /* Offset to store reg 0 */ |
---|
| 53 | |
---|
| 54 | .set IP_LINK, 0 |
---|
| 55 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 56 | .set IP_0, (IP_LINK + 56) |
---|
| 57 | #else |
---|
| 58 | .set IP_0, (IP_LINK + 8) |
---|
| 59 | #endif |
---|
| 60 | .set IP_2, (IP_0 + 4) |
---|
| 61 | |
---|
| 62 | .set IP_3, (IP_2 + 4) |
---|
| 63 | .set IP_4, (IP_3 + 4) |
---|
| 64 | .set IP_5, (IP_4 + 4) |
---|
| 65 | .set IP_6, (IP_5 + 4) |
---|
| 66 | |
---|
| 67 | .set IP_7, (IP_6 + 4) |
---|
| 68 | .set IP_8, (IP_7 + 4) |
---|
| 69 | .set IP_9, (IP_8 + 4) |
---|
| 70 | .set IP_10, (IP_9 + 4) |
---|
| 71 | |
---|
| 72 | .set IP_11, (IP_10 + 4) |
---|
| 73 | .set IP_12, (IP_11 + 4) |
---|
| 74 | .set IP_13, (IP_12 + 4) |
---|
| 75 | .set IP_28, (IP_13 + 4) |
---|
| 76 | |
---|
| 77 | .set IP_29, (IP_28 + 4) |
---|
| 78 | .set IP_30, (IP_29 + 4) |
---|
| 79 | .set IP_31, (IP_30 + 4) |
---|
| 80 | .set IP_CR, (IP_31 + 4) |
---|
| 81 | |
---|
| 82 | .set IP_CTR, (IP_CR + 4) |
---|
| 83 | .set IP_XER, (IP_CTR + 4) |
---|
| 84 | .set IP_LR, (IP_XER + 4) |
---|
| 85 | .set IP_PC, (IP_LR + 4) |
---|
| 86 | |
---|
| 87 | .set IP_MSR, (IP_PC + 4) |
---|
| 88 | |
---|
| 89 | .set IP_END, (IP_MSR + 16) |
---|
| 90 | |
---|
| 91 | /* Vector offsets */ |
---|
| 92 | .set begin_vector,0x0000 |
---|
| 93 | .set crit_vector,0x0100 |
---|
| 94 | .set mach_vector,0x0200 |
---|
| 95 | .set prot_vector,0x0300 |
---|
| 96 | .set ext_vector,0x0500 |
---|
| 97 | .set align_vector,0x0600 |
---|
| 98 | .set prog_vector,0x0700 |
---|
[1a3e4fa] | 99 | .set dec_vector,0x0900 |
---|
[3235ad9] | 100 | .set sys_vector,0x0C00 |
---|
| 101 | .set pit_vector,0x1000 |
---|
| 102 | .set fit_vector,0x1010 |
---|
| 103 | .set wadt_vector,0x1020 |
---|
| 104 | .set debug_vector,0x2000 |
---|
| 105 | |
---|
| 106 | /* Go to the right section */ |
---|
| 107 | #if PPC_ASM == PPC_ASM_ELF |
---|
| 108 | .section .vectors,"awx",@progbits |
---|
| 109 | #elif PPC_ASM == PPC_ASM_XCOFF |
---|
| 110 | .csect .text[PR] |
---|
| 111 | #endif |
---|
| 112 | |
---|
| 113 | PUBLIC_VAR (__vectors) |
---|
| 114 | SYM (__vectors): |
---|
| 115 | |
---|
| 116 | /* Critical error handling */ |
---|
| 117 | .org crit_vector - file_base |
---|
| 118 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 119 | #if (PPC_HAS_FPU) |
---|
| 120 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 121 | #else |
---|
| 122 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 123 | #endif |
---|
| 124 | #else |
---|
| 125 | stwu r1, -(IP_END)(r1) |
---|
| 126 | #endif |
---|
| 127 | stw r0, IP_0(r1) |
---|
| 128 | |
---|
| 129 | li r0, PPC_IRQ_CRIT |
---|
| 130 | b PROC (_ISR_HandlerC) |
---|
| 131 | |
---|
| 132 | /* Machine check exception */ |
---|
| 133 | .org mach_vector - file_base |
---|
| 134 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 135 | #if (PPC_HAS_FPU) |
---|
| 136 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 137 | #else |
---|
| 138 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 139 | #endif |
---|
| 140 | #else |
---|
| 141 | stwu r1, -(IP_END)(r1) |
---|
| 142 | #endif |
---|
| 143 | stw r0, IP_0(r1) |
---|
| 144 | |
---|
| 145 | li r0, PPC_IRQ_MCHECK |
---|
| 146 | b PROC (_ISR_HandlerC) |
---|
| 147 | |
---|
| 148 | /* Protection exception */ |
---|
| 149 | .org prot_vector - file_base |
---|
| 150 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 151 | #if (PPC_HAS_FPU) |
---|
| 152 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 153 | #else |
---|
| 154 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 155 | #endif |
---|
| 156 | #else |
---|
| 157 | stwu r1, -(IP_END)(r1) |
---|
| 158 | #endif |
---|
| 159 | stw r0, IP_0(r1) |
---|
| 160 | |
---|
| 161 | li r0, PPC_IRQ_PROTECT |
---|
| 162 | b PROC (_ISR_Handler) |
---|
| 163 | |
---|
| 164 | /* External interrupt */ |
---|
| 165 | .org ext_vector - file_base |
---|
| 166 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 167 | #if (PPC_HAS_FPU) |
---|
| 168 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 169 | #else |
---|
| 170 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 171 | #endif |
---|
| 172 | #else |
---|
| 173 | stwu r1, -(IP_END)(r1) |
---|
| 174 | #endif |
---|
| 175 | stw r0, IP_0(r1) |
---|
| 176 | |
---|
| 177 | li r0, PPC_IRQ_EXTERNAL |
---|
| 178 | b PROC (_ISR_Handler) |
---|
| 179 | |
---|
| 180 | /* Align exception */ |
---|
| 181 | .org align_vector - file_base |
---|
| 182 | .extern align_h |
---|
| 183 | b align_h |
---|
| 184 | |
---|
| 185 | /* Program exception */ |
---|
| 186 | .org prog_vector - file_base |
---|
| 187 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 188 | #if (PPC_HAS_FPU) |
---|
| 189 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 190 | #else |
---|
| 191 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 192 | #endif |
---|
| 193 | #else |
---|
| 194 | stwu r1, -(IP_END)(r1) |
---|
| 195 | #endif |
---|
| 196 | stw r0, IP_0(r1) |
---|
| 197 | |
---|
| 198 | li r0, PPC_IRQ_PROGRAM |
---|
| 199 | b PROC (_ISR_Handler) |
---|
| 200 | |
---|
[1a3e4fa] | 201 | /* Decrementer exception */ |
---|
| 202 | .org dec_vector - file_base |
---|
| 203 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 204 | #if (PPC_HAS_FPU) |
---|
| 205 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 206 | #else |
---|
| 207 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 208 | #endif |
---|
| 209 | #else |
---|
| 210 | stwu r1, -(IP_END)(r1) |
---|
| 211 | #endif |
---|
| 212 | stw r0, IP_0(r1) |
---|
| 213 | |
---|
| 214 | li r0, PPC_IRQ_PROGRAM |
---|
| 215 | b PROC (_ISR_Handler) |
---|
| 216 | |
---|
[3235ad9] | 217 | /* System call */ |
---|
| 218 | .org sys_vector - file_base |
---|
| 219 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 220 | #if (PPC_HAS_FPU) |
---|
| 221 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 222 | #else |
---|
| 223 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 224 | #endif |
---|
| 225 | #else |
---|
| 226 | stwu r1, -(IP_END)(r1) |
---|
| 227 | #endif |
---|
| 228 | stw r0, IP_0(r1) |
---|
| 229 | |
---|
| 230 | li r0, PPC_IRQ_SCALL |
---|
| 231 | b PROC (_ISR_Handler) |
---|
| 232 | |
---|
| 233 | /* PIT interrupt */ |
---|
| 234 | .org pit_vector - file_base |
---|
| 235 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 236 | #if (PPC_HAS_FPU) |
---|
| 237 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 238 | #else |
---|
| 239 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 240 | #endif |
---|
| 241 | #else |
---|
| 242 | stwu r1, -(IP_END)(r1) |
---|
| 243 | #endif |
---|
| 244 | stw r0, IP_0(r1) |
---|
| 245 | |
---|
| 246 | li r0, PPC_IRQ_PIT |
---|
| 247 | b PROC (_ISR_Handler) |
---|
[e57b0e2] | 248 | |
---|
[3235ad9] | 249 | /* FIT interrupt */ |
---|
[e57b0e2] | 250 | .org fit_vector - file_base |
---|
[3235ad9] | 251 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 252 | #if (PPC_HAS_FPU) |
---|
| 253 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 254 | #else |
---|
| 255 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 256 | #endif |
---|
| 257 | #else |
---|
| 258 | stwu r1, -(IP_END)(r1) |
---|
| 259 | #endif |
---|
| 260 | stw r0, IP_0(r1) |
---|
| 261 | |
---|
| 262 | li r0, PPC_IRQ_FIT |
---|
| 263 | b PROC (_ISR_Handler) |
---|
[e57b0e2] | 264 | |
---|
[3235ad9] | 265 | /* Watchdog interrupt */ |
---|
[e57b0e2] | 266 | .org wadt_vector - file_base |
---|
[3235ad9] | 267 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 268 | #if (PPC_HAS_FPU) |
---|
| 269 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 270 | #else |
---|
| 271 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 272 | #endif |
---|
| 273 | #else |
---|
| 274 | stwu r1, -(IP_END)(r1) |
---|
| 275 | #endif |
---|
| 276 | stw r0, IP_0(r1) |
---|
| 277 | |
---|
| 278 | li r0, PPC_IRQ_WATCHDOG |
---|
| 279 | b PROC (_ISR_HandlerC) |
---|
| 280 | |
---|
| 281 | /* Debug exception */ |
---|
| 282 | debug: |
---|
| 283 | #if (PPC_ABI == PPC_ABI_POWEROPEN || PPC_ABI == PPC_ABI_GCC27) |
---|
| 284 | #if (PPC_HAS_FPU) |
---|
| 285 | stwu r1, -(20*4 + 18*8 + IP_END)(r1) |
---|
| 286 | #else |
---|
| 287 | stwu r1, -(20*4 + IP_END)(r1) |
---|
| 288 | #endif |
---|
| 289 | #else |
---|
| 290 | stwu r1, -(IP_END)(r1) |
---|
| 291 | #endif |
---|
| 292 | stw r0, IP_0(r1) |
---|
| 293 | |
---|
| 294 | li r0, PPC_IRQ_DEBUG |
---|
| 295 | b PROC (_ISR_HandlerC) |
---|
| 296 | |
---|
| 297 | /* Debug exception */ |
---|
| 298 | .org debug_vector - file_base |
---|
| 299 | b debug |
---|