]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
KVM: x86 emulator: Make a distinction between repeat prefixes F3 and F2
authorGuillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Thu, 22 Nov 2007 10:32:09 +0000 (11:32 +0100)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:53:14 +0000 (17:53 +0200)
cmps and scas instructions accept repeat prefixes F3 and F2. So in
order to emulate those prefixed instructions we need to be able to know
if prefixes are REP/REPE/REPZ or REPNE/REPNZ. Currently kvm doesn't make
this distinction. This patch introduces this distinction.

Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/x86_emulate.c
drivers/kvm/x86_emulate.h

index 6e7f774d17513beaf272cc311c387ddd6d94e652..9f8d59a49313d1d5e50299be1afdc6c4cf79eef5 100644 (file)
@@ -824,8 +824,10 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
                        c->lock_prefix = 1;
                        break;
                case 0xf2:      /* REPNE/REPNZ */
+                       c->rep_prefix = REPNE_PREFIX;
+                       break;
                case 0xf3:      /* REP/REPE/REPZ */
-                       c->rep_prefix = 1;
+                       c->rep_prefix = REPE_PREFIX;
                        break;
                default:
                        goto done_prefixes;
index 4603b2bf34880a007f19146b8b6b1578716069e8..644086e354a7001d19f4d2ea90fcc56e361e3828 100644 (file)
@@ -162,6 +162,10 @@ struct x86_emulate_ctxt {
        struct decode_cache decode;
 };
 
+/* Repeat String Operation Prefix */
+#define REPE_PREFIX  1
+#define REPNE_PREFIX    2
+
 /* Execution mode, passed to the emulator. */
 #define X86EMUL_MODE_REAL     0        /* Real mode.             */
 #define X86EMUL_MODE_PROT16   2        /* 16-bit protected mode. */