[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 16/74] semihosting: Split is_64bit_semihosting per target
From: |
Richard Henderson |
Subject: |
[PATCH v2 16/74] semihosting: Split is_64bit_semihosting per target |
Date: |
Tue, 3 May 2022 12:47:45 -0700 |
We already have some larger ifdef blocks for ARM and RISCV;
split the function into multiple implementations per arch.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
semihosting/arm-compat-semi.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index a6c6e5baf6..7fc60e223a 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -213,6 +213,10 @@ common_semi_sys_exit_extended(CPUState *cs, int nr)
return (nr == TARGET_SYS_EXIT_EXTENDED || is_a64(cs->env_ptr));
}
+static inline bool is_64bit_semihosting(CPUArchState *env)
+{
+ return is_a64(env);
+}
#endif /* TARGET_ARM */
#ifdef TARGET_RISCV
@@ -238,6 +242,10 @@ common_semi_sys_exit_extended(CPUState *cs, int nr)
return (nr == TARGET_SYS_EXIT_EXTENDED || sizeof(target_ulong) == 8);
}
+static inline bool is_64bit_semihosting(CPUArchState *env)
+{
+ return riscv_cpu_mxl(env) != MXL_RV32;
+}
#endif
/*
@@ -586,17 +594,6 @@ static const GuestFDFunctions guestfd_fns[] = {
* call if the memory read fails. Eventually we could use a generic
* CPUState helper function here.
*/
-static inline bool is_64bit_semihosting(CPUArchState *env)
-{
-#if defined(TARGET_ARM)
- return is_a64(env);
-#elif defined(TARGET_RISCV)
- return riscv_cpu_mxl(env) != MXL_RV32;
-#else
-#error un-handled architecture
-#endif
-}
-
#define GET_ARG(n) do { \
if (is_64bit_semihosting(env)) { \
--
2.34.1
- Re: [PATCH v2 08/74] semihosting: Generalize GuestFDFeatureFile, (continued)
- [PATCH v2 09/74] semihosting: Return void from do_common_semihosting, Richard Henderson, 2022/05/03
- [PATCH v2 13/74] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 10/74] semihosting: Adjust error checking in common_semi_cb, Richard Henderson, 2022/05/03
- [PATCH v2 12/74] include/exec: Move gdb open flags to gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 14/74] include/exec: Define errno values in gdbstub.h, Richard Henderson, 2022/05/03
- [PATCH v2 15/74] semihosting: Use struct gdb_stat in common_semi_flen_cb, Richard Henderson, 2022/05/03
- [PATCH v2 17/74] semihosting: Split common_semi_flen_buf per target, Richard Henderson, 2022/05/03
- [PATCH v2 16/74] semihosting: Split is_64bit_semihosting per target,
Richard Henderson <=
- [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
- [PATCH v2 11/74] semihosting: Move common-semi.h to include/semihosting/, Richard Henderson, 2022/05/03