From 5a4f7c66be981c6b5f44a4d66a14ea6ac9b7b6b0 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 20 Nov 2007 18:08:06 +0900 Subject: sh: Share bug/debug traps across _32 and _64. Signed-off-by: Paul Mundt --- include/asm-sh/ptrace.h | 2 +- include/asm-sh/system.h | 25 +++++++++++++++++++------ include/asm-sh/types.h | 6 ++++++ 3 files changed, 26 insertions(+), 7 deletions(-) (limited to 'include/asm-sh') diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h index a83a7b45ba6f..8d6c92b3e770 100644 --- a/include/asm-sh/ptrace.h +++ b/include/asm-sh/ptrace.h @@ -95,7 +95,7 @@ struct pt_dspregs { #include #define user_mode(regs) (((regs)->sr & 0x40000000)==0) -#define instruction_pointer(regs) ((regs)->pc) +#define instruction_pointer(regs) ((unsigned long)(regs)->pc) extern void show_regs(struct pt_regs *); diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h index 0cfa96aa5844..6b02dfd587ea 100644 --- a/include/asm-sh/system.h +++ b/include/asm-sh/system.h @@ -185,12 +185,25 @@ void default_idle(void); void per_cpu_trap_init(void); asmlinkage void break_point_trap(void); -asmlinkage void debug_trap_handler(unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7, - struct pt_regs __regs); -asmlinkage void bug_trap_handler(unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7, - struct pt_regs __regs); + +#ifdef CONFIG_SUPERH32 +#define BUILD_TRAP_HANDLER(name) \ +asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \ + unsigned long r6, unsigned long r7, \ + struct pt_regs __regs) + +#define TRAP_HANDLER_DECL \ + struct pt_regs *regs = RELOC_HIDE(&__regs, 0); \ + unsigned int vec = regs->tra; +#else +#define BUILD_TRAP_HANDLER(name) \ +asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs) +#define TRAP_HANDLER_DECL +#endif + +BUILD_TRAP_HANDLER(address_error); +BUILD_TRAP_HANDLER(debug); +BUILD_TRAP_HANDLER(bug); #define arch_align_stack(x) (x) diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h index 7ba69d9707ef..a6e1d4126e67 100644 --- a/include/asm-sh/types.h +++ b/include/asm-sh/types.h @@ -52,6 +52,12 @@ typedef unsigned long long u64; typedef u32 dma_addr_t; +#ifdef CONFIG_SUPERH32 +typedef u16 opcode_t; +#else +typedef u32 opcode_t; +#endif + #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ -- cgit v1.2.3