[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 25/50] translator: add translator_ld{ub, sw, uw,
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v3 25/50] translator: add translator_ld{ub, sw, uw, l, q} |
Date: |
Fri, 14 Jun 2019 18:11:35 +0100 |
From: "Emilio G. Cota" <address@hidden>
Suggested-by: Richard Henderson <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
include/exec/translator.h | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/include/exec/translator.h b/include/exec/translator.h
index 180c51d509..33fa709ba6 100644
--- a/include/exec/translator.h
+++ b/include/exec/translator.h
@@ -19,7 +19,10 @@
*/
+#include "qemu/bswap.h"
#include "exec/exec-all.h"
+#include "exec/cpu_ldst.h"
+#include "exec/plugin-gen.h"
#include "tcg/tcg.h"
@@ -142,4 +145,29 @@ void translator_loop(const TranslatorOps *ops,
DisasContextBase *db,
void translator_loop_temp_check(DisasContextBase *db);
-#endif /* EXEC__TRANSLATOR_H */
+#define GEN_TRANSLATOR_LD(fullname, name, type, swap_fn) \
+ static inline type \
+ fullname ## _swap(CPUArchState *env, abi_ptr pc, bool do_swap) \
+ { \
+ type ret = cpu_ ## name ## _code(env, pc); \
+ \
+ if (do_swap) { \
+ ret = swap_fn(ret); \
+ } \
+ plugin_insn_append(&ret, sizeof(ret)); \
+ return ret; \
+ } \
+ \
+ static inline type fullname(CPUArchState *env, abi_ptr pc) \
+ { \
+ return fullname ## _swap(env, pc, false); \
+ }
+
+GEN_TRANSLATOR_LD(translator_ldub, ldub, uint8_t, /* no swap needed */)
+GEN_TRANSLATOR_LD(translator_ldsw, ldsw, int16_t, bswap16)
+GEN_TRANSLATOR_LD(translator_lduw, lduw, uint16_t, bswap16)
+GEN_TRANSLATOR_LD(translator_ldl, ldl, uint32_t, bswap32)
+GEN_TRANSLATOR_LD(translator_ldq, ldq, uint64_t, bswap64)
+#undef GEN_TRANSLATOR_LD
+
+#endif /* EXEC__TRANSLATOR_H */
--
2.20.1
- Re: [Qemu-devel] [PATCH v3 47/50] accel/stubs: reduce headers from tcg-stub, (continued)
- [Qemu-devel] [PATCH v3 30/50] target/hppa: fetch code with translator_ld, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 19/50] tcg: let plugins instrument memory accesses, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 15/50] tcg: add MO_HADDR to TCGMemOp, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 37/50] translator: inject instrumentation from plugins, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 13/50] plugin-gen: add module for TCG-related code, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 25/50] translator: add translator_ld{ub, sw, uw, l, q},
Alex Bennée <=
- [Qemu-devel] [PATCH v3 48/50] include/exec: wrap cpu_ldst.h in CONFIG_TCG, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 50/50] TODO: API changes to make?, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 31/50] target/m68k: fetch code with translator_ld, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 27/50] target/ppc: fetch code with translator_ld, Alex Bennée, 2019/06/14
- [Qemu-devel] [PATCH v3 36/50] target/openrisc: fetch code with translator_ld, Alex Bennée, 2019/06/14