module: trim exception table on init free.
[pandora-kernel.git] / arch / alpha / mm / extable.c
index 62dc379..813c9b6 100644 (file)
@@ -48,6 +48,27 @@ void sort_extable(struct exception_table_entry *start,
             cmp_ex, swap_ex);
 }
 
+#ifdef CONFIG_MODULES
+/*
+ * Any entry referring to the module init will be at the beginning or
+ * the end.
+ */
+void trim_init_extable(struct module *m)
+{
+       /*trim the beginning*/
+       while (m->num_exentries &&
+              within_module_init(ex_to_addr(&m->extable[0]), m)) {
+               m->extable++;
+               m->num_exentries--;
+       }
+       /*trim the end*/
+       while (m->num_exentries &&
+              within_module_init(ex_to_addr(&m->extable[m->num_exentries-1]),
+                                 m))
+               m->num_exentries--;
+}
+#endif /* CONFIG_MODULES */
+
 const struct exception_table_entry *
 search_extable(const struct exception_table_entry *first,
               const struct exception_table_entry *last,