*/
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
#define BOOTFLAG_WARM 0x02 /* Software reboot */
-#define CFG_EXCEPTION_AFTER_RELOCATE
#define CFG_SERIAL_HANG_IN_EXCEPTION
#endif /* __CONFIG_H */
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;
/* 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);