KVM: x86 emulator: do not munge rep prefix
authorAvi Kivity <avi@redhat.com>
Wed, 20 Jan 2010 14:00:35 +0000 (16:00 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 11 May 2011 11:56:58 +0000 (07:56 -0400)
Currently we store a rep prefix as 1 or 2 depending on whether it is a REPE or
REPNE.  Since sse instructions depend on the prefix value, store it as the
original opcode to simplify things further on.

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

index 0f521356432641b55906477cd8d5cfd0bf2842f8..c00aed12755de70e5e3df8d6828a7d861fecfaa0 100644 (file)
@@ -249,8 +249,8 @@ struct x86_emulate_ctxt {
 };
 
 /* Repeat String Operation Prefix */
-#define REPE_PREFIX    1
-#define REPNE_PREFIX   2
+#define REPE_PREFIX    0xf3
+#define REPNE_PREFIX   0xf2
 
 /* Execution mode, passed to the emulator. */
 #define X86EMUL_MODE_REAL     0        /* Real mode.             */
index 0ad47b819a8b2eb1743810e9b9dd19c9d5b59a3d..075bb6fc73ae8c8067d95bc104f6458543c1fb16 100644 (file)
@@ -2692,10 +2692,8 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
                        c->lock_prefix = 1;
                        break;
                case 0xf2:      /* REPNE/REPNZ */
-                       c->rep_prefix = REPNE_PREFIX;
-                       break;
                case 0xf3:      /* REP/REPE/REPZ */
-                       c->rep_prefix = REPE_PREFIX;
+                       c->rep_prefix = c->b;
                        break;
                default:
                        goto done_prefixes;