[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 22/49] semihosting: Move GET_ARG/SET_ARG earlier in the file
From: |
Richard Henderson |
Subject: |
[PATCH v3 22/49] semihosting: Move GET_ARG/SET_ARG earlier in the file |
Date: |
Fri, 20 May 2022 17:03:33 -0700 |
Moving this to be useful for another function
besides do_common_semihosting.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
semihosting/arm-compat-semi.c | 48 +++++++++++++++++------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index 9c6fe7ffd7..7a7468799f 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -181,6 +181,30 @@ static LayoutInfo common_semi_find_bases(CPUState *cs)
#include "common-semi-target.h"
+/*
+ * Read the input value from the argument block; fail the semihosting
+ * call if the memory read fails. Eventually we could use a generic
+ * CPUState helper function here.
+ */
+
+#define GET_ARG(n) do { \
+ if (is_64bit_semihosting(env)) { \
+ if (get_user_u64(arg ## n, args + (n) * 8)) { \
+ goto do_fault; \
+ } \
+ } else { \
+ if (get_user_u32(arg ## n, args + (n) * 4)) { \
+ goto do_fault; \
+ } \
+ } \
+} while (0)
+
+#define SET_ARG(n, val) \
+ (is_64bit_semihosting(env) ? \
+ put_user_u64(val, args + (n) * 8) : \
+ put_user_u32(val, args + (n) * 4))
+
+
/*
* The semihosting API has no concept of its errno being thread-safe,
* as the API design predates SMP CPUs and was intended as a simple
@@ -507,30 +531,6 @@ static const GuestFDFunctions guestfd_fns[] = {
},
};
-/*
- * Read the input value from the argument block; fail the semihosting
- * call if the memory read fails. Eventually we could use a generic
- * CPUState helper function here.
- */
-
-#define GET_ARG(n) do { \
- if (is_64bit_semihosting(env)) { \
- if (get_user_u64(arg ## n, args + (n) * 8)) { \
- goto do_fault; \
- } \
- } else { \
- if (get_user_u32(arg ## n, args + (n) * 4)) { \
- goto do_fault; \
- } \
- } \
-} while (0)
-
-#define SET_ARG(n, val) \
- (is_64bit_semihosting(env) ? \
- put_user_u64(val, args + (n) * 8) : \
- put_user_u32(val, args + (n) * 4))
-
-
/*
* Do a semihosting call.
*
--
2.34.1
- Re: [PATCH v3 16/49] include/exec: Define errno values in gdbstub.h, (continued)
- [PATCH v3 12/49] semihosting: Return void from do_common_semihosting, Richard Henderson, 2022/05/20
- [PATCH v3 18/49] semihosting: Split is_64bit_semihosting per target, Richard Henderson, 2022/05/20
- [PATCH v3 26/49] semihosting: Split out semihost_sys_write, Richard Henderson, 2022/05/20
- [PATCH v3 39/49] semihosting: Expand qemu_semihosting_console_inc to read, Richard Henderson, 2022/05/20
- [PATCH v3 25/49] semihosting: Split out semihost_sys_read, Richard Henderson, 2022/05/20
- [PATCH v3 38/49] semihosting: Pass CPUState to qemu_semihosting_console_inc, Richard Henderson, 2022/05/20
- [PATCH v3 32/49] semihosting: Split out semihost_sys_rename, Richard Henderson, 2022/05/20
- [PATCH v3 22/49] semihosting: Move GET_ARG/SET_ARG earlier in the file,
Richard Henderson <=
- [PATCH v3 30/49] semihosting: Split out semihost_sys_flen, Richard Henderson, 2022/05/20
- [PATCH v3 15/49] include/exec: Move gdb_stat and gdb_timeval to gdbstub.h, Richard Henderson, 2022/05/20
- [PATCH v3 37/49] semihosting: Fix docs comment for qemu_semihosting_console_inc, Richard Henderson, 2022/05/20
- [PATCH v3 29/49] semihosting: Split out semihost_sys_isatty, Richard Henderson, 2022/05/20
- [PATCH v3 31/49] semihosting: Split out semihost_sys_remove, Richard Henderson, 2022/05/20
- [PATCH v3 17/49] semihosting: Use struct gdb_stat in common_semi_flen_cb, Richard Henderson, 2022/05/20