Patchwork [1/2] pc: improve onboard I/O port debugging

login
register
mail settings
Submitter Blue Swirl
Date May 15, 2010, 9:50 a.m.
Message ID <AANLkTimUpFhHAWmEYU75sGWfldzFptqNbUshgr7MuD6K@mail.gmail.com>
Download mbox | patch
Permalink /patch/52702/
State New
Headers show

Comments

Blue Swirl - May 15, 2010, 9:50 a.m.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/pc.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/pc.c b/hw/pc.c
index db2b9a2..938b2e0 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -51,6 +51,16 @@ 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS

+/* debug board I/O ports */
+//#define DEBUG_IOPORTS
+
+#ifdef DEBUG_IOPORTS
+#define DPRINTF_IO(fmt, ...)                                       \
+    do { printf("IOPORT: " fmt , ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF_IO(fmt, ...)
+#endif
+
 #define BIOS_FILENAME "bios.bin"

 #define PC_MAX_BIOS_SIZE (4 * 1024 * 1024)
@@ -103,6 +113,7 @@  static void isa_irq_handler(void *opaque, int n, int level)

 static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
 {
+    DPRINTF_IO("write addr %x data %x\n", addr, data);
 }

 /* MSDOS compatibility mode FPU exception support */
@@ -384,13 +395,18 @@  int ioport_get_a20(void)

 static void ioport92_write(void *opaque, uint32_t addr, uint32_t val)
 {
+    DPRINTF_IO("write addr %x data %x\n", addr, val);
     ioport_set_a20((val >> 1) & 1);
     /* XXX: bit 0 is fast reset */
 }

 static uint32_t ioport92_read(void *opaque, uint32_t addr)
 {
-    return ioport_get_a20() << 1;
+    uint32_t ret;
+
+    ret = ioport_get_a20() << 1;
+    DPRINTF_IO("read addr %x data %x\n", addr, ret);
+    return ret;
 }

 /***********************************************************/