diff options
author | Nadav Amit <namit@cs.technion.ac.il> | 2014-04-17 20:35:10 -0400 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2014-04-23 16:46:59 -0400 |
commit | e6e39f0438bc4b0da9334ca42337775c7a00db21 (patch) | |
tree | f45f3cd73bf5dfed71656891368654f3cc6c9bab /arch/x86/kvm/emulate.c | |
parent | 346874c9507a2582d0c00021f848de6e115f276c (diff) |
KVM: x86: IN instruction emulation should ignore REP-prefix
The IN instruction is not be affected by REP-prefix as INS is. Therefore, the
emulation should ignore the REP prefix as well. The current emulator
implementation tries to perform writeback when IN instruction with REP-prefix
is emulated. This causes it to perform wrong memory write or spurious #GP
exception to be injected to the guest.
Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index f3834bbca1d7..e8a58409b5ac 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -1324,7 +1324,8 @@ static int pio_in_emulated(struct x86_emulate_ctxt *ctxt, | |||
1324 | rc->end = n * size; | 1324 | rc->end = n * size; |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | if (ctxt->rep_prefix && !(ctxt->eflags & EFLG_DF)) { | 1327 | if (ctxt->rep_prefix && (ctxt->d & String) && |
1328 | !(ctxt->eflags & EFLG_DF)) { | ||
1328 | ctxt->dst.data = rc->data + rc->pos; | 1329 | ctxt->dst.data = rc->data + rc->pos; |
1329 | ctxt->dst.type = OP_MEM_STR; | 1330 | ctxt->dst.type = OP_MEM_STR; |
1330 | ctxt->dst.count = (rc->end - rc->pos) / size; | 1331 | ctxt->dst.count = (rc->end - rc->pos) / size; |