Simplify ins/insb and outs/outsb instructions
Signed-off-by: Mohammed Gamal <[EMAIL PROTECTED]>
---
arch/x86/kvm/x86_emulate.c | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index aef619a..97d60f5 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -1434,24 +1434,14 @@ special_insn:
break;
case 0x6c: /* insb */
case 0x6d: /* insw/insd */
- if (kvm_emulate_pio_string(ctxt->vcpu, NULL,
- 1,
- (c->d & ByteOp) ? 1 : c->op_bytes,
- c->rep_prefix ?
- address_mask(c, c->regs[VCPU_REGS_RCX]) : 1,
- (ctxt->eflags & EFLG_DF),
- register_address(c, es_base(ctxt),
- c->regs[VCPU_REGS_RDI]),
- c->rep_prefix,
- c->regs[VCPU_REGS_RDX]) == 0) {
- c->eip = saved_eip;
- return -1;
- }
- return 0;
+ io_direction = 1;
+ goto do_string_io;
case 0x6e: /* outsb */
case 0x6f: /* outsw/outsd */
+ io_direction = 0;
+ do_string_io:
if (kvm_emulate_pio_string(ctxt->vcpu, NULL,
- 0,
+ io_direction,
(c->d & ByteOp) ? 1 : c->op_bytes,
c->rep_prefix ?
address_mask(c, c->regs[VCPU_REGS_RCX]) : 1,
@@ -1462,7 +1452,7 @@ special_insn:
c->rep_prefix,
c->regs[VCPU_REGS_RDX]) == 0) {
c->eip = saved_eip;
- return -1;
+ goto cannot_emulate;
}
return 0;
case 0x70 ... 0x7f: /* jcc (short) */ {
--
1.5.4.3
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html