From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Fred Konrad <konrad@adacore.com>,
QEMU Developers <qemu-devel@nongnu.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [RFC] some semihosting interrogation
Date: Thu, 28 May 2020 14:00:11 +0200 [thread overview]
Message-ID: <8771e99e-764b-52aa-55c4-a528d0804a34@redhat.com> (raw)
In-Reply-To: <141c5b32-31cd-1a1d-b1aa-692b9002dac9@adacore.com>
Hi Fred,
On 5/28/20 11:44 AM, Fred Konrad wrote:
> Hi all,
>
> Just wonderring if there is any reason not to be able to defer
> qemu_semihosting_connect_chardevs a little more to be able to specify
> chardev=serial0?
>
> Like:
>
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 6390cf0..9fa1553 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -4333,8 +4333,6 @@ void qemu_init(int argc, char **argv, char **envp)
>
> qemu_opts_foreach(qemu_find_opts("chardev"),
> chardev_init_func, NULL, &error_fatal);
> - /* now chardevs have been created we may have semihosting to
> connect */
> - qemu_semihosting_connect_chardevs();
>
> #ifdef CONFIG_VIRTFS
> qemu_opts_foreach(qemu_find_opts("fsdev"),
> @@ -4484,6 +4482,9 @@ void qemu_init(int argc, char **argv, char **envp)
> if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
> exit(1);
>
> + /* now chardevs have been created we may have semihosting to
> connect */
> + qemu_semihosting_connect_chardevs();
Cc'ing Markus for this part because he had headaches recently moving
things around there; but the change looks.
> +
> /* If no default VGA is requested, the default is "none". */
> if (default_vga) {
> vga_model = get_default_vga_model(machine_class);
>
> Also I found out that the trailing \0 is sent to the chardev
> (console.c:copy_user_string) is that expected in case of semihosting?
No, your patch fixes a bug.
>
> static GString *copy_user_string(CPUArchState *env, target_ulong addr)
> {
> CPUState *cpu = env_cpu(env);
> GString *s = g_string_sized_new(128);
> uint8_t c;
>
> do {
> if (cpu_memory_rw_debug(cpu, addr++, &c, 1, 0) == 0) {
> if (c) {
> s = g_string_append_c(s, c);
> }
> } else {
> qemu_log_mask(LOG_GUEST_ERROR,
> "%s: passed inaccessible address " TARGET_FMT_lx,
> __func__, addr);
> break;
> }
> } while (c!=0);
>
> return s;
> }
>
> I can roll out two patches if needed..
>
> Cheers,
> Fred
>
next prev parent reply other threads:[~2020-05-28 12:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 9:44 [RFC] some semihosting interrogation Fred Konrad
2020-05-28 12:00 ` Philippe Mathieu-Daudé [this message]
2020-05-29 7:46 ` Fred Konrad
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=8771e99e-764b-52aa-55c4-a528d0804a34@redhat.com \
--to=philmd@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=konrad@adacore.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).