[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 18/74] semihosting: Split out common_semi_has_synccache
From: |
Alistair Francis |
Subject: |
Re: [PATCH v2 18/74] semihosting: Split out common_semi_has_synccache |
Date: |
Wed, 4 May 2022 19:01:23 +1000 |
On Wed, May 4, 2022 at 6:02 AM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> We already have some larger ifdef blocks for ARM and RISCV;
> split out a boolean test for SYS_SYNCCACHE.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> semihosting/arm-compat-semi.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
> index b2816e9f66..6149be404f 100644
> --- a/semihosting/arm-compat-semi.c
> +++ b/semihosting/arm-compat-semi.c
> @@ -224,6 +224,12 @@ static inline target_ulong
> common_semi_stack_bottom(CPUState *cs)
> CPUARMState *env = &cpu->env;
> return is_a64(env) ? env->xregs[31] : env->regs[13];
> }
> +
> +static inline bool common_semi_has_synccache(CPUArchState *env)
> +{
> + /* Invalid for A32/T32. */
> + return !is_a64(env);
> +}
> #endif /* TARGET_ARM */
>
> #ifdef TARGET_RISCV
> @@ -260,6 +266,11 @@ static inline target_ulong
> common_semi_stack_bottom(CPUState *cs)
> CPURISCVState *env = &cpu->env;
> return env->gpr[xSP];
> }
> +
> +static inline bool common_semi_has_synccache(CPUArchState *env)
> +{
> + return true;
> +}
> #endif
>
> /*
> @@ -1103,16 +1114,11 @@ void do_common_semihosting(CPUState *cs)
> * virtual address range. This is a nop for us since we don't
> * implement caches. This is only present on A64.
> */
> -#ifdef TARGET_ARM
> - if (is_a64(cs->env_ptr)) {
> + if (common_semi_has_synccache(env)) {
> common_semi_set_ret(cs, 0);
> break;
> }
> -#endif
> -#ifdef TARGET_RISCV
> - common_semi_set_ret(cs, 0);
> -#endif
> - /* fall through -- invalid for A32/T32 */
> + /* fall through */
> default:
> fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
> cpu_dump_state(cs, stderr, 0);
> --
> 2.34.1
>
>
- Re: [PATCH v2 17/74] semihosting: Split common_semi_flen_buf per target, (continued)
- [PATCH v2 16/74] semihosting: Split is_64bit_semihosting per target, Richard Henderson, 2022/05/03
- [PATCH v2 19/74] semihosting: Use env more often in do_common_semihosting, Richard Henderson, 2022/05/03
- [PATCH v2 22/74] semihosting: Split out semihost_sys_close, Richard Henderson, 2022/05/03
- [PATCH v2 21/74] semihosting: Split out semihost_sys_open, Richard Henderson, 2022/05/03
- [PATCH v2 20/74] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/05/03
- [PATCH v2 23/74] semihosting: Split out semihost_sys_read, Richard Henderson, 2022/05/03
- [PATCH v2 27/74] semihosting: Split out semihost_sys_isatty, Richard Henderson, 2022/05/03
- [PATCH v2 18/74] semihosting: Split out common_semi_has_synccache, Richard Henderson, 2022/05/03
- Re: [PATCH v2 18/74] semihosting: Split out common_semi_has_synccache,
Alistair Francis <=
- [PATCH v2 11/74] semihosting: Move common-semi.h to include/semihosting/, Richard Henderson, 2022/05/03
- [PATCH v2 26/74] semihosting: Split out semihost_sys_lseek, Richard Henderson, 2022/05/03
- [PATCH v2 31/74] semihosting: Split out semihost_sys_system, Richard Henderson, 2022/05/03
- [PATCH v2 24/74] semihosting: Split out semihost_sys_write, Richard Henderson, 2022/05/03
- [PATCH v2 25/74] semihosting: Bound length for semihost_sys_{read, write}, Richard Henderson, 2022/05/03
- [PATCH v2 29/74] semihosting: Split out semihost_sys_remove, Richard Henderson, 2022/05/03
- [PATCH v2 30/74] semihosting: Split out semihost_sys_rename, Richard Henderson, 2022/05/03
- [PATCH v2 28/74] semihosting: Split out semihost_sys_flen, Richard Henderson, 2022/05/03
- [PATCH v2 34/74] gdbstub: Widen gdb_syscall_complete_cb return value, Richard Henderson, 2022/05/03
- [PATCH v2 32/74] semihosting: Create semihost_sys_{stat,fstat}, Richard Henderson, 2022/05/03