From: Jan Kiszka <jan.kiszka@siemens.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] monitor: Add port write command
Date: Tue, 14 Jul 2009 10:20:11 +0200 [thread overview]
Message-ID: <4A5C3FBB.10306@siemens.com> (raw)
Useful for testing hardware emulations or manipulating its state to
stress guest drivers.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
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)" },
next reply other threads:[~2009-07-14 8:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 8:20 Jan Kiszka [this message]
2009-07-14 15:06 ` [Qemu-devel] [PATCH] monitor: Add port write command Anthony Liguori
[not found] ` <m31voj47ht.fsf@neno.mitica>
2009-07-14 15:49 ` [Qemu-devel] " Anthony Liguori
2009-07-14 18:57 ` [Qemu-devel] " Blue Swirl
2009-07-14 19:30 ` Paul Brook
2009-07-14 20:03 ` Anthony Liguori
2009-07-14 20:37 ` [Qemu-devel] " Jan Kiszka
2009-07-15 7:34 ` [Qemu-devel] " Gleb Natapov
2009-07-15 10:14 ` Paul Brook
2009-07-15 10:40 ` Jan Kiszka
2009-07-15 11:14 ` Gleb Natapov
2009-07-15 11:12 ` Gleb Natapov
2009-07-15 12:36 ` Anthony Liguori
2009-07-15 14:38 ` Paul Brook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A5C3FBB.10306@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.