Paolo Bonzini <pbonz...@redhat.com> writes:

Thanks so much for looking at this patch.

> I'm a bit confused, why is it not using semihosting_get_chardev?  That
> would be
>
>       -chardev stdio,id=semihost
>       -semihosting-config on,chardev=semihost

Because I didn't realize the semihosting code already had a Chardev
option.  Thanks much for pointing it out. I've changed the code to use
the semihosting chardev instead of serial_hd(0). That change was quite
simple:

 void qemu_semihosting_console_init(void)
 {
-    if (semihosting_enabled()) {
-        qemu_chr_fe_init(&console.backend, serial_hd(0), &error_abort);
+    Chardev *chr = semihosting_get_chardev();
+
+    if  (chr) {
+        qemu_chr_fe_init(&console.backend, chr, &error_abort);
         qemu_chr_fe_set_handlers(&console.backend,
                                  console_can_read,
                                  console_read,

(I left the call to qemu_semihosting_console_init() late in the
initialization process so that the semihosting I/O ended up with the
stdio mux focus instead of the monitor)

Your example command line was really helpful in figuring out how to get
this to work. Here's the full command line I ended up using so that
semihost, serial and monitor are all muxed to stdio:

$ qemu-system-arm -chardev stdio,mux=on,id=stdio0 -serial chardev:stdio0 
-semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline 

It might be nice if this could be shortened, but it certainly provides
the necessary options to make it all work.

I'll post an updated version of the patch in a while, after waiting to
see if there are any additional comments.

-- 
-keith

Attachment: signature.asc
Description: PGP signature

Reply via email to