[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 25/39] target/i386: introduce M* (memptr) ope
From: |
Jan Bobek |
Subject: |
[Qemu-devel] [RFC PATCH v2 25/39] target/i386: introduce M* (memptr) operands |
Date: |
Sat, 10 Aug 2019 00:12:41 -0400 |
The memory-pointer operand decodes the indirect form of ModR/M byte,
loads the effective address into a register and passes that register
as the operand.
Note: This operand has a known flaw: if an instruction is writing to
memory (rather than reading), this operand cannot and will not load
the effective address into the register (as it should). The current
workaround is to declare the memory operand as read (rather than
write); this flaw will be addressed in the next iteration.
Signed-off-by: Jan Bobek <address@hidden>
---
target/i386/translate.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/target/i386/translate.c b/target/i386/translate.c
index b8e6eaebb4..301dc4eddf 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -4705,6 +4705,31 @@ INSNOP(Ib, int8_t, \
(*op = x86_ldub_code(env, s)), \
INSNOP_FINALIZE_INVALID)
+/*
+ * Memory-pointer operand
+ */
+INSNOP(
+ M, TCGv,
+ do {
+ if (decode_modrm_mod(env, s, modrm) == 3) {
+ INSNOP_INIT_FAIL;
+ } else {
+ INSNOP_INIT_OK(s->A0);
+ }
+ } while (0),
+ do {
+ assert(*op == s->A0);
+ gen_lea_modrm(env, s, modrm);
+ } while (0),
+ INSNOP_FINALIZE_NOOP)
+
+INSNOP_ALIAS(Mb, M)
+INSNOP_ALIAS(Mw, M)
+INSNOP_ALIAS(Mq, M)
+INSNOP_ALIAS(Md, M)
+INSNOP_ALIAS(Mdq, M)
+INSNOP_ALIAS(Mqq, M)
+
/*
* Code generators
*/
--
2.20.1
- Re: [Qemu-devel] [RFC PATCH v2 16/39] target/i386: introduce instruction operand infrastructure, (continued)
- [Qemu-devel] [RFC PATCH v2 17/39] target/i386: introduce helpers for decoding modrm fields, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 18/39] target/i386: introduce modifier for direct-only operand decoding, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 20/39] target/i386: introduce generic load-store operand, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 22/39] target/i386: introduce code generators, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 19/39] target/i386: introduce generic operand alias, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 21/39] target/i386: introduce insn.h, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 24/39] target/i386: introduce Ib (immediate) operand, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 25/39] target/i386: introduce M* (memptr) operands,
Jan Bobek <=
- [Qemu-devel] [RFC PATCH v2 23/39] target/i386: introduce instruction translator macros, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 26/39] target/i386: introduce G*, R*, E* (general register) operands, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 27/39] target/i386: introduce RdMw operand, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 29/39] target/i386: introduce helper-based code generator macros, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 28/39] target/i386: introduce P*, N*, Q* (MMX) operands, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 30/39] target/i386: introduce gvec-based code generator macros, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 31/39] target/i386: introduce MMX translators, Jan Bobek, 2019/08/10
- [Qemu-devel] [RFC PATCH v2 32/39] target/i386: introduce MMX code generators, Jan Bobek, 2019/08/10