summaryrefslogtreecommitdiff
path: root/lib_ppc/extable.c
diff options
context:
space:
mode:
authorroy zang <tie-fei.zang@freescale.com>2006-12-01 19:01:25 +0800
committerZang Tiefei <roy@bus.ap.freescale.net>2006-12-01 19:01:25 +0800
commitc9c1eeed7dd193fa65fb194654132040d49d4d3a (patch)
treefa1dda96eb652eeb59f54a8e49c54b73f3e9476c /lib_ppc/extable.c
parente0b369e4f71b11dd5716903dd6258028cf07e6e8 (diff)
downloadu-boot-imx-c9c1eeed7dd193fa65fb194654132040d49d4d3a.zip
u-boot-imx-c9c1eeed7dd193fa65fb194654132040d49d4d3a.tar.gz
u-boot-imx-c9c1eeed7dd193fa65fb194654132040d49d4d3a.tar.bz2
Fix the exception occuring in RAM table search issue.
The original search_one_table() function code can only processes the search for the exception occurring in FLASH/ROM, because the exception and fixup table usually locate in FLASH. If the exception address is also in FLASH, it will be OK. If the exception occurs in RAM, after the u-boot relocation, a relocation offset should be added. clean up the code in cpu/74xx_7xx/cpu.c Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
Diffstat (limited to 'lib_ppc/extable.c')
-rw-r--r--lib_ppc/extable.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib_ppc/extable.c b/lib_ppc/extable.c
index 34b5d46..623b5f1 100644
--- a/lib_ppc/extable.c
+++ b/lib_ppc/extable.c
@@ -57,16 +57,22 @@ search_one_table(const struct exception_table_entry *first,
long diff;
mid = (last - first) / 2 + first;
-#ifdef CFG_EXCEPTION_AFTER_RELOCATE
- diff = (mid->insn + gd->reloc_off) - 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)
+ 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;
@@ -83,6 +89,7 @@ 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);