[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);
> +}
> +
- [PATCH v4 19/53] gdbstub: Convert GDB error numbers to host error numbers, (continued)
- [PATCH v4 19/53] gdbstub: Convert GDB error numbers to host error numbers, Richard Henderson, 2022/06/07
- [PATCH v4 20/53] semihosting: Use struct gdb_stat in common_semi_flen_cb, Richard Henderson, 2022/06/07
- [PATCH v4 21/53] semihosting: Split is_64bit_semihosting per target, Richard Henderson, 2022/06/07
- [PATCH v4 22/53] semihosting: Split common_semi_flen_buf per target, Richard Henderson, 2022/06/07
- [PATCH v4 24/53] semihosting: Split out common-semi-target.h, Richard Henderson, 2022/06/07
- [PATCH v4 28/53] semihosting: Split out semihost_sys_close, Richard Henderson, 2022/06/07
- [PATCH v4 26/53] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/06/07
- [PATCH v4 29/53] semihosting: Split out semihost_sys_read, Richard Henderson, 2022/06/07
- Re: [PATCH v4 29/53] semihosting: Split out semihost_sys_read,
Luc Michel <=
- [PATCH v4 32/53] semihosting: Split out semihost_sys_lseek, Richard Henderson, 2022/06/07
- [PATCH v4 30/53] semihosting: Split out semihost_sys_write, Richard Henderson, 2022/06/07
- [PATCH v4 33/53] semihosting: Split out semihost_sys_isatty, Richard Henderson, 2022/06/07
- [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