=================================================================== RCS file: /cvs/prex-old/boot/common/debug.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- prex-old/boot/common/debug.c 2008/06/03 10:38:40 1.1.1.1 +++ prex-old/boot/common/debug.c 2008/08/13 17:12:20 1.1.1.1.2.1 @@ -30,20 +30,19 @@ /* * debug.c - loader debug functions */ + #include #include #include -#undef printk - +#ifdef DEBUG /* - * printk - print formated string + * printf - print formated string */ void -printk(const char *fmt, ...) +printf(const char *fmt, ...) { -#ifdef DEBUG - static const char digits[16] = "0123456789abcdef"; + static const char digits[] = "0123456789abcdef"; va_list ap; char buf[10]; char *s; @@ -56,11 +55,15 @@ c = *fmt++; switch (c) { case 'c': - putc(va_arg(ap, int)); + putchar(va_arg(ap, int)); continue; case 's': - for (s = va_arg(ap, char *); *s; s++) - putc((int)*s); + s = va_arg(ap, char *); + if (s == NULL) + s = ""; + for (; *s; s++) { + putchar((int)*s); + } continue; case 'u': case 'x': @@ -71,15 +74,15 @@ *s++ = digits[u % r]; while (u /= r); while (--s >= buf) - putc((int)*s); + putchar((int)*s); continue; } } - putc((int)c); + putchar((int)c); } va_end(ap); -#endif /* DEBUG */ } +#endif /* DEBUG */ /* * Show error and hang up. @@ -88,6 +91,9 @@ panic(const char *msg) { - printk("Panic: %s\n", msg); - for (;;); +#ifdef DEBUG + printf("Panic: %s\n", msg); +#endif + machine_panic(); + /* NOTREACHED */ }