CMPS and SCAS instructions accept repeat prefixes REPE and REPNE. 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 <[EMAIL PROTECTED]> --- drivers/kvm/x86_emulate.c | 4 +++- drivers/kvm/x86_emulate.h | 4 ++++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index bebdcee..3eae1b1 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c @@ -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; + break; case 0xf3: /* REP/REPE/REPZ */ - c->rep_prefix = 1; + c->rep_prefix = REP; break; default: goto done_prefixes; diff --git a/drivers/kvm/x86_emulate.h b/drivers/kvm/x86_emulate.h index 31aa3e1..2252989 100644 --- a/drivers/kvm/x86_emulate.h +++ b/drivers/kvm/x86_emulate.h @@ -161,6 +161,10 @@ struct x86_emulate_ctxt { struct decode_cache decode; }; +/* Repeat String Operation Prefix */ +#define REP 1 +#define REPNE 2 + /* Execution mode, passed to the emulator. */ #define X86EMUL_MODE_REAL 0 /* Real mode. */ #define X86EMUL_MODE_PROT16 2 /* 16-bit protected mode. */ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel