X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=lib%2Fextable.c;h=4cac81ec225e09af4cfd69c36d63a574a8418110;hb=b855192c08fcb14adbc5d3a7cab182022d433cca;hp=179c0874559569bf2626cbfc70bfcfef09474097;hpb=26b6f2236615649a0ae6a0de2e9e71a2f9ffeba7;p=mv-sheeva.git diff --git a/lib/extable.c b/lib/extable.c index 179c0874559..4cac81ec225 100644 --- a/lib/extable.c +++ b/lib/extable.c @@ -39,7 +39,26 @@ void sort_extable(struct exception_table_entry *start, sort(start, finish - start, sizeof(struct exception_table_entry), cmp_ex, NULL); } -#endif + +#ifdef CONFIG_MODULES +/* + * If the exception table is sorted, any 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(m->extable[0].insn, m)) { + m->extable++; + m->num_exentries--; + } + /*trim the end*/ + while (m->num_exentries && + within_module_init(m->extable[m->num_exentries-1].insn, m)) + m->num_exentries--; +} +#endif /* CONFIG_MODULES */ +#endif /* !ARCH_HAS_SORT_EXTABLE */ #ifndef ARCH_HAS_SEARCH_EXTABLE /*