aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw/serialio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hw/serialio.c')
-rw-r--r--src/hw/serialio.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/hw/serialio.c b/src/hw/serialio.c
index 319a85c1..31633443 100644
--- a/src/hw/serialio.c
+++ b/src/hw/serialio.c
@@ -103,11 +103,23 @@ serial_debug_flush(void)
u16 DebugOutputPort VARFSEG = 0x402;
+void
+qemu_debug_preinit(void)
+{
+ /* Check if the QEMU debug output port is active */
+ if (CONFIG_DEBUG_IO &&
+ inb(GET_GLOBAL(DebugOutputPort)) != QEMU_DEBUGCON_READBACK)
+ DebugOutputPort = 0;
+}
+
// Write a character to the special debugging port.
void
qemu_debug_putc(char c)
{
- if (CONFIG_DEBUG_IO && runningOnQEMU())
+ if (!CONFIG_DEBUG_IO || !runningOnQEMU())
+ return;
+ u16 port = GET_GLOBAL(DebugOutputPort);
+ if (port)
// Send character to debug port.
- outb(c, GET_GLOBAL(DebugOutputPort));
+ outb(c, port);
}