All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: Aleksandar Rikalo <arikalo@wavecomp.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	Aleksandar Markovic <amarkovic@wavecomp.com>
Subject: Re: [Qemu-devel] [RFC PATCH 10/11] target/mips: convert UHI_plog to use common semihosting code
Date: Mon, 20 May 2019 17:53:20 +0200	[thread overview]
Message-ID: <CAL1e-=gGT3kFnc1JCiDne3EFDJMy_7nraMc=Pov=fE1ePK_AWg@mail.gmail.com> (raw)
In-Reply-To: <20190514155301.16123-11-alex.bennee@linaro.org>

On May 14, 2019 6:02 PM, "Alex Bennée" <alex.bennee@linaro.org> wrote:
>
> Rather than printing directly to stdout lets use our common
> semihosting code. There is one minor difference in that the output
> currently defaults to stderr instead of stdout however this can be
> controlled by connecting semihosting to a chardev.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>

>  target/mips/mips-semi.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c
> index eac8374fb34..35bdfd7c77e 100644
> --- a/target/mips/mips-semi.c
> +++ b/target/mips/mips-semi.c
> @@ -23,6 +23,7 @@
>  #include "exec/helper-proto.h"
>  #include "exec/softmmu-semi.h"
>  #include "hw/semihosting/semihost.h"
> +#include "hw/semihosting/console.h"
>
>  typedef enum UHIOp {
>      UHI_exit = 1,
> @@ -329,13 +330,12 @@ void helper_do_semihosting(CPUMIPSState *env)
>          p2 = strstr(p, "%d");
>          if (p2) {
>              int char_num = p2 - p;
> -            char *buf = g_malloc(char_num + 1);
> -            strncpy(buf, p, char_num);
> -            buf[char_num] = '\0';
> -            gpr[2] = printf("%s%d%s", buf, (int)gpr[5], p2 + 2);
> -            g_free(buf);
> +            GString *s = g_string_new_len(p, char_num);
> +            g_string_append_printf(s, "%d%s", (int)gpr[5], p2 + 2);
> +            gpr[2] = qemu_semihosting_log_out(s->str, s->len);
> +            g_string_free(s, true);
>          } else {
> -            gpr[2] = printf("%s", p);
> +            gpr[2] = qemu_semihosting_log_out(p, strlen(p));
>          }
>          FREE_TARGET_STRING(p, gpr[4]);
>          break;
> --
> 2.20.1
>
>

  reply	other threads:[~2019-05-20 15:54 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14 15:52 [Qemu-devel] [RFC PATCH 00/11] semihosting cleanup and re-factor Alex Bennée
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 01/11] semihosting: move semihosting configuration into its own directory Alex Bennée
2019-05-14 16:23   ` Philippe Mathieu-Daudé
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 02/11] semihosting: introduce CONFIG_SEMIHOSTING Alex Bennée
2019-05-14 16:25   ` Philippe Mathieu-Daudé
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 03/11] semihosting: implement a semihosting console Alex Bennée
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 04/11] semihosting: enable chardev backed output for console Alex Bennée
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 05/11] target/arm: fixup some of the commentary for arm-semi Alex Bennée
2019-05-14 16:56   ` Philippe Mathieu-Daudé
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 06/11] target/arm: use the common interface for WRITE0/WRITEC in arm-semi Alex Bennée
2019-05-31  9:12   ` Miroslav Rezanina
2019-05-31 10:42     ` Philippe Mathieu-Daudé
2019-05-31 10:44       ` Philippe Mathieu-Daudé
2019-05-31 10:53       ` Miroslav Rezanina
2019-05-31 11:08     ` Alex Bennée
2019-05-31 11:28       ` Miroslav Rezanina
2019-05-31 13:16         ` Alex Bennée
2019-05-31 13:59           ` Miroslav Rezanina
2019-05-31 14:28             ` Alex Bennée
2019-05-31 14:38               ` Peter Maydell
2019-05-31 16:47                 ` Miroslav Rezanina
2019-05-31 16:50               ` Miroslav Rezanina
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 07/11] target/arm: add LOG_UNIMP messages to arm-semi Alex Bennée
2019-05-14 16:15   ` Philippe Mathieu-Daudé
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 08/11] target/arm: correct return values for WRITE/READ in arm-semi Alex Bennée
2019-05-14 16:57   ` Philippe Mathieu-Daudé
2019-05-14 15:52 ` [Qemu-devel] [RFC PATCH 09/11] target/mips: only build mips-semi for softmmu Alex Bennée
2019-05-14 16:59   ` Philippe Mathieu-Daudé
2019-05-20 15:53   ` Aleksandar Markovic
2019-05-14 15:53 ` [Qemu-devel] [RFC PATCH 10/11] target/mips: convert UHI_plog to use common semihosting code Alex Bennée
2019-05-20 15:53   ` Aleksandar Markovic [this message]
2019-05-14 15:53 ` [Qemu-devel] [RFC PATCH 11/11] MAINTAINERS: update for semihostings new home Alex Bennée
2019-05-14 17:00   ` Philippe Mathieu-Daudé
2019-05-20 13:03 ` [Qemu-devel] [RFC PATCH 00/11] semihosting cleanup and re-factor Alex Bennée

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='CAL1e-=gGT3kFnc1JCiDne3EFDJMy_7nraMc=Pov=fE1ePK_AWg@mail.gmail.com' \
    --to=aleksandar.m.mail@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=amarkovic@wavecomp.com \
    --cc=arikalo@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=qemu-arm@nongnu.org \
    --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.