X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=lib_ppc%2Fextable.c;h=2d995fa30a3a26178c369170844aaf25018eb98d;hb=27f33e9f45ef7f9685cbdc65066a1828e85dde4f;hp=fe856ffbb527a4e5dd62d1925d39f0fe14fc8ada;hpb=00b574bdc8c54dbc9e03f63c24f62955d483e3ef;p=u-boot diff --git a/lib_ppc/extable.c b/lib_ppc/extable.c index fe856ffbb5..2d995fa30a 100644 --- a/lib_ppc/extable.c +++ b/lib_ppc/extable.c @@ -52,30 +52,27 @@ search_one_table(const struct exception_table_entry *first, const struct exception_table_entry *last, unsigned long value) { - while (first <= last) { - const struct exception_table_entry *mid; - long diff; - - mid = (last - first) / 2 + first; - if (mid > CFG_MONITOR_BASE) { + long diff; + if ((ulong) first > CFG_MONITOR_BASE) { /* exception occurs in FLASH, before u-boot relocation. * No relocation offset is needed. */ - diff = mid->insn - value; + while (first <= last) { + diff = first->insn - value; if (diff == 0) - return mid->fixup; - } else { + return first->fixup; + first++; + } + } else { /* exception occurs in RAM, after u-boot relocation. * A relocation offset should be added. */ - diff = (mid->insn + gd->reloc_off) - value; + while (first <= last) { + diff = (first->insn + gd->reloc_off) - value; if (diff == 0) - return (mid->fixup + gd->reloc_off); + return (first->fixup + gd->reloc_off); + first++; } - if (diff < 0) - first = mid+1; - else - last = mid-1; } return 0; } @@ -92,7 +89,7 @@ search_exception_table(unsigned long addr) /* if the serial port does not hang in exception, printf can be used */ #if !defined(CFG_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;