summaryrefslogtreecommitdiffstats
path: root/vl.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2009-12-29 13:51:36 -0800
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-08 09:58:40 -0600
commitc9f398e53fedb88df243e32eb9bc50fda4ec44d0 (patch)
treeb88cd717c42f798322adab83febcb84722640e6d /vl.c
parent012f0879234b07ec6a35eb6ec3c9d19000643155 (diff)
downloadhqemu-c9f398e53fedb88df243e32eb9bc50fda4ec44d0.zip
hqemu-c9f398e53fedb88df243e32eb9bc50fda4ec44d0.tar.gz
debugcon: support for debugging consoles (e.g. Bochs port 0xe9)
Add generic support for debugging consoles (simple I/O ports which when written to cause debugging output to be written to a target.) The current implementation matches Bochs' port 0xe9, allowing the same debugging code to be used for both Bochs and Qemu. There is no vm state associated with the debugging port, simply because it has none -- the entire interface is a single, stateless, write-only port. Most of the code was cribbed from the serial port driver. v2: removed non-ISA variants (they can be introduced when/if someone wants them, using code from the serial port); added configurable readback (Bochs returns 0xe9 on a read from this register, mimic that by default) This retains the apparently somewhat controversial user friendly option, however. v3: reimplemented the user friendly option as a synthetic option ("-debugcon foo" basically ends up being a parser-level shorthand for "-chardev stdio,id=debugcon -device isa-debugcon,chardev=debugcon") -- this dramatically reduced the complexity while keeping the same level of user friendliness. v4: spaces, not tabs. v5: update to match current top of tree. Calling qemu_chr_open() already during parsing no longer works; defer until we are parsing the other console-like devices. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index e881e45..2b0b653 100644
--- a/vl.c
+++ b/vl.c
@@ -4748,6 +4748,7 @@ struct device_config {
DEV_SERIAL, /* -serial */
DEV_PARALLEL, /* -parallel */
DEV_VIRTCON, /* -virtioconsole */
+ DEV_DEBUGCON, /* -debugcon */
} type;
const char *cmdline;
QTAILQ_ENTRY(device_config) next;
@@ -4845,6 +4846,23 @@ static int virtcon_parse(const char *devname)
return 0;
}
+static int debugcon_parse(const char *devname)
+{
+ QemuOpts *opts;
+
+ if (!qemu_chr_open("debugcon", devname, NULL)) {
+ exit(1);
+ }
+ opts = qemu_opts_create(&qemu_device_opts, "debugcon", 1);
+ if (!opts) {
+ fprintf(stderr, "qemu: already have a debugcon device\n");
+ exit(1);
+ }
+ qemu_opt_set(opts, "driver", "isa-debugcon");
+ qemu_opt_set(opts, "chardev", "debugcon");
+ return 0;
+}
+
int main(int argc, char **argv, char **envp)
{
const char *gdbstub_dev = NULL;
@@ -5390,6 +5408,9 @@ int main(int argc, char **argv, char **envp)
add_device_config(DEV_PARALLEL, optarg);
default_parallel = 0;
break;
+ case QEMU_OPTION_debugcon:
+ add_device_config(DEV_DEBUGCON, optarg);
+ break;
case QEMU_OPTION_loadvm:
loadvm = optarg;
break;
@@ -5927,6 +5948,8 @@ int main(int argc, char **argv, char **envp)
exit(1);
if (foreach_device_config(DEV_VIRTCON, virtcon_parse) < 0)
exit(1);
+ if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
+ exit(1);
module_call_init(MODULE_INIT_DEVICE);
OpenPOWER on IntegriCloud