Commit 9a5a65eb authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k exception table updates

M68k exception table updates to compensate for changes in 2.5.55
parent 4c942d72
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
extern const struct exception_table_entry __start___ex_table[]; extern const struct exception_table_entry __start___ex_table[];
extern const struct exception_table_entry __stop___ex_table[]; extern const struct exception_table_entry __stop___ex_table[];
static inline unsigned long /* Simple binary search */
search_one_table(const struct exception_table_entry *first, const struct exception_table_entry *
const struct exception_table_entry *last, search_extable(const struct exception_table_entry *first,
unsigned long value) const struct exception_table_entry *last,
unsigned long value)
{ {
while (first <= last) { while (first <= last) {
const struct exception_table_entry *mid; const struct exception_table_entry *mid;
...@@ -21,41 +22,12 @@ search_one_table(const struct exception_table_entry *first, ...@@ -21,41 +22,12 @@ search_one_table(const struct exception_table_entry *first,
mid = (last - first) / 2 + first; mid = (last - first) / 2 + first;
diff = value - mid->insn; diff = value - mid->insn;
if (diff >= 0 && diff <= 2) if (diff >= 0 && diff <= 2)
return mid->fixup; return mid;
else if (diff > 0) else if (diff > 0)
first = mid+1; first = mid+1;
else else
last = mid-1; last = mid-1;
} }
return 0; return NULL;
} }
unsigned long
search_exception_table(unsigned long addr)
{
unsigned long ret = 0;
#ifndef CONFIG_MODULES
/* There is only the kernel to search. */
ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
return ret;
#else
unsigned long flags;
struct list_head *i;
/* The kernel is the last "module" -- no need to treat it special. */
spin_lock_irqsave(&modlist_lock, flags);
list_for_each(i, &extables) {
struct exception_table *ex
= list_entry(i, struct exception_table, list);
if (ex->num_entries == 0)
continue;
ret = search_one_table(ex->entry,
ex->entry + ex->num_entries - 1, addr);
if (ret)
break;
}
spin_unlock_irqrestore(&modlist_lock, flags);
return ret;
#endif
}
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/module.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/traps.h> #include <asm/traps.h>
...@@ -34,10 +35,10 @@ int send_fault_sig(struct pt_regs *regs) ...@@ -34,10 +35,10 @@ int send_fault_sig(struct pt_regs *regs)
force_sig_info(siginfo.si_signo, force_sig_info(siginfo.si_signo,
&siginfo, current); &siginfo, current);
} else { } else {
unsigned long fixup; const struct exception_table_entry *fixup;
/* Are we prepared to handle this kernel fault? */ /* Are we prepared to handle this kernel fault? */
if ((fixup = search_exception_table(regs->pc))) { if ((fixup = search_exception_tables(regs->pc))) {
struct pt_regs *tregs; struct pt_regs *tregs;
/* Create a new four word stack frame, discarding the old /* Create a new four word stack frame, discarding the old
one. */ one. */
...@@ -45,7 +46,7 @@ int send_fault_sig(struct pt_regs *regs) ...@@ -45,7 +46,7 @@ int send_fault_sig(struct pt_regs *regs)
tregs = (struct pt_regs *)((ulong)regs + regs->stkadj); tregs = (struct pt_regs *)((ulong)regs + regs->stkadj);
tregs->vector = regs->vector; tregs->vector = regs->vector;
tregs->format = 0; tregs->format = 0;
tregs->pc = fixup; tregs->pc = fixup->fixup;
tregs->sr = regs->sr; tregs->sr = regs->sr;
return -1; return -1;
} }
......
...@@ -37,9 +37,6 @@ struct exception_table_entry ...@@ -37,9 +37,6 @@ struct exception_table_entry
unsigned long insn, fixup; unsigned long insn, fixup;
}; };
/* Returns 0 if exception not found and fixup otherwise. */
extern unsigned long search_exception_table(unsigned long);
/* /*
* These are the main single-value transfer routines. They automatically * These are the main single-value transfer routines. They automatically
......
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