]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
KVM: x86 emulator: introduce Op3264 for mov cr and mov dr instructions
authorAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 11:46:54 +0000 (14:46 +0300)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:50:35 +0000 (10:50 +0200)
The operands for these instructions are 32 bits or 64 bits, depending on
long mode, and ignoring REX prefixes, or the operand size prefix.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/emulate.c

index a832019138f38eb03c1c38e7049fe4081fac2590..b7adfcc2f74f0393f367241bd67e7fe22fa8f44e 100644 (file)
@@ -83,6 +83,7 @@
 #define Group       (1<<14)     /* Bits 3:5 of modrm byte extend opcode */
 #define GroupDual   (1<<15)     /* Alternate decoding of mod == 3 */
 /* Misc flags */
+#define Op3264      (1<<24) /* Operand is 64b in long mode, 32b otherwise */
 #define Undefined   (1<<25) /* No Such Instruction */
 #define Lock        (1<<26) /* lock prefix is allowed for the instruction */
 #define Priv        (1<<27) /* instruction generates #GP if current CPL != 0 */
@@ -2406,6 +2407,13 @@ done_prefixes:
        if (mode == X86EMUL_MODE_PROT64 && (c->d & Stack))
                c->op_bytes = 8;
 
+       if (c->d & Op3264) {
+               if (mode == X86EMUL_MODE_PROT64)
+                       c->op_bytes = 8;
+               else
+                       c->op_bytes = 4;
+       }
+
        /* ModRM and SIB bytes. */
        if (c->d & ModRM) {
                rc = decode_modrm(ctxt, ops);