[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 17/43] semihosting: Split out common_semi_has_synccache
From: |
Richard Henderson |
Subject: |
[PATCH 17/43] semihosting: Split out common_semi_has_synccache |
Date: |
Sat, 30 Apr 2022 06:29:06 -0700 |
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>
---
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
- [PATCH 00/43] semihosting cleanup, Richard Henderson, 2022/04/30
- [PATCH 01/43] semihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.h, Richard Henderson, 2022/04/30
- [PATCH 03/43] semihosting: Improve condition for config.c and console.c, Richard Henderson, 2022/04/30
- [PATCH 04/43] semihosting: Move softmmu-uaccess functions out of line, Richard Henderson, 2022/04/30
- [PATCH 07/43] semihosting: Split out guestfd.c, Richard Henderson, 2022/04/30
- [PATCH 10/43] semihosting: Adjust error checking in common_semi_cb, Richard Henderson, 2022/04/30
- [PATCH 02/43] semihosting: Return failure from softmmu-uaccess.h functions, Richard Henderson, 2022/04/30
- [PATCH 11/43] semihosting: Move common-semi.h to include/semihosting/, Richard Henderson, 2022/04/30
- [PATCH 17/43] semihosting: Split out common_semi_has_synccache,
Richard Henderson <=
- [PATCH 13/43] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/04/30
- [PATCH 25/43] semihosting: Split out semihost_sys_lseek, Richard Henderson, 2022/04/30
- [PATCH 12/43] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/04/30
- [PATCH 05/43] semihosting: Add target_strlen for softmmu-uaccess.h, Richard Henderson, 2022/04/30
- [PATCH 20/43] semihosting: Split out semihost_sys_open, Richard Henderson, 2022/04/30
- [PATCH 19/43] semihosting: Move GET_ARG/SET_ARG earlier in the file, Richard Henderson, 2022/04/30
- [PATCH 24/43] semihosting: Bound length for semihost_sys_{read, write}, Richard Henderson, 2022/04/30
- [PATCH 33/43] gdbstub: Widen gdb_syscall_complete_cb return value, Richard Henderson, 2022/04/30
- [PATCH 35/43] target/m68k: Make semihosting system only, Richard Henderson, 2022/04/30
- [PATCH 39/43] target/m68k: Remove EXCP_HALT_INSN, Richard Henderson, 2022/04/30