📄 vectors.s
字号:
jsr @CYG_LABEL_DEFN(hal_ctrlc_isr_init)#endif ; Call cyg_start sub.l er0,er0 .extern CYG_LABEL_DEFN(cyg_start) jsr @CYG_LABEL_DEFN(cyg_start)9: bra 9b ; Loop if we returnsave_vector_table: #if defined(CYGSEM_HAL_H8300_SAVE_STUB_VECTOR) .byte 5,11#if defined(CYGPKG_HAL_H8300_SAVED_VECTORS) h8300_save_vectors#endif#endif .byte 0 ; end maker .align 2 interrupt_entry: mov.l er0,@-sp mov.l @(4:16,sp),er0 ; interrupt vector offset mov.l er1,@-sp mov.l @__interrupt_table,er1 sub.l er1,er0 shlr2 er0 dec.l #1,er0 mov.l er0,@CYG_LABEL_DEFN(_intvector) mov.l @sp+,er1 mov.l @sp+,er0 adds #4,sp#ifdef CYGPKG_CYGMON hal_cygmon_switch_app_stack#endif hal_cpu_save_all h8300_var_interrupt_entry ; load isr address jmp @er0##-----------------------------------------------------------------------------## The following macros are defined depending on whether the HAL is configured## to support the kernel or not. #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT .extern CYG_LABEL_DEFN(cyg_scheduler_sched_lock) ; Increment the scheduler lock .macro increment_sched_lock reg=er0 mov.l @CYG_LABEL_DEFN(cyg_scheduler_sched_lock),\reg inc.l #1,\reg mov.l \reg,@CYG_LABEL_DEFN(cyg_scheduler_sched_lock) .endm#else .macro increment_sched_lock reg=er0 .endm#endif ##-----------------------------------------------------------------------------## Default interrupt VSR .text .globl CYG_LABEL_DEFN(__default_interrupt_vsr)CYG_LABEL_DEFN(__default_interrupt_vsr): ; We come here with all the registers pushed ; onto the stack. hal_diag_intr_start increment_sched_lock#if defined(CYGPKG_CYGMON) // For Cygmon, we saved this back when we originally switched stacks. mov.l sp,er1 ; A2 = saved thread state#elif defined(CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK) ; Increment interrupt nesting counter mov.l sp,er1 mov.l #__interrupt_stack,er0 ; A0 = interrupt stack top cmp.l #__interrupt_stack_base,sp ; compare with base of stack blt 1f ; if lt switch to int stack cmp.l er0,sp ; compare sp with stack top ble 8f ; if le already on istack1: mov.l er0,sp ; switch to new SP8: mov.l er1,@-sp ; save old SP #else mov sp,er1 ; A2 = saved thread state#endif mov.l er1,er4 ; Here D3 contains the table byte offset of the vector to ; call.#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) ; Call cyg_instrument to record that this interrupt is being raised. .extern CYG_LABEL_DEFN(cyg_instrument) mov.l #0x0301,er0 ; type = INTR,RAISE mov.l @CYG_LABEL_DEFN(_intvector),er2 ; arg2 = table offset jsr CYG_LABEL_DEFN(cyg_instrument) ; call instrumentation #endif #ifdef CYGSEM_HAL_COMMON_INTERRUPTS_ALLOW_NESTING ; To allow nested interrupts, we set the IE bit. We do ; not touch the IPL bits, so only higher priority interrupts ; will be nested on top of us. Also, new interrupts will not ; be delivered until the ISR calls ; Cyg_Interrupt::acknowledge_interrupt(). At some future point ; we may want to do the ack stuff here to allow immediate nesting. mov.l @CYG_LABEL_DEFN(_intvector),er0 mov.b @(CYG_LABEL_DEFN(cyg_hal_level_table),er0),r0l hal_cpu_set_int_level#endif#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) || \ defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) ; If we have Ctrl-C support enabled, save a pointer to the ; saved CPU state here so we can plant a breakpoint there if ; this is a ^C. .extern CYG_LABEL_DEFN(hal_saved_interrupt_state) mov.l er4,@CYG_LABEL_DEFN(hal_saved_interrupt_state) #endif mov.l @CYG_LABEL_DEFN(_intvector),er0 shll2 er0 mov.l @(CYG_LABEL_DEFN(hal_interrupt_handlers),er0),er2 mov.l @(CYG_LABEL_DEFN(hal_interrupt_data),er0),er1 shlr2 er0 jsr @er2 ; on return d0 bit 1 will indicate whether a DSR is ; to be posted. Pass this together with a pointer to ; the interrupt object we have just used to the ; interrupt tidy up routine. ; D3 is defined to be saved across procedure calls, and ; should still contain the vector byte index. Similarly, ; A2 should still point to the saved machine state.#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT ; If interrupt was caused by GDB, the ISR call above ; is skipped by jumping here.2:#endif#if defined(CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK) && !defined(CYGPKG_CYGMON) ; If we are returning from the last nested interrupt, move back ; to the thread stack. interrupt_end() must be called on the ; thread stack since it potentially causes a context switch. mov.l @sp+,sp ; pop old sp#endif #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT ; We only need to call _interrupt_end() when there is a kernel ; present to do any tidying up. ; Using the vector offset in D3, get the interrupt object pointer ; into D1. mov.l @CYG_LABEL_DEFN(_intvector),er1 shll2 er1 mov.l @(CYG_LABEL_DEFN(hal_interrupt_objects),er1),er1 ; Even when this is not the last nested interrupt, we must call ; _interrupt_end() to post the DSR and decrement the scheduler ; lock. mov.l er3,er2 ; arg3 = saved state. jsr @CYG_LABEL_DEFN(interrupt_end) ; call interrupt end fn #endif# show_interrupts hal_diag_restore hal_cpu_load_all#ifdef CYGPKG_CYGMON hal_cygmon_restore_app_stack#endif mov.l er0,@-sp mov.l @(4:16,sp),er0 mov.l er0,@__lastpc mov.l @sp+,er0 rte ; and return .section .bss .global CYG_LABEL_DEFN(_intvector)CYG_LABEL_DEFN(_intvector): .long 0 .global __lastpc __lastpc: .long 0__interrupt_table: .long 0 .text ##-----------------------------------------------------------------------------## Execute pending DSRs on the interrupt stack with interrupts enabled.## Note: this can only be called from code running on a thread stack #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK .extern CYG_LABEL_DEFN(cyg_interrupt_call_pending_DSRs) .global CYG_LABEL_DEFN(hal_interrupt_stack_call_pending_DSRs)CYG_LABEL_DEFN(hal_interrupt_stack_call_pending_DSRs): h8300_var_call_pending_DSR#endif ##-----------------------------------------------------------------------------## Default TRAP VSR .text .globl CYG_LABEL_DEFN(__default_trap_vsr)CYG_LABEL_DEFN(__default_trap_vsr):#ifdef CYG_HAL_DIAG_EXCPT_END hal_diag_excpt_start#endif mov.l @CYG_LABEL_DEFN(_intvector),er1 cmp.l #11,er1 ; Adjust trap entry address bne 1f h8300_trap_adjust_pc1: mov.l sp,er0 jsr @CYG_LABEL_DEFN(cyg_hal_exception_handler)#ifdef CYG_HAL_DIAG_EXCPT_END hal_diag_excpt_end#endif hal_cpu_load_all#ifdef CYGPKG_CYGMON hal_cygmon_restore_app_stack#endif rte##-----------------------------------------------------------------------------## VSR table. The VSRs pointed to by this table are called from the stubs## connected to the hardware.#ifndef CYG_HAL_H8300_VSR_TABLE_DEFINED .data .globl CYG_LABEL_DEFN(hal_vsr_table)CYG_LABEL_DEFN(hal_vsr_table): .long CYG_LABEL_DEFN(__default_trap_vsr) .long CYG_LABEL_DEFN(__default_trap_vsr) .long 0 .long 0 .long 0 .long CYG_LABEL_DEFN(__default_trap_vsr) .long CYG_LABEL_DEFN(__default_trap_vsr) .long CYG_LABEL_DEFN(__default_trap_vsr) .long CYG_LABEL_DEFN(__default_trap_vsr) .long CYG_LABEL_DEFN(__default_trap_vsr) .long CYG_LABEL_DEFN(__default_trap_vsr) .long CYG_LABEL_DEFN(__default_trap_vsr) .rept CYG_ISR_TABLE_SIZE-12 .long CYG_LABEL_DEFN(__default_interrupt_vsr) .endr#endif ##-----------------------------------------------------------------------------## Interrupt tables .data .extern CYG_LABEL_DEFN(hal_default_isr) .globl CYG_LABEL_DEFN(hal_interrupt_handlers)CYG_LABEL_DEFN(hal_interrupt_handlers): .rept CYG_ISR_TABLE_SIZE .long CYG_LABEL_DEFN(hal_default_isr) .endr .globl CYG_LABEL_DEFN(hal_interrupt_data)CYG_LABEL_DEFN(hal_interrupt_data): .rept CYG_ISR_TABLE_SIZE .long 0 .endr .globl CYG_LABEL_DEFN(hal_interrupt_objects)CYG_LABEL_DEFN(hal_interrupt_objects): .rept CYG_ISR_TABLE_SIZE .long 0 .endr ##-----------------------------------------------------------------------------## Temporary interrupt stack .section .bss .balign 2 .global _cyg_interrupt_stack_base_cyg_interrupt_stack_base:__interrupt_stack_base: .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE .byte 0 .endr .balign 2 .global _cyg_interrupt_stack_cyg_interrupt_stack:__interrupt_stack: #ifdef CYGPKG_CYGMON .balign 2 .global __cygmon_interrupt_stack_base__cygmon_interrupt_stack_base: .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE .byte 0 .endr .balign 2 .global __cygmon_interrupt_stack__cygmon_interrupt_stack:#endif .long 0,0,0,0,0,0,0,0 ##----------------------------------------------------------------------------- .data hal_diag_data##-----------------------------------------------------------------------------## end of vectors.S
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -