aboutsummaryrefslogtreecommitdiff
path: root/src/output.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-06-07 10:43:07 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-06-07 10:43:07 -0400
commit5c73240407f321312fc05a83fd246f47b0dbbbec (patch)
tree55fdb07b7162af431c861ddec917572114adb86a /src/output.c
parentc1adedc1c04b25fb14efa8bdbd614f3c31a14593 (diff)
downloadseabios-hppa-5c73240407f321312fc05a83fd246f47b0dbbbec.zip
seabios-hppa-5c73240407f321312fc05a83fd246f47b0dbbbec.tar.gz
seabios-hppa-5c73240407f321312fc05a83fd246f47b0dbbbec.tar.bz2
Serial debugging code must not access BDA.
Regular serial writing code uses the system timer to timeout failed writes - however, serial debugging can't rely on access to the BDA segment or the hardware timer. Therefore, implement a simple debug only serial writing function and separate it from the regular serial output code. Also include change to dump_regs - don't call __dprintf if debugging not on.
Diffstat (limited to 'src/output.c')
-rw-r--r--src/output.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/output.c b/src/output.c
index 1c3831d..054082f 100644
--- a/src/output.c
+++ b/src/output.c
@@ -10,6 +10,20 @@
#include "util.h" // printf
#include "biosvar.h" // struct bregs
+#define DEBUG_PORT 0x03f8
+#define DEBUG_TIMEOUT 100000
+
+static void
+debug_serial(char c)
+{
+ int timeout = DEBUG_TIMEOUT;
+ while ((inb(DEBUG_PORT+5) & 0x60) != 0x60)
+ if (!timeout--)
+ // Ran out of time.
+ return;
+ outb(c, DEBUG_PORT);
+}
+
static void
screenc(u8 c)
{
@@ -216,13 +230,13 @@ static void
dump_regs(const char *fname, const char *type, struct bregs *regs)
{
if (!regs) {
- __dprintf("%s %s: NULL\n", type, fname);
+ dprintf(1, "%s %s: NULL\n", type, fname);
return;
}
- __dprintf("%s %s: a=%x b=%x c=%x d=%x si=%x di=%x\n"
+ dprintf(1, "%s %s: a=%x b=%x c=%x d=%x si=%x di=%x\n"
, type, fname, regs->eax, regs->ebx, regs->ecx, regs->edx
, regs->esi, regs->edi);
- __dprintf(" ds=%x es=%x ip=%x cs=%x f=%x r=%p\n"
+ dprintf(1, " ds=%x es=%x ip=%x cs=%x f=%x r=%p\n"
, regs->ds, regs->es, regs->ip, regs->cs, regs->flags, regs);
}