patch-2.1.18 linux/arch/alpha/mm/extable.c

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

diff -u --recursive --new-file v2.1.17/linux/arch/alpha/mm/extable.c linux/arch/alpha/mm/extable.c
@@ -2,6 +2,8 @@
  * linux/arch/alpha/mm/extable.c
  */
 
+#include <linux/config.h>
+#include <linux/module.h>
 #include <asm/uaccess.h>
 
 extern const struct exception_table_entry __start___ex_table[];
@@ -10,8 +12,12 @@
 static inline unsigned
 search_one_table(const struct exception_table_entry *first,
 		 const struct exception_table_entry *last,
-		 signed int value)
+		 signed long value)
 {
+	/* Abort early if the search value is out of range.  */
+	if (value != (signed int)value)
+		return 0;
+
         while (first <= last) {
 		const struct exception_table_entry *mid;
 		long diff;
@@ -32,19 +38,24 @@
 search_exception_table(unsigned long addr)
 {
 	unsigned ret;
-	signed int reladdr;
 
-	/* Search the kernel's table first.  */
-	{
-		register unsigned long gp __asm__("$29");
-		reladdr = addr - gp;
+#ifndef CONFIG_MODULE
+	/* There is only the kernel to search.  */
+	register unsigned long gp __asm__("$29");
+	ret = search_one_table(__start___ex_table, __stop___ex_table - 1,
+			       addr - gp);
+	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 ; mp = mp->next) {
+		if (!mp->ex_table_start)
+			continue;
+		ret = search_one_table(mp->ex_table_start,
+				       mp->ex_table_end - 1, addr - mp->gp);
+		if (ret) return ret;
 	}
-	ret = search_one_table(__start___ex_table,
-			       __stop___ex_table-1, reladdr);
-	if (ret)
-		return ret;
-
-	/* FIXME -- search the module's tables here */
+#endif
 
 	return 0;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov