]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] x86_64 extable fixes
authorAndi Kleen <ak@muc.de>
Tue, 7 Jan 2003 02:40:58 +0000 (18:40 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 7 Jan 2003 02:40:58 +0000 (18:40 -0800)
Make x86-64 compile again after recent extable changes.

arch/x86_64/kernel/setup.c
arch/x86_64/kernel/traps.c
arch/x86_64/mm/extable.c
arch/x86_64/mm/fault.c
include/asm-x86_64/uaccess.h

index 7dfbe5da06ee056b1fc7115aa01470cb2a4fda24..255d7a1a69523dbc77db3490ceda75cf29e22282 100644 (file)
@@ -384,8 +384,6 @@ void __init setup_arch(char **cmdline_p)
        conswitchp = &dummy_con;
 #endif
 #endif
-
-       exception_table_check(); 
 }
 
 #ifndef CONFIG_X86_TSC
index af118388f169c3267018455595c2923e6c5d8e7e..8741e6ccc12689c7c4cd4af7544f9ee2a3ecdc25 100644 (file)
@@ -397,7 +397,8 @@ static void do_trap(int trapnr, int signr, char *str,
 
        /* kernel trap */ 
        {            
-               unsigned long fixup = search_exception_table(regs->rip);
+               const struct exception_table_entry *fixup;
+               fixup = search_exception_tables(regs->rip);
                if (fixup) {
                        extern int exception_trace; 
                        if (exception_trace)
@@ -405,7 +406,7 @@ static void do_trap(int trapnr, int signr, char *str,
                     "%s: fixed kernel exception at %lx err:%ld\n",
                     current->comm, regs->rip, error_code);
                
-                       regs->rip = fixup;
+                       regs->rip = fixup->fixup;
                } else  
                        die(str, regs, error_code);
                return;
@@ -449,8 +450,6 @@ asmlinkage void do_int3(struct pt_regs * regs, long error_code)
        do_trap(3, SIGTRAP, "int3", regs, error_code, NULL);
 }
 
-extern void dump_pagetable(unsigned long);
-
 asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
 {
 #ifdef CONFIG_CHECKING
@@ -479,13 +478,12 @@ asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
 
        /* kernel gp */
        {
-               unsigned long fixup;
-               fixup = search_exception_table(regs->rip);
+               const struct exception_table_entry *fixup;
+               fixup = search_exception_tables(regs->rip);
                if (fixup) {
-                       regs->rip = fixup;
+                       regs->rip = fixup->fixup;
                        return;
                }
-//             dump_pagetable(regs->rip); 
                die("general protection fault", regs, error_code);
        }
 }
index 710426864f3bb36d95ccd491e43dfebdb9a42947..ab350121aab64044fc0dff6c071e71b9dff9c5b9 100644 (file)
@@ -6,32 +6,12 @@
 #include <linux/module.h>
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
-#include <linux/init.h>
 
-extern const struct exception_table_entry __start___ex_table[];
-extern const struct exception_table_entry __stop___ex_table[];
-
-
-void __init exception_table_check(void)
-{ 
-       const struct exception_table_entry *e;
-       unsigned long prev;
-
-       prev = 0;
-       for (e = __start___ex_table; e < __stop___ex_table; e++) {              
-               if (e->insn < prev) {
-                       panic("unordered exception table at %016lx:%016lx and %016lx:%016lx\n",
-                                  prev, e[-1].fixup, 
-                              e->insn, e->fixup);
-               }                       
-               prev = e->insn;
-       } 
-} 
-
-static 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;
@@ -40,42 +20,11 @@ search_one_table(const struct exception_table_entry *first,
                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;
-}
-
-extern spinlock_t modlist_lock;
-
-unsigned long
-search_exception_table(unsigned long addr)
-{
-       unsigned long ret = 0;
-       unsigned long flags;
-
-#ifndef CONFIG_MODULES
-       /* There is only the kernel to search.  */
-       return search_one_table(__start___ex_table, __stop___ex_table-1, addr);
-#else
-       /* The kernel is the last "module" -- no need to treat it special.  */
-       struct list_head *i;
-
-       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
+        return NULL;
 }
index 00708d1d82e3dcf831e6c29607cd3c31caf115ec..c662d6726339be8d75bea7f33e6dcffe9d969e88 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/tty.h>
 #include <linux/vt_kern.h>             /* For unblank_screen() */
 #include <linux/compiler.h>
+#include <linux/module.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -101,7 +102,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code)
        struct mm_struct *mm;
        struct vm_area_struct * vma;
        unsigned long address;
-       unsigned long fixup;
+       const struct exception_table_entry *fixup;
        int write;
        siginfo_t info;
 
@@ -239,8 +240,9 @@ bad_area_nosemaphore:
 no_context:
        
        /* Are we prepared to handle this kernel fault?  */
-       if ((fixup = search_exception_table(regs->rip)) != 0) {
-               regs->rip = fixup;
+       fixup = search_exception_tables(regs->rip);
+       if (fixup) {
+               regs->rip = fixup->fixup;
                if (0 && exception_trace) 
                printk(KERN_ERR 
                       "%s: fixed kernel exception at %lx address %lx err:%ld\n", 
index 47e78d59e27bcbe4eff77fc9f948b3a35dc5252e..c18c2d6a77b2082061cb6559855a9f516d6bb6d0 100644 (file)
@@ -71,9 +71,6 @@ struct exception_table_entry
        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