X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=lib_ppc%2Fextable.c;h=91e2b3d246186d56466781e09e4da462bac43dc9;hb=ef339cc2b68e4cbef3f9376a45315e1b974bbd8d;hp=b14d661bbea885ff1d24925aeb3686fbc84a451c;hpb=19bf91f9628f80a55d4f171df71041574882b3d6;p=oweals%2Fu-boot.git diff --git a/lib_ppc/extable.c b/lib_ppc/extable.c index b14d661bbe..91e2b3d246 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 ((ulong) mid > CFG_MONITOR_BASE) { - /* exception occurs in FLASH, before u-boot relocation. - * No relocation offset is needed. - */ - diff = mid->insn - value; + long diff; + if ((ulong) first > CONFIG_SYS_MONITOR_BASE) { + /* exception occurs in FLASH, before u-boot relocation. + * No relocation offset is needed. + */ + while (first <= last) { + diff = first->insn - value; if (diff == 0) - return mid->fixup; - } else { - /* exception occurs in RAM, after u-boot relocation. - * A relocation offset should be added. - */ - diff = (mid->insn + gd->reloc_off) - value; + return first->fixup; + first++; + } + } else { + /* exception occurs in RAM, after u-boot relocation. + * A relocation offset should be added. + */ + 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; } @@ -90,9 +87,9 @@ 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 the serial port does not hang in exception, printf can be used */ -#if !defined(CFG_SERIAL_HANG_IN_EXCEPTION) +#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;