On Fri, 2 May 2025, Paolo Bonzini wrote:
decode->op[N].ptr can contain either a host pointer (!) in CPUState
or a guest virtual address.  Pass the whole struct to read_val_ext
and write_val_ext, so that it can decide the contents based on the
operand type.

Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
---
target/i386/emulate/x86_decode.h |   9 ++-
target/i386/emulate/x86_emu.h    |   8 +--
target/i386/emulate/x86_decode.c |  74 +++++++++----------
target/i386/emulate/x86_emu.c    | 119 ++++++++++++++++---------------
4 files changed, 109 insertions(+), 101 deletions(-)

diff --git a/target/i386/emulate/x86_decode.h b/target/i386/emulate/x86_decode.h
index 87cc728598d..497cbdef9c7 100644
--- a/target/i386/emulate/x86_decode.h
+++ b/target/i386/emulate/x86_decode.h
@@ -266,7 +266,10 @@ typedef struct x86_decode_op {
    int reg;
    target_ulong val;

-    target_ulong ptr;
+    union {
+        target_ulong addr;
+        void *regptr;
+    };
} x86_decode_op;

typedef struct x86_decode {
@@ -301,8 +304,8 @@ uint64_t sign(uint64_t val, int size);

uint32_t decode_instruction(CPUX86State *env, struct x86_decode *decode);

-target_ulong get_reg_ref(CPUX86State *env, int reg, int rex_present,
-                         int is_extended, int size);
+void * get_reg_ref(CPUX86State *env, int reg, int rex_present,
+                    int is_extended, int size);

Stray space after *, checkpatch should have cought it.

Regards,
BALATON Zoltan

Reply via email to