Commit fc55402b authored by Max Filippov's avatar Max Filippov

xtensa: clean up exception handler prototypes

Exception handlers are currently passed as void pointers because they
may have one or two parameters. Only two handlers uses the second
parameter and it is available in the struct pt_regs anyway. Make all
handlers have only one parameter, introduce xtensa_exception_handler
type for handlers and use it in trap_set_handler.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent db0d07fa
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <asm/ptrace.h> #include <asm/ptrace.h>
typedef void xtensa_exception_handler(struct pt_regs *regs);
/* /*
* Per-CPU exception handling data structure. * Per-CPU exception handling data structure.
* EXCSAVE1 points to it. * EXCSAVE1 points to it.
...@@ -30,15 +32,11 @@ struct exc_table { ...@@ -30,15 +32,11 @@ struct exc_table {
/* Fast kernel exception handlers */ /* Fast kernel exception handlers */
void *fast_kernel_handler[EXCCAUSE_N]; void *fast_kernel_handler[EXCCAUSE_N];
/* Default C-Handlers */ /* Default C-Handlers */
void *default_handler[EXCCAUSE_N]; xtensa_exception_handler *default_handler[EXCCAUSE_N];
}; };
/* xtensa_exception_handler *
* handler must be either of the following: __init trap_set_handler(int cause, xtensa_exception_handler *handler);
* void (*)(struct pt_regs *regs);
* void (*)(struct pt_regs *regs, unsigned long exccause);
*/
extern void * __init trap_set_handler(int cause, void *handler);
asmlinkage void fast_illegal_instruction_user(void); asmlinkage void fast_illegal_instruction_user(void);
asmlinkage void fast_syscall_user(void); asmlinkage void fast_syscall_user(void);
...@@ -54,7 +52,7 @@ asmlinkage void system_call(struct pt_regs *regs); ...@@ -54,7 +52,7 @@ asmlinkage void system_call(struct pt_regs *regs);
void do_IRQ(int hwirq, struct pt_regs *regs); void do_IRQ(int hwirq, struct pt_regs *regs);
void do_page_fault(struct pt_regs *regs); void do_page_fault(struct pt_regs *regs);
void do_unhandled(struct pt_regs *regs, unsigned long exccause); void do_unhandled(struct pt_regs *regs);
/* Initialize minimal exc_table structure sufficient for basic paging */ /* Initialize minimal exc_table structure sufficient for basic paging */
static inline void __init early_trap_init(void) static inline void __init early_trap_init(void)
......
...@@ -40,14 +40,13 @@ static inline int probed_compare_swap(int *v, int cmp, int set) ...@@ -40,14 +40,13 @@ static inline int probed_compare_swap(int *v, int cmp, int set)
/* Handle probed exception */ /* Handle probed exception */
static void __init do_probed_exception(struct pt_regs *regs, static void __init do_probed_exception(struct pt_regs *regs)
unsigned long exccause)
{ {
if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */ if (regs->pc == rcw_probe_pc) { /* exception on s32c1i ? */
regs->pc += 3; /* skip the s32c1i instruction */ regs->pc += 3; /* skip the s32c1i instruction */
rcw_exc = exccause; rcw_exc = regs->exccause;
} else { } else {
do_unhandled(regs, exccause); do_unhandled(regs);
} }
} }
......
...@@ -170,7 +170,7 @@ __die_if_kernel(const char *str, struct pt_regs *regs, long err) ...@@ -170,7 +170,7 @@ __die_if_kernel(const char *str, struct pt_regs *regs, long err)
* Unhandled Exceptions. Kill user task or panic if in kernel space. * Unhandled Exceptions. Kill user task or panic if in kernel space.
*/ */
void do_unhandled(struct pt_regs *regs, unsigned long exccause) void do_unhandled(struct pt_regs *regs)
{ {
__die_if_kernel("Caught unhandled exception - should not happen", __die_if_kernel("Caught unhandled exception - should not happen",
regs, SIGKILL); regs, SIGKILL);
...@@ -180,7 +180,7 @@ void do_unhandled(struct pt_regs *regs, unsigned long exccause) ...@@ -180,7 +180,7 @@ void do_unhandled(struct pt_regs *regs, unsigned long exccause)
"(pid = %d, pc = %#010lx) - should not happen\n" "(pid = %d, pc = %#010lx) - should not happen\n"
"\tEXCCAUSE is %ld\n", "\tEXCCAUSE is %ld\n",
current->comm, task_pid_nr(current), regs->pc, current->comm, task_pid_nr(current), regs->pc,
exccause); regs->exccause);
force_sig(SIGILL); force_sig(SIGILL);
} }
...@@ -360,7 +360,8 @@ static void do_debug(struct pt_regs *regs) ...@@ -360,7 +360,8 @@ static void do_debug(struct pt_regs *regs)
/* Set exception C handler - for temporary use when probing exceptions */ /* Set exception C handler - for temporary use when probing exceptions */
void * __init trap_set_handler(int cause, void *handler) xtensa_exception_handler *
__init trap_set_handler(int cause, xtensa_exception_handler *handler)
{ {
void *previous = per_cpu(exc_table, 0).default_handler[cause]; void *previous = per_cpu(exc_table, 0).default_handler[cause];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment