patch-2.1.30 linux/arch/sparc64/mm/extable.c

Next file: linux/arch/sparc64/mm/fault.c
Previous file: linux/arch/sparc64/lib/strncpy_from_user.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.29/linux/arch/sparc64/mm/extable.c linux/arch/sparc64/mm/extable.c
@@ -1,5 +1,5 @@
-/* $Id: extable.c,v 1.1 1996/12/26 10:24:24 davem Exp $
- * linux/arch/sparc/mm/extable.c
+/*
+ * linux/arch/sparc64/mm/extable.c
  */
 
 #include <linux/config.h>
@@ -31,12 +31,13 @@
                 else
                         last = mid-1;
         }
-        if (last->insn < value && !last->fixup && (last + 1)->insn > value) {
+        if (last->insn < value && !last->fixup && last[1].insn > value) {
         	*g2 = (value - last->insn)/4;
-        	return (last + 1)->fixup;
+        	return last[1].fixup;
         }
-        if (first > start && (first-1)->insn < value && !(first-1)->fixup && first->insn < value) {
-        	*g2 = (value - (first-1)->insn)/4;
+        if (first > start && first[-1].insn < value
+	    && !first[-1].fixup && first->insn < value) {
+        	*g2 = (value - first[-1].insn)/4;
         	return first->fixup;
         }
         return 0;
@@ -46,25 +47,23 @@
 search_exception_table(unsigned long addr, unsigned long *g2)
 {
 	unsigned long ret;
-#ifdef CONFIG_MODULES
-	struct module *mp;
-#endif
 
-	/* Search the kernel's table first.  */
+#ifndef CONFIG_MODULES
+	/* There is only the kernel to search.  */
 	ret = search_one_table(__start___ex_table,
 			       __stop___ex_table-1, addr, g2);
-	if (ret)
-		return ret;
-
-#ifdef CONFIG_MODULES
+	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->exceptinfo.start != NULL) {
-			ret = search_one_table(mp->exceptinfo.start,
-				mp->exceptinfo.stop-1, addr, g2);
-			if (ret)
-				return ret;
-		}
+		if (mp->ex_table_start == NULL)
+			continue;
+		ret = search_one_table(mp->ex_table_start,
+				       mp->ex_table_end-1, addr, g2);
+		if (ret) return ret;
 	}
 #endif
+
 	return 0;
 }

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen, [email protected]