comparison packages/hal/v85x/arch/current/src/vectors.S @ 126:518f42066aba ecos-sw-2000-09-19

Merge from eCos master repository on 2000-09-19-06:25:26-BST
author jlarmour
date Tue, 19 Sep 2000 05:53:51 +0000
parents 77cec8369160
children 0c2b7be0d798
comparison
equal deleted inserted replaced
125:b4407dc7f59d 126:518f42066aba
114 addi 4,r7,r7 114 addi 4,r7,r7
115 cmp r7,r8 115 cmp r7,r8
116 bne 1b 116 bne 1b
117 #endif 117 #endif
118 // Initialize stack 118 // Initialize stack
119 lea __startup_stack,r1 119 lea __startup_stack-16,r1
120 mov r1,sp 120 mov r1,sp
121 121
122 // Clear BSS 122 // Clear BSS
123 lea ___bss_start,r6 123 lea ___bss_start,r6
124 lea ___bss_end,r7 124 lea ___bss_end,r7
258 ld.w 0[r8],r1 258 ld.w 0[r8],r1
259 jmp [r1] 259 jmp [r1]
260 #endif 260 #endif
261 261
262 do_exception: 262 do_exception:
263 // leave space for the parameter flush back area (as per calling
264 // conventions)
265 addi -16,sp,sp
266
263 mov sp,r6 267 mov sp,r6
264 jarl _exception_handler,r31 268 jarl _exception_handler,r31
265 269
266 return_from_exception_or_interrupt: 270 return_from_exception_or_interrupt:
267 mov sp,ep 271 // save sp, but remove space for the parameter flush back area
272 // (as per calling conventions) at the same time
273 addi 16,sp,ep
274
268 ld.w CYGARC_REG_PSW[ep],r7 275 ld.w CYGARC_REG_PSW[ep],r7
269 sld.w CYGARC_REG_R1[ep],r1 276 sld.w CYGARC_REG_R1[ep],r1
270 ld.w CYGARC_REG_PC[ep],r6 277 ld.w CYGARC_REG_PC[ep],r6
271 sld.w CYGARC_REG_R2[ep],r2 278 sld.w CYGARC_REG_R2[ep],r2
272 // disable interrupts while restoring context 279 // disable interrupts while restoring context
319 reti 326 reti
320 327
321 // Handle interrupt - these are typically vectored into user code 328 // Handle interrupt - these are typically vectored into user code
322 do_interrupt: 329 do_interrupt:
323 mov sp,ep // save pointer to regs frame 330 mov sp,ep // save pointer to regs frame
331 // leave space for the parameter flush back area (as per calling
332 // conventions)
333 addi -16,sp,sp
324 334
325 #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK 335 #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
326 // Switch to interrupt stack 336 // Switch to interrupt stack
327 lea irq_level,r6 // current number of nested interrupts 337 lea irq_level,r6 // current number of nested interrupts
328 ld.w 0[r6],r7 338 ld.w 0[r6],r7
329 addi 1,r7,r8 339 addi 1,r7,r8
330 st.w r8,0[r6] 340 st.w r8,0[r6]
331 cmp 0,r7 // if was zero, switch stacks 341 cmp 0,r7 // if was zero, switch stacks
332 bne 10f 342 bne 10f
333 mov sp,r1 // save old stack pointer 343 mov sp,r1 // save old stack pointer
334 lea __interrupt_stack-4,r2 344 lea __interrupt_stack-20,r2
335 mov r2,sp 345 mov r2,sp
336 st.w r1,0[sp] 346 st.w r1,16[sp]
337 10: 347 10:
338 #endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK 348 #endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
339 349
340 // The entire CPU state is now stashed on the stack, 350 // The entire CPU state is now stashed on the stack,
341 // increment the scheduler lock and handle the interrupt 351 // increment the scheduler lock and handle the interrupt
399 ld.w 0[r6],r7 409 ld.w 0[r6],r7
400 addi -1,r7,r8 410 addi -1,r7,r8
401 st.w r8,0[r6] 411 st.w r8,0[r6]
402 cmp 0,r8 412 cmp 0,r8
403 bne 10f 413 bne 10f
404 ld.w 0[sp],sp // Restore non-interrupt stack at last interrupt 414 ld.w 16[sp],sp // Restore non-interrupt stack at last interrupt
415 // this is offset 16 because of parameter
416 // flush back area
405 10: 417 10:
406 #endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK 418 #endif // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
407 419
408 #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT 420 #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT
409 // The return value from the handler (in r10) will indicate whether a 421 // The return value from the handler (in r10) will indicate whether a