Mercurial > ecos
annotate packages/hal/powerpc/arch/current/src/vectors.S @ 14:01ce82f3e11a ecos-sw-1999-06-11
Merge from eCos master repository on 1999-06-11-17:05:41-BST
| author | jlarmour |
|---|---|
| date | Fri, 11 Jun 1999 09:36:56 +0000 |
| parents | d3fbcdfa1b2f |
| children | 4f2df4ab82c8 |
| rev | line source |
|---|---|
| 2 | 1 ##========================================================================== |
| 0 | 2 ## |
| 3 ## vectors.S | |
| 4 ## | |
| 5 ## PowerPC exception vectors | |
| 6 ## | |
| 2 | 7 ##========================================================================== |
| 0 | 8 #####COPYRIGHTBEGIN#### |
| 9 # | |
| 10 # ------------------------------------------- | |
| 11 # The contents of this file are subject to the Cygnus eCos Public License | |
| 12 # Version 1.0 (the "License"); you may not use this file except in | |
| 13 # compliance with the License. You may obtain a copy of the License at | |
| 14 # http://sourceware.cygnus.com/ecos | |
| 15 # | |
| 16 # Software distributed under the License is distributed on an "AS IS" | |
| 17 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 18 # License for the specific language governing rights and limitations under | |
| 19 # the License. | |
| 20 # | |
| 21 # The Original Code is eCos - Embedded Cygnus Operating System, released | |
| 22 # September 30, 1998. | |
| 23 # | |
| 24 # The Initial Developer of the Original Code is Cygnus. Portions created | |
| 2 | 25 # by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
| 0 | 26 # ------------------------------------------- |
| 27 # | |
| 28 #####COPYRIGHTEND#### | |
| 2 | 29 ##========================================================================== |
| 0 | 30 #######DESCRIPTIONBEGIN#### |
| 31 ## | |
| 2 | 32 ## Author(s): nickg, jskov |
| 33 ## Contributors: nickg, jskov | |
| 34 ## Date: 1999-02-20 | |
| 35 ## Purpose: PowerPC exception vectors | |
| 36 ## Description: This file defines the code placed into the exception | |
| 37 ## vectors. It also contains the first level default VSRs | |
| 38 ## that save and restore state for both exceptions and | |
| 39 ## interrupts. | |
| 0 | 40 ## |
| 41 ######DESCRIPTIONEND#### | |
| 42 ## | |
| 2 | 43 ##========================================================================== |
| 0 | 44 |
| 45 #include <pkgconf/hal.h> | |
| 46 | |
| 47 #ifdef CYGPKG_KERNEL | |
| 48 #include <pkgconf/kernel.h> // CYGPKG_KERNEL_INSTRUMENT | |
| 49 #endif | |
| 2 | 50 |
| 51 #define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS | |
| 52 #include "cyg/hal/ppc_regs.h" | |
| 0 | 53 #include "cyg/hal/ppc.inc" |
| 54 | |
| 55 #define FUNC_START(name) \ | |
| 56 .type name,@function; \ | |
| 57 .globl name; \ | |
| 58 name: | |
| 59 | |
| 2 | 60 #=========================================================================== |
| 0 | 61 |
| 62 .file "vectors.S" | |
| 63 | |
| 64 .extern hal_interrupt_handlers | |
| 65 .extern hal_interrupt_data | |
| 66 .extern hal_interrupt_objects | |
| 67 | |
| 68 .extern cyg_instrument | |
| 69 | |
| 70 .extern hal_hardware_init | |
| 71 | |
| 2 | 72 #=========================================================================== |
| 0 | 73 # MSR initialization value |
| 74 # zero all bits except: | |
| 75 # FP = floating point available | |
| 76 # ME = machine check enabled | |
| 77 # IP = vectors at 0xFFFxxxxx (ROM startup only) | |
| 2 | 78 # IR = instruction address translation |
| 79 # DR = data address translation | |
| 0 | 80 # RI = recoverable interrupt |
| 81 | |
| 2 | 82 #define CYG_MSR_COMMON (MSR_FP | MSR_ME | MSR_IR | MSR_DR | MSR_RI) |
| 83 #if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_STUBS) | |
| 84 #define CYG_MSR (CYG_MSR_COMMON | MSR_IP) | |
| 0 | 85 #endif |
| 86 #ifdef CYG_HAL_STARTUP_RAM | |
| 2 | 87 #define CYG_MSR CYG_MSR_COMMON |
| 88 #endif | |
| 89 #ifdef CYG_HAL_POWERPC_SIM | |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
90 # When building for SIM, don~t enable MMU -- it~s not needed since caches |
| 2 | 91 # are disabled, and there is a runtime simulation overhead. |
| 92 #undef CYG_MSR | |
| 93 #define CYG_MSR (CYG_MSR_COMMON & ~(MSR_IR | MSR_DR)) | |
| 0 | 94 #endif |
| 95 | |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
96 |
| 2 | 97 #=========================================================================== |
| 0 | 98 # If the following option is enabled, we only save registers up to R12. |
| 99 # The PowerPC ABI defines registers 13..31 as callee saved and thus we do | |
| 100 # not need to save them when calling C functions. | |
| 101 | |
| 102 #ifdef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT | |
| 103 | |
| 2 | 104 #define MAX_SAVE_REG 12 |
| 0 | 105 |
| 106 #else | |
| 107 | |
| 108 #define MAX_SAVE_REG 31 | |
| 109 | |
| 110 #endif | |
| 111 | |
| 2 | 112 #=========================================================================== |
| 0 | 113 # Start by defining the exceptions vectors that must be placed at |
| 114 # locations 0xFFF00000 and 0x00000000. The following code will normally | |
| 115 # be located at 0xFFF00000 in the ROM. It may optionally be copied out | |
| 116 # to 0x00000000 if we want to use the RAM vectors. For this reason this code | |
| 117 # MUST BE POSITION INDEPENDENT. In RAM loaded configurations, this code may | |
| 118 # be placed at 0x00000000 during loading. | |
| 119 | |
| 120 .section ".vectors","ax" | |
| 121 | |
| 2 | 122 #--------------------------------------------------------------------------- |
| 0 | 123 # Unused first vector. |
| 124 | |
| 125 rom_vectors: | |
| 126 lwi r3,_start | |
| 127 mtlr r3 | |
| 128 blr | |
| 129 | |
| 130 .byte 0x11 | |
| 131 .byte 0x22 | |
| 132 .byte 0x33 | |
| 133 .byte 0x44 | |
| 134 | |
| 2 | 135 #--------------------------------------------------------------------------- |
| 0 | 136 # Reset vector. |
| 137 | |
| 138 .p2align 8 | |
| 139 .globl reset_vector | |
| 140 | |
| 141 reset_vector: | |
| 142 lwi r3,_start | |
| 143 mtlr r3 | |
| 144 blr | |
| 145 | |
| 2 | 146 #--------------------------------------------------------------------------- |
| 0 | 147 # Macro for generating an exception vector service routine |
| 148 | |
| 149 .macro exception_vector name | |
| 150 .p2align 8 | |
| 151 .globl __exception_\name | |
| 152 __exception_\name: | |
| 2 | 153 mtspr SPRG1,r3 # stash some work registers away |
| 154 mtspr SPRG2,r4 | |
| 155 mtspr SPRG3,r5 | |
| 0 | 156 mfcr r4 # stash CR |
| 157 li r5,__exception_\name@L # load low half of vector address | |
| 158 srwi r5,r5,6 # shift right by 6 | |
| 159 lwi r3,hal_vsr_table # table base | |
| 160 lwzx r3,r3,r5 # address of vsr | |
| 161 mflr r5 # save link register | |
| 162 mtlr r3 # put vsr address into it | |
| 163 li r3,__exception_\name@L # reload low half of vector address | |
| 164 blr # go to common code | |
| 165 .endm | |
| 166 | |
| 2 | 167 #--------------------------------------------------------------------------- |
| 0 | 168 # Define the exception vectors. |
| 169 | |
| 170 # These are the architecture defined vectors that | |
| 171 # are always present. | |
| 172 | |
| 173 exception_vector machine_check | |
| 174 exception_vector data_storage | |
| 175 exception_vector instruction_storage | |
| 176 exception_vector external | |
| 177 exception_vector alignment | |
| 2 | 178 #if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_STUBS) \ |
| 179 || defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) | |
| 0 | 180 exception_vector program |
| 2 | 181 #else |
| 182 # Provide a crude hook to the GDB exception handler in ROM. | |
| 183 # This allows the testing infrastructure to rely on breakpoints | |
| 184 # to terminate tests, even when the tests are compiled without | |
| 185 # the GDB stub. | |
| 186 # It is _not_ a generic solution to the problem; in particular it | |
| 187 # is not possible to continue after a breakpoint is hit. | |
| 188 .p2align 8 | |
| 189 .globl __exception_program | |
| 190 __exception_program: | |
| 191 bl _init_CPU # disable caches. | |
| 192 lwi r3,0xfff00700 # address of trap handler | |
| 193 mtlr r3 # in ROM. | |
| 194 blr # jump to it. | |
| 195 | |
| 196 #endif | |
| 0 | 197 exception_vector floatingpoint_unavailable |
| 198 exception_vector decrementer | |
| 199 exception_vector reserved_00a00 | |
| 200 exception_vector reserved_00b00 | |
| 201 exception_vector system_call | |
| 202 exception_vector trace | |
| 203 exception_vector floatingpoint_assist | |
| 204 exception_vector reserved_00f00 | |
| 205 | |
| 206 # There are some additional vectors defined | |
| 207 # on various implementations. | |
| 208 | |
| 2 | 209 #ifdef CYG_HAL_POWERPC_MPC8xx |
| 210 # MPC8xx vectors | |
| 0 | 211 |
| 212 exception_vector software_emu | |
| 213 exception_vector instruction_tlb_miss | |
| 214 exception_vector data_tlb_miss | |
| 215 exception_vector instruction_tlb_error | |
| 216 exception_vector data_tlb_error | |
| 217 exception_vector reserved_01500 | |
| 218 exception_vector reserved_01600 | |
| 219 exception_vector reserved_01700 | |
| 220 exception_vector reserved_01800 | |
| 221 exception_vector reserved_01900 | |
| 222 exception_vector reserved_01A00 | |
| 223 exception_vector reserved_01B00 | |
| 224 exception_vector data_breakpoint | |
| 225 exception_vector instruction_breakpoint | |
| 226 exception_vector peripheral_breakpoint | |
| 227 exception_vector NMI_port | |
| 228 | |
| 2 | 229 #endif |
| 0 | 230 rom_vectors_end: |
| 231 | |
| 2 | 232 #=========================================================================== |
| 233 # Real startup code. We jump here from the various reset vectors to set up | |
| 234 # the world. | |
| 0 | 235 |
| 236 .text | |
| 237 .globl _start | |
| 238 | |
| 2 | 239 _start: |
| 240 # Initialize CPU | |
| 241 bl _init_CPU | |
| 0 | 242 |
| 2 | 243 #ifdef CYG_HAL_POWERPC_MPC8xx |
| 244 # Disable special MPC8xx "development support" which | |
| 245 # suppresses trace exceptions. The CPU seems to hang, not | |
| 246 # executing from offset 0x1e00(?) as expected. | |
| 0 | 247 li r3,0 |
| 2 | 248 mtspr DER, r3 |
| 0 | 249 #endif |
| 250 | |
| 251 # Set up global offset table | |
| 252 lwi r2,_GLOBAL_OFFSET_TABLE_ | |
| 253 | |
| 254 # set up time base register to zero | |
| 255 xor r3,r3,r3 | |
| 2 | 256 mtspr TBL_W,r3 |
| 0 | 257 xor r4,r4,r4 |
| 2 | 258 mtspr TBU_W,r4 |
| 259 | |
| 260 # Call platform specific hardware initialization | |
| 261 # This may include memory controller initialization. It is not | |
| 262 # safe to access RAM until after this point. | |
| 263 bl hal_hardware_init | |
| 0 | 264 |
| 265 # set up stack | |
| 266 lwi sp,__interrupt_stack | |
| 2 | 267 mtspr SPRG0,sp # save in sprg0 for later use |
| 0 | 268 |
| 2 | 269 #if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_STUBS) |
| 0 | 270 |
| 271 # Copy data from ROM to ram | |
| 272 lwi r3,__rom_data_start # r3 = rom start | |
| 273 lwi r4,__ram_data_start # r4 = ram start | |
| 274 lwi r5,__ram_data_end # r5 = ram end | |
| 275 | |
| 276 cmplw r4,r5 # skip if no data | |
| 277 beq 2f | |
| 278 | |
| 279 1: | |
| 280 lwz r0,0(r3) # get word from ROM | |
| 281 stw r0,0(r4) # store in RAM | |
| 282 addi r3,r3,4 # increment by 1 word | |
| 283 addi r4,r4,4 # increment by 1 word | |
| 284 cmplw r4,r5 # compare | |
| 285 blt 1b # loop if not yet done | |
| 286 2: | |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
287 #endif |
| 0 | 288 |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
289 |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
290 #ifdef CYG_HAL_POWERPC_COPY_VECTORS // only for CygMon-supported startup |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
291 # Copy RAM exception vectors from ROM (or load place) to RAM |
| 0 | 292 lwi r3,rom_vectors # r3 = rom start |
| 293 lwi r4,0 # r4 = ram start | |
| 294 lwi r5,rom_vectors_end # r5 = rom end | |
| 295 | |
| 296 cmplw r3,r5 # skip if no vectors | |
| 297 beq 2f | |
| 298 | |
| 299 1: | |
| 300 lwz r0,0(r3) # get word from ROM | |
| 301 stw r0,0(r4) # store in RAM | |
| 302 addi r3,r3,4 # increment by 1 word | |
| 303 addi r4,r4,4 # increment by 1 word | |
| 304 cmplw r3,r5 # compare | |
| 305 blt 1b # loop if not yet done | |
| 306 2: | |
| 307 #endif | |
| 2 | 308 |
| 0 | 309 # clear BSS |
| 2 | 310 .extern __bss_start |
| 311 .extern __bss_end | |
| 0 | 312 lwi r3,__bss_start # r3 = start |
| 2 | 313 lwi r4,__bss_end # r4 = end |
| 0 | 314 li r0,0 # r0 = 0 |
| 315 cmplw r3,r4 # skip if no bss | |
| 316 beq 2f | |
| 317 | |
| 2 | 318 1: stw r0,0(r3) # store zero |
| 0 | 319 addi r3,r3,4 # increment by 1 word |
| 320 cmplw r3,r4 # compare | |
| 321 blt 1b # loop if not yet done | |
| 322 2: | |
| 323 | |
| 2 | 324 # clear SBSS |
| 325 .extern __sbss_start | |
| 326 .extern __sbss_end | |
| 327 lwi r3,__sbss_start # r3 = start | |
| 328 lwi r4,__sbss_end # r4 = end | |
| 329 cmplw r3,r4 # skip if no sbss | |
| 330 beq 2f | |
| 331 | |
| 332 1: stw r0,0(r3) # store zero | |
| 333 addi r3,r3,4 # increment by 1 word | |
| 334 cmplw r3,r4 # compare | |
| 335 blt 1b # loop if not yet done | |
| 336 2: | |
| 337 | |
| 338 # It is now safe to call C functions which may rely on initialized | |
| 339 # data. | |
| 340 | |
| 341 # Set up stack for calls to C code. | |
| 0 | 342 subi sp,sp,12 # make space on stack |
| 343 li r0,0 | |
| 344 stw r0,0(sp) # clear back chain | |
| 345 stw r0,8(sp) # zero return pc | |
| 346 stwu sp,-ppc_stack_frame_size(sp) # create new stack frame | |
| 2 | 347 |
| 348 # Initialize MMU. | |
| 349 .extern hal_MMU_init | |
| 350 bl hal_MMU_init | |
| 351 | |
| 352 # Enable MMU it so we can safely enable caches. | |
| 353 lwi r3,CYG_MSR | |
| 354 sync | |
| 355 mtmsr r3 | |
| 356 sync | |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
357 |
| 2 | 358 # Enable caches |
| 359 .extern hal_enable_caches | |
| 360 bl hal_enable_caches | |
| 0 | 361 |
| 2 | 362 # call c++ constructors |
| 0 | 363 .extern cyg_hal_invoke_constructors |
| 2 | 364 bl cyg_hal_invoke_constructors |
| 0 | 365 |
| 2 | 366 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS |
| 367 .extern initialize_stub | |
| 368 bl initialize_stub | |
| 0 | 369 #endif |
| 370 | |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
371 |
| 0 | 372 .extern cyg_start |
| 373 bl cyg_start # call cyg_start | |
| 374 9: | |
| 375 b 9b # if we return, loop | |
| 376 | |
| 2 | 377 #--------------------------------------------------------------------------- |
| 0 | 378 # This code handles the common part of all exception handlers. |
| 379 # It saves the machine state onto the stack and then calls | |
| 380 # a "C" routine to do the rest of the work. This work may result | |
| 381 # in thread switches, and changes to the saved state. When we return | |
| 382 # here the saved state is restored and execution is continued. | |
| 383 | |
| 384 .text | |
| 385 | |
| 386 .extern __default_exception_vsr | |
| 387 __default_exception_vsr: | |
| 388 | |
| 389 # We come here with all register containing their | |
| 390 # pre-exception values except: | |
| 391 # R3 = ls 16 bits of vector address | |
| 392 # R4 = saved CR | |
| 393 # R5 = saved LR | |
| 394 # LR = VSR address | |
| 395 # SPRG1 = old R3 | |
| 396 # SPRG2 = old R4 | |
| 397 # SPRG3 = old R5 | |
| 398 # SRR0 = old PC | |
| 2 | 399 # SRR1 = old MSR and the exception cause (the POW state is lost!) |
| 0 | 400 |
| 401 subi r1,r1,ppc_exception_decrement | |
| 402 # leave space for registers and | |
| 403 # a safety margin | |
| 404 | |
| 405 # First, save away some registers | |
| 406 stw r3,ppcreg_vector(r1) # stash vector | |
| 407 stw r4,ppcreg_cr(r1) # stash CR | |
| 408 stw r5,ppcreg_lr(r1) # stash LR | |
| 2 | 409 |
| 410 # Enable MMU. | |
| 411 lwi r3,CYG_MSR | |
| 412 sync | |
| 413 mtmsr r3 | |
| 414 sync | |
| 415 | |
| 416 mfspr r3,SPRG1 # save original R3 | |
| 0 | 417 stw r3,ppcreg_regs+3*4(r1) |
| 2 | 418 mfspr r4,SPRG2 # save original R4 |
| 0 | 419 stw r4,ppcreg_regs+4*4(r1) |
| 2 | 420 mfspr r5,SPRG3 # save original R5 |
| 0 | 421 stw r5,ppcreg_regs+5*4(r1) |
| 422 | |
| 423 stw r0,ppcreg_regs(r1) # save R0 | |
| 424 stw r2,ppcreg_regs+2*4(r1) # save R2 | |
| 425 | |
| 426 mr r3,r1 # recreate original R1 | |
| 427 addi r3,r3,ppc_exception_decrement | |
| 428 stw r3,ppcreg_regs+1*4(r1) # and save it in state | |
| 429 | |
| 2 | 430 # Save registers r6..r12/r31 |
| 0 | 431 .set _reg,6 |
| 432 .rept MAX_SAVE_REG+1-6 | |
| 433 stw _reg,(ppcreg_regs+_reg*4)(r1) | |
| 434 .set _reg,_reg+1 | |
| 435 .endr | |
| 436 | |
| 2 | 437 # Save registers used in vsr (r14+r15) |
| 438 stw r14,(ppcreg_regs+14*4)(r1) | |
| 439 stw r15,(ppcreg_regs+15*4)(r1) | |
| 440 | |
| 0 | 441 # get remaining CPU registers |
| 442 mfxer r3 | |
| 443 mfctr r5 | |
| 444 mfdar r6 | |
| 445 mfdsisr r7 | |
| 446 mfpvr r8 | |
| 447 mfsrr0 r9 | |
| 448 mfsrr1 r10 | |
| 449 | |
| 450 # and store them | |
| 451 stw r3,ppcreg_xer(r1) | |
| 452 stw r5,ppcreg_ctr(r1) | |
| 453 stw r6,ppcreg_dar(r1) | |
| 454 stw r7,ppcreg_dsisr(r1) | |
| 455 stw r8,ppcreg_pvr(r1) | |
| 456 stw r9,ppcreg_pc(r1) | |
| 457 stw r10,ppcreg_msr(r1) | |
| 458 | |
| 459 # The entire CPU state is now stashed on the stack, | |
| 460 # call into C to do something with it. | |
| 461 | |
| 462 mr r3,sp # R3 = register dump | |
| 463 | |
| 464 subi sp,sp,ppc_stack_frame_size # make a null frame | |
| 465 | |
| 466 li r0,0 # R0 = 0 | |
| 467 stw r0,0(sp) # backchain = 0 | |
| 468 stw r0,8(sp) # return pc = 0 | |
| 469 | |
| 470 stwu sp,-ppc_stack_frame_size(sp) # create new stack frame | |
| 471 # where C code can save LR | |
| 472 | |
| 473 lwi r5,restore_state # get return link | |
| 474 mtlr r5 # to link register | |
| 475 | |
| 2 | 476 .extern cyg_hal_exception_handler |
| 477 b cyg_hal_exception_handler # call C code, r3 = registers | |
| 0 | 478 |
| 479 # When the call returns it will go to restore_state below. | |
| 480 | |
| 481 | |
| 2 | 482 ##-------------------------------------------------------------------------- |
| 483 ## The following macros are defined depending on whether the Interrupt | |
| 484 ## system is using isr tables or chaining, and depending on the interrupt | |
| 485 ## controller in the system. | |
| 486 | |
| 487 ## Note: CYG_ISR_TABLE_SIZE must match CYG_ISR_COUNT defined in hal_intr.h. | |
| 488 | |
| 489 #ifdef CYG_HAL_POWERPC_MPC8xx | |
| 490 | |
| 491 ## First level decoding of MPC8xx SIU interrupt controller. | |
| 492 | |
| 493 #define CYG_ISR_TABLE_SIZE 59 | |
| 494 | |
| 495 # decode the interrupt | |
| 496 .macro decode_interrupt dreg,state | |
| 497 lwz \dreg,ppcreg_vector(\state) # retrieve vector number, | |
| 498 rlwinm. \dreg,\dreg,22,31,31 # isolate bit 21 | |
| 499 beq 0f # done if decrementer (vec 0) | |
| 500 lwi \dreg,CYGARC_REG_IMM_SIVEC # if external, get SIU | |
| 501 lbz \dreg,0(\dreg) # vector. | |
| 502 srwi \dreg,\dreg,2 | |
| 503 addi \dreg,\dreg,1 # Skip decrementer vector | |
| 504 0: stw \dreg,ppcreg_vector(\state) # update vector in state frame. | |
| 505 slwi \dreg,\dreg,2 # convert to byte offset. | |
| 506 .endm | |
| 507 | |
| 508 #else | |
| 509 | |
| 510 ## This is the simple version. No interrupt controller, ppcreg_vector | |
| 511 ## is updated with the decoded interrupt vector. Isr tables/chaining | |
| 512 ## use same interrupt decoder. | |
| 513 ## Bit 21 biffers between decrementer (0) and external (1). | |
| 514 | |
| 515 #define CYG_ISR_TABLE_SIZE 2 | |
| 516 | |
| 517 # decode the interrupt | |
| 518 .macro decode_interrupt dreg,state | |
| 519 lwz \dreg,ppcreg_vector(\state) # retrieve vector number, | |
| 520 rlwinm \dreg,\dreg,22,31,31 # isolate bit 21 and update | |
| 521 stw \dreg,ppcreg_vector(\state) # vector in state frame. | |
| 522 slwi \dreg,\dreg,2 # convert to word offset. | |
| 523 .endm | |
| 524 | |
| 525 #endif | |
| 526 | |
| 527 #--------------------------------------------------------------------------- | |
| 0 | 528 # Common interrupt handling code. |
| 529 | |
| 530 .extern __default_interrupt_vsr | |
| 531 __default_interrupt_vsr: | |
| 532 | |
| 533 # We come here with all register containing their | |
| 534 # pre-exception values except: | |
| 535 # R3 = ls 16 bits of vector address | |
| 536 # R4 = saved CR | |
| 537 # R5 = saved LR | |
| 538 # LR = VSR address | |
| 539 # SPRG1 = old R3 | |
| 540 # SPRG2 = old R4 | |
| 541 # SPRG3 = old R5 | |
| 542 # SRR0 = old PC | |
| 543 # SRR1 = old MSR | |
| 544 | |
| 545 | |
| 546 subi r1,r1,ppc_exception_decrement | |
| 547 # leave space for registers and | |
| 548 # a safety margin | |
| 549 | |
| 550 stw r3,ppcreg_vector(r1) # stash vector | |
| 551 stw r4,ppcreg_cr(r1) # stash CR | |
| 552 stw r5,ppcreg_lr(r1) # stash LR | |
| 553 | |
| 2 | 554 # Enable MMU. |
| 555 lwi r3,CYG_MSR | |
| 556 sync | |
| 557 mtmsr r3 | |
| 558 sync | |
| 559 | |
| 560 mfspr r3,SPRG1 # save original R3 | |
| 0 | 561 stw r3,ppcreg_regs+3*4(r1) |
| 2 | 562 mfspr r4,SPRG2 # save original R4 |
| 0 | 563 stw r4,ppcreg_regs+4*4(r1) |
| 2 | 564 mfspr r5,SPRG3 # save original R5 |
| 0 | 565 stw r5,ppcreg_regs+5*4(r1) |
| 566 | |
| 567 stw r0,ppcreg_regs(r1) # save R0 | |
| 568 stw r2,ppcreg_regs+2*4(r1) # save R2 | |
| 569 | |
| 570 mr r3,r1 # recreate original R1 | |
| 571 addi r3,r3,ppc_exception_decrement | |
| 572 stw r3,ppcreg_regs+1*4(r1) # and save it in state | |
| 573 | |
| 2 | 574 # Save registers r6..r12/r31 |
| 0 | 575 .set _reg,6 |
| 576 .rept MAX_SAVE_REG+1-6 | |
| 577 stw _reg,(ppcreg_regs+_reg*4)(r1) | |
| 578 .set _reg,_reg+1 | |
| 579 .endr | |
| 580 | |
| 2 | 581 # Save registers used in vsr (r14+r15) |
| 582 stw r14,(ppcreg_regs+14*4)(r1) | |
| 583 stw r15,(ppcreg_regs+15*4)(r1) | |
| 584 | |
| 0 | 585 # get remaining CPU registers |
| 586 mfxer r3 | |
| 587 mfctr r5 | |
| 588 mfsrr0 r6 | |
| 589 mfsrr1 r7 | |
| 590 | |
| 591 # and store them | |
| 592 stw r3,ppcreg_xer(r1) | |
| 593 stw r5,ppcreg_ctr(r1) | |
| 594 stw r6,ppcreg_pc(r1) | |
| 595 stw r7,ppcreg_msr(r1) | |
| 596 | |
| 597 # The entire CPU state is now stashed on the stack, | |
| 598 # increment the scheduler lock and call the ISR | |
| 599 # for this vector. | |
| 600 | |
| 601 #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT | |
| 2 | 602 .extern cyg_scheduler_sched_lock |
| 603 lwi r3,cyg_scheduler_sched_lock | |
| 0 | 604 lwz r4,0(r3) |
| 605 addi r4,r4,1 | |
| 606 stw r4,0(r3) | |
| 607 #endif | |
| 608 | |
| 2 | 609 mr r14,sp # r14 = register dump |
| 0 | 610 |
| 611 #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK | |
| 612 lwi r3,__interrupt_stack # stack top | |
| 613 lwi r4,__interrupt_stack_base # stack base | |
| 614 sub. r5,sp,r4 # sp - base | |
| 615 blt 1f # if < 0 - not on istack | |
| 616 sub. r5,r3,sp # top - sp | |
| 617 bgt 2f # if > 0 - already on istack | |
| 618 | |
| 619 1: mr sp,r3 # switch to istack | |
| 620 | |
| 2 | 621 2: stwu r14,-4(sp) # save old SP on stack |
| 0 | 622 |
| 623 #endif | |
| 624 | |
| 625 subi sp,sp,ppc_stack_frame_size # make a null frame | |
| 626 | |
| 627 li r0,0 # R0 = 0 | |
| 628 stw r0,0(sp) # backchain = 0 | |
| 629 stw r0,8(sp) # return pc = 0 | |
| 630 | |
| 631 stwu sp,-ppc_stack_frame_size(sp) # create new stack frame | |
| 632 # where C code can save LR | |
| 633 | |
| 634 #if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) | |
| 635 | |
| 636 lwi r3,0x0301 # r3 = type = INTR,RAISE | |
| 2 | 637 lwz r4,ppcreg_vector(r14) # arg1 = vector address |
| 0 | 638 srwi r4,r4,8 # arg1 = vector number |
| 639 xor r5,r5,r5 # arg2 = 0 | |
| 640 bl cyg_instrument # call instrument function | |
| 641 | |
| 642 #endif | |
| 643 | |
| 2 | 644 decode_interrupt r15,r14 # get table index |
| 645 | |
| 0 | 646 #ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT |
| 647 .extern cyg_hal_gdb_isr | |
| 2 | 648 lwz r3,ppcreg_pc(r14) # for serial receive irq. |
| 649 bl cyg_hal_gdb_isr # (arg1 is PC) | |
| 0 | 650 cmpwi r3,0x0000 # Call ISR proper? |
| 651 beq 2f # (r3 is 0 when skipping | |
| 652 # to avoid DSR call) | |
| 653 1: | |
| 654 #endif | |
| 655 | |
| 2 | 656 #ifdef CYGSEM_HAL_COMMON_INTERRUPTS_ALLOW_NESTING |
| 0 | 657 |
| 2 | 658 #ifdef CYG_HAL_POWERPC_MPC8xx |
| 659 # The CPM controller allows nested interrupts. However, | |
| 660 # it sits on the back of the SIU controller which has no | |
| 661 # HW support for this. In effect, SW masking of lower | |
| 662 # priority IRQs in the SIU would be required for this to work. | |
| 663 #endif | |
| 664 | |
| 665 #endif | |
| 666 | |
| 667 lwz r3,ppcreg_vector(r14) # retrieve decoded vector # | |
| 0 | 668 |
| 669 lwi r6,hal_interrupt_handlers # get interrupt handler table | |
| 670 lwzx r6,r6,r15 # load routine pointer | |
| 671 | |
| 672 lwi r4,hal_interrupt_data # get interrupt data table | |
| 673 lwzx r4,r4,r15 # load data pointer | |
| 674 # R4 = data argument | |
| 675 | |
| 676 mtctr r6 # put isr address in ctr | |
| 677 | |
| 678 bctrl # branch to ctr reg and link | |
| 679 | |
| 680 #ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT | |
| 681 # If interrupt was caused by GDB, the ISR call above | |
| 682 # is skipped by jumping here. | |
| 683 2: | |
| 684 #endif | |
| 685 | |
| 686 #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK | |
| 687 | |
| 688 # If we are returning from the last nested interrupt, move back | |
| 689 # to the thread stack. interrupt_end() must be called on the | |
| 690 # thread stack since it potentially causes a context switch. | |
| 691 # Since we have arranged for the top of stack location to | |
| 692 # contain the sp we need to go back to here, just pop it off | |
| 693 # and put it in SP. | |
| 694 | |
| 695 | |
| 696 lwz sp,ppc_stack_frame_size*2(sp) # sp = *sp | |
| 697 | |
| 698 subi sp,sp,ppc_stack_frame_size # make a null frame | |
| 699 | |
| 700 li r0,0 # R0 = 0 | |
| 701 stw r0,0(sp) # backchain = 0 | |
| 702 stw r0,8(sp) # return pc = 0 | |
| 703 | |
| 704 stwu sp,-ppc_stack_frame_size(sp) # create new stack frame | |
| 705 # where C code can save LR | |
| 706 #endif | |
| 707 | |
| 708 #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT | |
| 709 | |
| 710 # We only need to call _interrupt_end() when there is a kernel | |
| 711 # present to do any tidying up. | |
| 712 | |
| 713 # on return r3 bit 1 will indicate whether a DSR is | |
| 714 # to be posted. Pass this together with a pointer to | |
| 715 # the interrupt object we have just used to the | |
| 716 # interrupt tidy up routine. | |
| 717 | |
| 2 | 718 # Note that r14 and r15 are defined to be preserved across |
| 0 | 719 # calls by the calling convention, so they still contain |
| 720 # the register dump and the vector number respectively. | |
| 2 | 721 |
| 722 # Note: The instructions restoring the msr mask out the POW bit. | |
| 723 # When eCos gets power management aware, this bit will have to be | |
| 724 # set to the correct state rather than just cleared. | |
| 0 | 725 |
| 726 lwi r4,hal_interrupt_objects # get interrupt object table | |
| 727 lwzx r4,r4,r15 # load object pointer | |
| 728 | |
| 2 | 729 lwz r6,ppcreg_msr(r14) # restore msr, including |
| 730 lis r5,0xfffe # interrupt enable. | |
| 731 andc r6,r6,r5 # mask out reserved bits | |
| 732 sync # (and POW!) | |
| 733 mtmsr r6 | |
| 734 sync | |
| 0 | 735 |
| 2 | 736 mr r5,r14 # arg3 = saved register dump |
| 0 | 737 |
| 738 .extern interrupt_end | |
| 739 bl interrupt_end # call into C to finish off | |
| 740 #endif | |
| 741 | |
| 742 restore_state: | |
| 743 # All done, restore CPU state and continue | |
| 744 | |
| 745 addi sp,sp,ppc_stack_frame_size*2 # retrieve CPU state pointer | |
| 746 | |
| 747 # get sprs we want to restore | |
| 748 lwz r3,ppcreg_cr(sp) | |
| 749 lwz r4,ppcreg_pc(sp) | |
| 750 lwz r5,ppcreg_msr(sp) | |
| 751 lwz r6,ppcreg_xer(sp) | |
| 752 lwz r7,ppcreg_lr(sp) | |
| 753 lwz r8,ppcreg_ctr(sp) | |
| 754 | |
| 755 | |
| 756 # stuff some of them into the CPU | |
| 757 mtxer r6 | |
| 758 mtlr r7 | |
| 759 mtctr r8 | |
| 760 | |
| 761 # restore R0 and R2 | |
| 762 lwz r0,ppcreg_regs(sp) | |
| 763 lwz r2,ppcreg_regs+2*4(sp) | |
| 764 | |
| 2 | 765 # Restore registers used in vsr (r14+r15) |
| 766 lwz r14,(ppcreg_regs+14*4)(r1) | |
| 767 lwz r15,(ppcreg_regs+15*4)(r1) | |
| 768 | |
| 769 # restore registers r6..r12/r31 | |
| 0 | 770 .set _reg,6 |
| 771 .rept MAX_SAVE_REG+1-6 | |
| 772 lwz _reg,(ppcreg_regs+_reg*4)(r1) | |
| 773 .set _reg,_reg+1 | |
| 774 .endr | |
| 775 | |
| 776 # Here all the registers are loaded except | |
| 777 # r1 = ppcregs | |
| 778 # r3 = ccr | |
| 779 # r4 = srr0 = pc | |
| 780 # r5 = srr1 = msr | |
| 781 | |
| 782 # We have to disable interrupts while srr0 and | |
| 783 # srr1 are loaded, since another interrupt will | |
| 784 # destroy them. | |
| 785 | |
| 786 mtcr r3 # set ccr | |
| 787 | |
| 2 | 788 lwi r3,CYG_MSR # do rest with ints disabled |
| 789 sync | |
| 0 | 790 mtmsr r3 |
| 2 | 791 sync |
| 0 | 792 |
| 793 mtsrr0 r4 # load old pc | |
| 794 mtsrr1 r5 # load old msr | |
| 795 | |
| 796 lwz r3,ppcreg_regs+3*4(r1) # load r3 value | |
| 797 lwz r4,ppcreg_regs+4*4(r1) # load r4 value | |
| 798 lwz r5,ppcreg_regs+5*4(r1) # load r5 value | |
| 799 lwz r1,ppcreg_regs+1*4(r1) # restore r1 | |
| 800 | |
| 801 sync # settle things down | |
| 802 isync | |
| 803 rfi # and return | |
| 804 | |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
805 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
806 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
807 ##----------------------------------------------------------------------------- |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
808 ## Execute pending DSRs on the interrupt stack with interrupts enabled. |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
809 ## Note: this can only be called from code running on a thread stack |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
810 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
811 #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
812 .extern cyg_interrupt_call_pending_DSRs |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
813 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
814 FUNC_START(hal_interrupt_stack_call_pending_DSRs) |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
815 # Disable interrupts |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
816 mfmsr r4 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
817 lis r3,0 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
818 ori r3,r3,0x8000 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
819 andc r5,r4,r3 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
820 mtmsr r5 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
821 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
822 # Change to interrupt stack |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
823 mr r3,sp |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
824 lwi sp,__interrupt_stack |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
825 stwu r3,-4(sp) # store old stackptr on stack |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
826 mflr r3 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
827 stwu r3,-4(sp) # store lr on stack |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
828 stwu r4,-4(sp) # store msr values on stack |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
829 stwu r5,-4(sp) |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
830 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
831 # Set up stack for calls to C code. |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
832 subi sp,sp,12 # make space on stack |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
833 li r0,0 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
834 stw r0,0(sp) # clear back chain |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
835 stw r0,8(sp) # zero return pc |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
836 stwu sp,-ppc_stack_frame_size(sp) # create new stack frame |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
837 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
838 # Restore interrupt state |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
839 mtmsr r4 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
840 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
841 # Call into kernel which will execute DSRs |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
842 bl cyg_interrupt_call_pending_DSRs |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
843 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
844 # Unwind stack and get msr values |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
845 lwzu r5,12+ppc_stack_frame_size(sp) |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
846 lwz r4,4(sp) |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
847 lwz r3,8(sp) |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
848 mtlr r3 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
849 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
850 # Disable interrupts |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
851 mtmsr r5 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
852 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
853 # Restore original stack pointer, original interrupt state and return |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
854 lwz sp,12(sp) |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
855 mtmsr r4 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
856 |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
857 blr |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
858 #endif |
|
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
859 |
| 2 | 860 #--------------------------------------------------------------------------- |
| 861 # Code for putting the CPU in a post-reset state; disabling MMU and caches. | |
| 862 _init_CPU: | |
| 863 #ifdef CYG_HAL_POWERPC_MPC8xx | |
| 864 lwi r3,CYGARC_REG_DC_CMD_CD | |
| 865 sync | |
| 866 mtspr CYGARC_REG_DC_CST,r3 | |
| 867 lwi r3,CYGARC_REG_IC_CMD_CD | |
| 868 isync | |
| 869 mtspr CYGARC_REG_IC_CST,r3 | |
| 870 isync | |
| 871 #endif | |
| 872 | |
| 873 # Set up MSR (disable MMU for now) | |
| 874 lwi r3,(CYG_MSR & ~(MSR_IR | MSR_DR)) | |
| 875 sync | |
| 876 mtmsr r3 | |
| 877 sync | |
| 878 blr | |
| 879 | |
| 880 #--------------------------------------------------------------------------- | |
| 0 | 881 # This table contains a VSR pointer for each defined exception. |
| 882 # All of these except 5 and 9 point to the __default_exception_vsr | |
| 883 # above, 5 and 9 point to the __default_interrupt_vsr. Entries in | |
| 884 # this table may be changed using Cyg_Interrupt::set_vsr(). | |
| 885 | |
| 886 .data | |
| 887 | |
| 888 .globl hal_vsr_table | |
| 889 hal_vsr_table: | |
| 890 # Architecture defined vectors | |
| 891 .long __default_exception_vsr # reserved | |
| 892 .long __default_exception_vsr # system reset | |
| 893 .long __default_exception_vsr # machine check | |
| 894 .long __default_exception_vsr # data storage | |
| 895 .long __default_exception_vsr # instruction storage | |
| 896 | |
| 897 .long __default_interrupt_vsr # external interrupt | |
| 898 | |
| 899 .long __default_exception_vsr # alignment | |
| 900 .long __default_exception_vsr # program | |
| 901 .long __default_exception_vsr # floating point unavailable | |
| 902 | |
| 903 .long __default_interrupt_vsr # decrementer | |
| 904 | |
| 905 .long __default_exception_vsr # reserved 0x0a00 | |
| 906 .long __default_exception_vsr # reserved 0x0b00 | |
| 907 .long __default_exception_vsr # system call | |
| 908 .long __default_exception_vsr # trace | |
| 909 .long __default_exception_vsr # floating point assist | |
| 910 .long __default_exception_vsr # reserved 0x0f00 | |
| 911 | |
| 2 | 912 #ifdef CYG_HAL_POWERPC_MPC8xx |
| 0 | 913 |
| 914 # Implementation defined vectors | |
| 915 .long __default_exception_vsr # software emulation | |
| 916 .long __default_exception_vsr # instruction TLB miss | |
| 917 .long __default_exception_vsr # data TLB miss | |
| 918 .long __default_exception_vsr # instruction TLB error | |
| 919 .long __default_exception_vsr # data TLB error | |
| 920 .long __default_exception_vsr # reserved 0x1500 | |
| 921 .long __default_exception_vsr # reserved 0x1600 | |
| 922 .long __default_exception_vsr # reserved 0x1700 | |
| 923 .long __default_exception_vsr # reserved 0x1800 | |
| 924 .long __default_exception_vsr # reserved 0x1900 | |
| 925 .long __default_exception_vsr # reserved 0x1a00 | |
| 926 .long __default_exception_vsr # reserved 0x1b00 | |
| 927 .long __default_exception_vsr # data breakpoint | |
| 928 .long __default_exception_vsr # instruction breakpoint | |
| 929 .long __default_exception_vsr # peripheral breakpoint | |
| 930 .long __default_exception_vsr # non maskable development port | |
| 931 #endif | |
| 932 | |
| 2 | 933 #--------------------------------------------------------------------------- |
| 0 | 934 # Interrupt vector tables. |
| 935 # These tables contain the isr, data and object pointers used to deliver | |
| 936 # interrupts to user code. | |
| 2 | 937 |
| 938 #if (CYG_ISR_TABLE_SIZE > 2) | |
| 0 | 939 .data |
| 2 | 940 #else |
| 941 .section ".sdata","aw" | |
| 942 #endif | |
| 0 | 943 |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
944 .extern hal_default_decrementer_isr |
| 0 | 945 .extern hal_default_isr |
| 946 | |
| 947 .globl hal_interrupt_handlers | |
| 948 hal_interrupt_handlers: | |
|
14
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
949 .long hal_default_decrementer_isr |
|
01ce82f3e11a
Merge from eCos master repository on 1999-06-11-17:05:41-BST
jlarmour
parents:
10
diff
changeset
|
950 .rept CYG_ISR_TABLE_SIZE-1 |
| 0 | 951 .long hal_default_isr |
| 952 .endr | |
| 953 | |
| 954 .globl hal_interrupt_data | |
| 955 hal_interrupt_data: | |
| 2 | 956 .rept CYG_ISR_TABLE_SIZE |
| 0 | 957 .long 0 |
| 958 .endr | |
| 959 | |
| 960 .globl hal_interrupt_objects | |
| 961 hal_interrupt_objects: | |
| 2 | 962 .rept CYG_ISR_TABLE_SIZE |
| 0 | 963 .long 0 |
| 964 .endr | |
| 965 | |
| 2 | 966 #--------------------------------------------------------------------------- |
| 0 | 967 ## Temporary interrupt stack |
| 968 | |
| 969 .section ".bss" | |
| 970 | |
| 971 .balign 16 | |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
2
diff
changeset
|
972 .global cyg_interrupt_stack_base |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
2
diff
changeset
|
973 cyg_interrupt_stack_base: |
| 0 | 974 __interrupt_stack_base: |
| 975 .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE | |
| 976 .byte 0 | |
| 977 .endr | |
| 978 .balign 16 | |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
2
diff
changeset
|
979 .global cyg_interrupt_stack |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
2
diff
changeset
|
980 cyg_interrupt_stack: |
| 0 | 981 __interrupt_stack: |
| 982 | |
| 983 .long 0,0,0,0,0,0,0,0 | |
| 984 | |
| 2 | 985 #--------------------------------------------------------------------------- |
| 0 | 986 # end of vectors.S |
