diff options
author | Stefan Roese <sr@denx.de> | 2007-07-04 08:11:37 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2007-07-04 08:11:37 +0200 |
commit | 8e990cb076a1c77daf3a50cc0df9732135e9eef5 (patch) | |
tree | 3b860d74bb4ddc5e0c9485e44da1bc0a08ed839c /lib_ppc/extable.c | |
parent | d677b32855f577ae2690dcd64a172cdd706e0ffc (diff) | |
parent | 98c440bee623ecdd5322852732b883e696fb2140 (diff) | |
download | u-boot-imx-8e990cb076a1c77daf3a50cc0df9732135e9eef5.zip u-boot-imx-8e990cb076a1c77daf3a50cc0df9732135e9eef5.tar.gz u-boot-imx-8e990cb076a1c77daf3a50cc0df9732135e9eef5.tar.bz2 |
Merge with git://www.denx.de/git/u-boot.git
Diffstat (limited to 'lib_ppc/extable.c')
-rw-r--r-- | lib_ppc/extable.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/lib_ppc/extable.c b/lib_ppc/extable.c index b14d661..8354411 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 > CFG_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; } |