qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] X86: Invalid mov instruction (C7)


From: Xabier Ugarte-Pedrero
Subject: [Qemu-devel] [PATCH 2/3] X86: Invalid mov instruction (C7)
Date: Tue, 11 Feb 2014 22:24:35 +0100

  The mov instruction (with operational code C7) must be followed by a ModR/M 
byte with the Reg/Opcode field (bits 3 to 5) set to 0. Otherwise, it should 
generate an invalid instruction exception (illegal_op).
  See Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2A: 
Instruction Set Reference, A-M. Order Number: 253666-049US February 2014. See 
"MOV—Move" in Chapter 3.

  Signed-off-by: Xabier Ugarte-Pedrero <address@hidden>
---
 target-i386/translate.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/target-i386/translate.c b/target-i386/translate.c
index 733e5b2..d800ae3 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -5347,6 +5347,9 @@ static target_ulong disas_insn(CPUX86State *env, 
DisasContext *s,
         ot = mo_b_d(b, dflag);
         modrm = cpu_ldub_code(env, s->pc++);
         mod = (modrm >> 6) & 3;
+        if ((modrm >> 3) & 7){
+            goto illegal_op;
+        }
         if (mod != 3) {
             s->rip_offset = insn_const_size(ot);
             gen_lea_modrm(env, s, modrm);
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]