void cyg_hal_exception_handler(CYG_ADDRWORD vector, CYG_ADDRWORD data, CYG_ADDRWORD stackpointer ) { #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS // Set the pointer to the registers of the current exception // context. At entry the GDB stub will expand the // HAL_SavedRegisters structure into a (bigger) register array. _hal_registers = (HAL_SavedRegisters *)stackpointer; __handle_exception(); #elif defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && \ defined(CYGPKG_HAL_EXCEPTIONS) // We should decode the vector and pass a more appropriate // value as the second argument. For now we simply pass a // pointer to the saved registers. We should also divert // breakpoint and other debug vectors into the debug stubs. cyg_hal_deliver_exception( vector, stackpointer ); #else CYG_FAIL("Exception!!!"); #endif return; }
void exception_handler(HAL_SavedRegisters *regs) { #if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) // diag_printf("Exception! Frame: %x\n", regs); // show_regs(regs); static int gdb_active; if (gdb_active == 0) { gdb_active = 1; _hal_registers = regs; __handle_exception(); gdb_active = 0; } #elif defined(CYGPKG_KERNEL_EXCEPTIONS) // We should decode the vector and pass a more appropriate // value as the second argument. For now we simply pass a // pointer to the saved registers. We should also divert // breakpoint and other debug vectors into the debug stubs. cyg_hal_deliver_exception( regs->vector, (CYG_ADDRWORD)regs ); #else CYG_FAIL("Exception!!!"); #endif return; }
void hal_deliver_exception( HAL_SavedRegisters *regs ) { // Special case handler for code which has chosen to take care // of data exceptions (i.e. code which expects them to happen) // This is common in discovery code, e.g. checking for a particular // device which may generate an exception when probing if the // device is not present #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS if (__mem_fault_handler ) { regs->u.exception.pc = (unsigned long)__mem_fault_handler; return; // Caught an exception inside stubs } #endif #if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) _hal_registers = regs; __handle_exception(); #elif defined(CYGPKG_KERNEL_EXCEPTIONS) cyg_hal_deliver_exception( regs->u.exception.vector, (CYG_ADDRWORD)regs ); #else CYG_FAIL("Exception!!!"); #endif }
void exception_handler(HAL_SavedRegisters *regs) { // Special case handler for code which has chosen to take care // of data exceptions (i.e. code which expects them to happen) // This is common in discovery code, e.g. checking for a particular // device which may generate an exception when probing if the // device is not present #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS if (__mem_fault_handler && regs->vector == CYGNUM_HAL_EXCEPTION_DATA_ACCESS) { regs->pc = (unsigned long)__mem_fault_handler; return; // Caught an exception inside stubs } #endif #if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) && !defined(CYGPKG_CYGMON) if (++exception_level == 1) __take_over_debug_traps(); _hal_registers = regs; __handle_exception(); if (--exception_level == 0) __restore_debug_traps(); #elif defined(CYGPKG_KERNEL_EXCEPTIONS) // We should decode the vector and pass a more appropriate // value as the second argument. For now we simply pass a // pointer to the saved registers. We should also divert // breakpoint and other debug vectors into the debug stubs. cyg_hal_deliver_exception( regs->vector, (CYG_ADDRWORD)regs ); #else CYG_FAIL("Exception!!!"); #endif return; }