]> git.sur5r.net Git - u-boot/blobdiff - lib_ppc/extable.c
fix cmd_bdinfo.c:354: warning: 'print_eth' defined but not used
[u-boot] / lib_ppc / extable.c
index 2f90df0be89b93ccf36ed00cc0e7ab2d4396a073..7408d5c96946acff06b7f49098dac6c113d0bba3 100644 (file)
@@ -37,6 +37,8 @@
  * on our cache or tlb entries.
  */
 
+DECLARE_GLOBAL_DATA_PTR;
+
 struct exception_table_entry
 {
        unsigned long insn, fixup;
@@ -50,20 +52,15 @@ 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;
+       long diff;
+       while (first <= last) {
+               diff = first->insn - value;
+               if (diff == 0)
+                       return first->fixup;
+               first++;
+       }
 
-               mid = (last - first) / 2 + first;
-               diff = mid->insn - value;
-                if (diff == 0)
-                        return mid->fixup;
-                else if (diff < 0)
-                        first = mid+1;
-                else
-                        last = mid-1;
-        }
-        return 0;
+       return 0;
 }
 
 int    ex_tab_message = 1;
@@ -75,8 +72,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(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;
 
        return 0;