X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=lib_ppc%2Fextable.c;h=7408d5c96946acff06b7f49098dac6c113d0bba3;hb=116095eb1f0f7017ea8062aa8a8ba8ceecb430b5;hp=34b5d460cf54c1318d3676b987d00d0235c58a77;hpb=e0b369e4f71b11dd5716903dd6258028cf07e6e8;p=u-boot diff --git a/lib_ppc/extable.c b/lib_ppc/extable.c index 34b5d460cf..7408d5c969 100644 --- a/lib_ppc/extable.c +++ b/lib_ppc/extable.c @@ -37,6 +37,8 @@ * on our cache or tlb entries. */ +DECLARE_GLOBAL_DATA_PTR; + struct exception_table_entry { unsigned long insn, fixup; @@ -50,27 +52,14 @@ search_one_table(const struct exception_table_entry *first, const struct exception_table_entry *last, unsigned long value) { - DECLARE_GLOBAL_DATA_PTR; - + long diff; while (first <= last) { - const struct exception_table_entry *mid; - long diff; - - mid = (last - first) / 2 + first; -#ifdef CFG_EXCEPTION_AFTER_RELOCATE - diff = (mid->insn + gd->reloc_off) - value; + diff = first->insn - value; if (diff == 0) - return (mid->fixup + gd->reloc_off); -#else - diff = mid->insn - value; - if (diff == 0) - return mid->fixup; -#endif - else if (diff < 0) - first = mid+1; - else - last = mid-1; + return first->fixup; + first++; } + return 0; } @@ -83,9 +72,10 @@ search_exception_table(unsigned long addr) /* There is only the kernel to search. */ ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr); -#if !defined(CFG_SERIAL_HANG_IN_EXCEPTION) + /* if the serial port does not hang in exception, printf can be used */ +#if !defined(CONFIG_SYS_SERIAL_HANG_IN_EXCEPTION) if (ex_tab_message) - printf("Bus Fault @ 0x%08lx, fixup 0x%08lx\n", addr, ret); + debug("Bus Fault @ 0x%08lx, fixup 0x%08lx\n", addr, ret); #endif if (ret) return ret;