From: Kenn H. <ke...@us...> - 2003-08-02 23:47:43
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/mm In directory sc8-pr-cvs1:/tmp/cvs-serv7493/arch/vax/mm Modified Files: extable.c fault.c Log Message: 2.5.55 can have multiple exception tables and moves a lot of the functionality into the core Index: extable.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/mm/extable.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- extable.c 20 May 2002 00:33:34 -0000 1.4 +++ extable.c 2 Aug 2003 23:47:38 -0000 1.5 @@ -1,21 +1,19 @@ /* - * $Id$ + * linux/arch/vax/mm/extable.c * - * This file handles the exception tables created by the put_user() - * and get_user() macros. + * Copied verbatim from arch/x86_64/mm/extable.c */ #include <linux/config.h> #include <linux/module.h> +#include <linux/spinlock.h> #include <asm/uaccess.h> -extern const struct exception_table_entry __start___ex_table[]; -extern const struct exception_table_entry __stop___ex_table[]; - -static inline unsigned long -search_one_table(const struct exception_table_entry *first, - const struct exception_table_entry *last, - unsigned long value) +/* Simple binary search */ +const struct exception_table_entry * +search_extable(const struct exception_table_entry *first, + const struct exception_table_entry *last, + unsigned long value) { while (first <= last) { const struct exception_table_entry *mid; @@ -24,35 +22,11 @@ mid = (last - first) / 2 + first; diff = mid->insn - value; if (diff == 0) - return mid->fixup; + return mid; else if (diff < 0) first = mid+1; else last = mid-1; } - return 0; -} - -unsigned long -search_exception_table(unsigned long addr) -{ - unsigned long ret; - -#ifndef CONFIG_MODULES - /* There is only the kernel to search. */ - ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr); - if (ret) return ret; -#else - /* The kernel is the last "module" -- no need to treat it special. */ - struct module *mp; - for (mp = module_list; mp != NULL; mp = mp->next) { - if (mp->ex_table_start == NULL) - continue; - ret = search_one_table(mp->ex_table_start, - mp->ex_table_end - 1, addr); - if (ret) return ret; - } -#endif - - return 0; + return NULL; } Index: fault.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/mm/fault.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- fault.c 9 Feb 2003 01:31:34 -0000 1.5 +++ fault.c 2 Aug 2003 23:47:38 -0000 1.6 @@ -10,6 +10,7 @@ #include <linux/sched.h> #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/module.h> #include <asm/io.h> #include <asm/pgtable.h> @@ -57,7 +58,7 @@ struct vm_area_struct * vma; struct task_struct *tsk = current; struct mm_struct *mm = NULL; - unsigned fixup; + const struct exception_table_entry *fixup; #ifdef VAX_MM_DEBUG printk("mmfault: pid %d fault at %8x, pc %8x, psl %8x, reason %8x\n",current->pid,info->addr, info->pc, info->psl, info->reason); @@ -152,8 +153,8 @@ no_context: /* Are we prepared to handle this fault as an exception? */ - if ((fixup = search_exception_table(regs->pc)) != 0) { - regs->pc = fixup; + if ((fixup = search_exception_tables(regs->pc)) != NULL) { + regs->pc = fixup->fixup; return; } |