[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 45/53] semihosting: Create qemu_semihosting_console_write
From: |
Luc Michel |
Subject: |
Re: [PATCH v4 45/53] semihosting: Create qemu_semihosting_console_write |
Date: |
Mon, 27 Jun 2022 09:23:49 +0200 |
User-agent: |
Mutt/1.9.4 (2018-02-28) |
On 13:45 Tue 07 Jun , Richard Henderson wrote:
> Will replace qemu_semihosting_console_{outs,outc},
> but we need more plumbing first.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Luc Michel <lmichel@kalray.eu>
> ---
> include/semihosting/console.h | 12 ++++++++++++
> linux-user/semihost.c | 5 +++++
> semihosting/console.c | 9 +++++++++
> 3 files changed, 26 insertions(+)
>
> diff --git a/include/semihosting/console.h b/include/semihosting/console.h
> index 39dbf1b062..6994f23c82 100644
> --- a/include/semihosting/console.h
> +++ b/include/semihosting/console.h
> @@ -54,6 +54,18 @@ void qemu_semihosting_console_outc(CPUArchState *env,
> target_ulong c);
> */
> int qemu_semihosting_console_read(CPUState *cs, void *buf, int len);
>
> +/**
> + * qemu_semihosting_console_write:
> + * @buf: host buffer
> + * @len: buffer size
> + *
> + * Write len bytes from buf to the debug console.
> + *
> + * Returns: number of bytes written -- this should only ever be short
> + * on some sort of i/o error.
> + */
> +int qemu_semihosting_console_write(void *buf, int len);
> +
> /**
> * qemu_semihosting_log_out:
> * @s: pointer to string
> diff --git a/linux-user/semihost.c b/linux-user/semihost.c
> index 2029fb674c..871edf993a 100644
> --- a/linux-user/semihost.c
> +++ b/linux-user/semihost.c
> @@ -76,3 +76,8 @@ int qemu_semihosting_console_read(CPUState *cs, void *buf,
> int len)
>
> return ret;
> }
> +
> +int qemu_semihosting_console_write(void *buf, int len)
> +{
> + return fwrite(buf, 1, len, stderr);
> +}
> diff --git a/semihosting/console.c b/semihosting/console.c
> index 4088192842..b6a342744d 100644
> --- a/semihosting/console.c
> +++ b/semihosting/console.c
> @@ -169,6 +169,15 @@ int qemu_semihosting_console_read(CPUState *cs, void
> *buf, int len)
> return ret;
> }
>
> +int qemu_semihosting_console_write(void *buf, int len)
> +{
> + if (console.chr) {
> + return qemu_chr_write_all(console.chr, (uint8_t *)buf, len);
> + } else {
> + return fwrite(buf, 1, len, stderr);
> + }
> +}
> +
> void qemu_semihosting_console_init(Chardev *chr)
> {
> console.chr = chr;
> --
> 2.34.1
>
>
>
>
> To declare a filtering error, please use the following link :
> https://www.security-mail.net/reporter.php?mid=17cb8.629fd4d3.e3b54.0&r=lmichel%40kalrayinc.com&s=qemu-devel-bounces%2Blmichel%3Dkalrayinc.com%40nongnu.org&o=%5BPATCH+v4+45%2F53%5D+semihosting%3A+Create+qemu_semihosting_console_write&verdict=C&c=62fc4b596a4980c709b5ba86793f19d99fbc6d6f
>
--
- Re: [PATCH v4 33/53] semihosting: Split out semihost_sys_isatty, (continued)
- [PATCH v4 34/53] semihosting: Split out semihost_sys_flen, Richard Henderson, 2022/06/07
- [PATCH v4 36/53] semihosting: Split out semihost_sys_rename, Richard Henderson, 2022/06/07
- [PATCH v4 39/53] semihosting: Create semihost_sys_gettimeofday, Richard Henderson, 2022/06/07
- [PATCH v4 41/53] semihosting: Fix docs comment for qemu_semihosting_console_inc, Richard Henderson, 2022/06/07
- [PATCH v4 45/53] semihosting: Create qemu_semihosting_console_write, Richard Henderson, 2022/06/07
- Re: [PATCH v4 45/53] semihosting: Create qemu_semihosting_console_write,
Luc Michel <=
- [PATCH v4 42/53] semihosting: Pass CPUState to qemu_semihosting_console_inc, Richard Henderson, 2022/06/07
- [PATCH v4 48/53] semihosting: Use console_in_gf for SYS_READC, Richard Henderson, 2022/06/07
- [PATCH v4 47/53] semihosting: Create qemu_semihosting_guestfd_init, Richard Henderson, 2022/06/07