diff options
author | Peter Pearse <peter.pearse@arm.com> | 2007-04-19 13:17:20 +0100 |
---|---|---|
committer | Peter Pearse <peter.pearse@arm.com> | 2007-04-19 13:17:20 +0100 |
commit | ee89bf2782406b1f87088b4764aeb6f811d82526 (patch) | |
tree | b144476f4b5e92a414efff165d214d34062d4365 /lib_ppc | |
parent | 9c00dfb0bf89c8c23e8af5b5bdf49cf66d769f85 (diff) | |
parent | 37837828d89084879bee2f2b8c7c68d4695940df (diff) | |
download | u-boot-imx-ee89bf2782406b1f87088b4764aeb6f811d82526.zip u-boot-imx-ee89bf2782406b1f87088b4764aeb6f811d82526.tar.gz u-boot-imx-ee89bf2782406b1f87088b4764aeb6f811d82526.tar.bz2 |
Merge with git://www.denx.de/git/u-boot.git
Diffstat (limited to 'lib_ppc')
-rw-r--r-- | lib_ppc/extable.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/lib_ppc/extable.c b/lib_ppc/extable.c index d92f142..fe856ff 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; @@ -55,10 +57,22 @@ search_one_table(const struct exception_table_entry *first, long diff; mid = (last - first) / 2 + first; - diff = mid->insn - value; - if (diff == 0) - return mid->fixup; - else if (diff < 0) + if (mid > CFG_MONITOR_BASE) { + /* exception occurs in FLASH, before u-boot relocation. + * No relocation offset is needed. + */ + diff = mid->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; + if (diff == 0) + return (mid->fixup + gd->reloc_off); + } + if (diff < 0) first = mid+1; else last = mid-1; @@ -75,8 +89,11 @@ 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 (ex_tab_message) printf("Bus Fault @ 0x%08lx, fixup 0x%08lx\n", addr, ret); +#endif if (ret) return ret; return 0; |