1e839ca52SDavid Howells #ifndef __ASM_SH_TRAPS_32_H 2e839ca52SDavid Howells #define __ASM_SH_TRAPS_32_H 3e839ca52SDavid Howells 4e839ca52SDavid Howells #include <linux/types.h> 5e839ca52SDavid Howells #include <asm/mmu.h> 6e839ca52SDavid Howells 7e839ca52SDavid Howells #ifdef CONFIG_CPU_HAS_SR_RB 8e839ca52SDavid Howells #define lookup_exception_vector() \ 9e839ca52SDavid Howells ({ \ 10e839ca52SDavid Howells unsigned long _vec; \ 11e839ca52SDavid Howells \ 12e839ca52SDavid Howells __asm__ __volatile__ ( \ 13e839ca52SDavid Howells "stc r2_bank, %0\n\t" \ 14e839ca52SDavid Howells : "=r" (_vec) \ 15e839ca52SDavid Howells ); \ 16e839ca52SDavid Howells \ 17e839ca52SDavid Howells _vec; \ 18e839ca52SDavid Howells }) 19e839ca52SDavid Howells #else 20e839ca52SDavid Howells #define lookup_exception_vector() \ 21e839ca52SDavid Howells ({ \ 22e839ca52SDavid Howells unsigned long _vec; \ 23e839ca52SDavid Howells __asm__ __volatile__ ( \ 24e839ca52SDavid Howells "mov r4, %0\n\t" \ 25e839ca52SDavid Howells : "=r" (_vec) \ 26e839ca52SDavid Howells ); \ 27e839ca52SDavid Howells \ 28e839ca52SDavid Howells _vec; \ 29e839ca52SDavid Howells }) 30e839ca52SDavid Howells #endif 31e839ca52SDavid Howells 32e839ca52SDavid Howells static inline void trigger_address_error(void) 33e839ca52SDavid Howells { 34e839ca52SDavid Howells __asm__ __volatile__ ( 35e839ca52SDavid Howells "ldc %0, sr\n\t" 36e839ca52SDavid Howells "mov.l @%1, %0" 37e839ca52SDavid Howells : 38e839ca52SDavid Howells : "r" (0x10000000), "r" (0x80000001) 39e839ca52SDavid Howells ); 40e839ca52SDavid Howells } 41e839ca52SDavid Howells 42e839ca52SDavid Howells asmlinkage void do_address_error(struct pt_regs *regs, 43e839ca52SDavid Howells unsigned long writeaccess, 44e839ca52SDavid Howells unsigned long address); 45e839ca52SDavid Howells asmlinkage void do_divide_error(unsigned long r4, unsigned long r5, 46e839ca52SDavid Howells unsigned long r6, unsigned long r7, 47e839ca52SDavid Howells struct pt_regs __regs); 48e839ca52SDavid Howells asmlinkage void do_reserved_inst(unsigned long r4, unsigned long r5, 49e839ca52SDavid Howells unsigned long r6, unsigned long r7, 50e839ca52SDavid Howells struct pt_regs __regs); 51e839ca52SDavid Howells asmlinkage void do_illegal_slot_inst(unsigned long r4, unsigned long r5, 52e839ca52SDavid Howells unsigned long r6, unsigned long r7, 53e839ca52SDavid Howells struct pt_regs __regs); 54e839ca52SDavid Howells asmlinkage void do_exception_error(unsigned long r4, unsigned long r5, 55e839ca52SDavid Howells unsigned long r6, unsigned long r7, 56e839ca52SDavid Howells struct pt_regs __regs); 57e839ca52SDavid Howells 58e839ca52SDavid Howells #define BUILD_TRAP_HANDLER(name) \ 59e839ca52SDavid Howells asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \ 60e839ca52SDavid Howells unsigned long r6, unsigned long r7, \ 61e839ca52SDavid Howells struct pt_regs __regs) 62e839ca52SDavid Howells 63e839ca52SDavid Howells #define TRAP_HANDLER_DECL \ 64e839ca52SDavid Howells struct pt_regs *regs = RELOC_HIDE(&__regs, 0); \ 65e839ca52SDavid Howells unsigned int vec = regs->tra; \ 66e839ca52SDavid Howells (void)vec; 67e839ca52SDavid Howells 68e839ca52SDavid Howells #endif /* __ASM_SH_TRAPS_32_H */ 69