qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 29/53] semihosting: Split out semihost_sys_read


From: Luc Michel
Subject: Re: [PATCH v4 29/53] semihosting: Split out semihost_sys_read
Date: Wed, 22 Jun 2022 21:25:55 +0200
User-agent: Mutt/1.9.4 (2018-02-28)

On 13:45 Tue 07 Jun     , Richard Henderson wrote:
> Split out the non-ARM specific portions of SYS_READ to a
> reusable function.  This handles all GuestFD.  Isolate the
> curious ARM-specific return value processing to a new
> callback, common_semi_rw_cb.
> 
> Note that gdb_do_syscall %x reads target_ulong, not int.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  include/semihosting/syscalls.h |  8 ++++
>  semihosting/arm-compat-semi.c  | 85 ++++++++--------------------------
>  semihosting/syscalls.c         | 85 ++++++++++++++++++++++++++++++++++
>  3 files changed, 113 insertions(+), 65 deletions(-)
> 

[...]

> +/*
> + * SYS_READ and SYS_WRITE always return the number of bytes not read/written.
> + * There is no error condition, other than returning the original length.
> + */
> +static void common_semi_rw_cb(CPUState *cs, target_ulong ret, target_ulong 
> err)
> +{
> +    /* Recover the original length from the third argument. */
> +    CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
> +    target_ulong args = common_semi_arg(cs, 1);
> +    target_ulong arg2;
> +    GET_ARG(2);
> +
> +    if (err) {
> + do_fault:
Leftover label?

otherwise:

Reviewed-by: Luc Michel <lmichel@kalray.eu>

> +        ret = 0; /* error: no bytes transmitted */
> +    }
> +    common_semi_set_ret(cs, arg2 - ret);
> +}
> +







reply via email to

[Prev in Thread] Current Thread [Next in Thread]