qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] monitor: Add port write command


From: Jan Kiszka
Subject: [Qemu-devel] [PATCH] monitor: Add port write command
Date: Tue, 14 Jul 2009 10:20:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

Useful for testing hardware emulations or manipulating its state to
stress guest drivers.

Signed-off-by: Jan Kiszka <address@hidden>
---

 monitor.c       |   19 +++++++++++++++++++
 qemu-monitor.hx |    5 +++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/monitor.c b/monitor.c
index 342af32..2ddca95 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1185,6 +1185,25 @@ static void do_ioport_read(Monitor *mon, int count, int 
format, int size,
                    suffix, addr, size * 2, val);
 }
 
+static void do_ioport_write(Monitor *mon, int count, int format, int size,
+                            int addr, int val)
+{
+    addr &= IOPORTS_MASK;
+
+    switch (size) {
+    default:
+    case 1:
+        cpu_outb(NULL, addr, val);
+        break;
+    case 2:
+        cpu_outw(NULL, addr, val);
+        break;
+    case 4:
+        cpu_outl(NULL, addr, val);
+        break;
+    }
+}
+
 /* boot_set handler */
 static QEMUBootSetHandler *qemu_boot_set_handler = NULL;
 static void *boot_opaque;
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index 62edbcd..70e2475 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -306,6 +306,11 @@ STEXI
 Read I/O port.
 ETEXI
 
+    { "o", "/ii", do_ioport_write,
+      "/fmt addr value", "I/O port write" },
+STEXI
+Write to I/O port.
+ETEXI
 
     { "sendkey", "si?", do_sendkey,
       "keys [hold_ms]", "send keys to the VM (e.g. 'sendkey ctrl-alt-f1', 
default hold time=100 ms)" },




reply via email to

[Prev in Thread] Current Thread [Next in Thread]