* [PATCH] x86 emulator: Simplify String I/O emulation
@ 2008-09-06 14:44 Mohammed Gamal
2008-09-07 7:21 ` Avi Kivity
2008-09-07 13:29 ` Avi Kivity
0 siblings, 2 replies; 3+ messages in thread
From: Mohammed Gamal @ 2008-09-06 14:44 UTC (permalink / raw)
To: kvm; +Cc: avi
Simplify ins/insb and outs/outsb instructions
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86 emulator: Simplify String I/O emulation
2008-09-06 14:44 [PATCH] x86 emulator: Simplify String I/O emulation Mohammed Gamal
@ 2008-09-07 7:21 ` Avi Kivity
2008-09-07 13:29 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2008-09-07 7:21 UTC (permalink / raw)
To: Mohammed Gamal; +Cc: kvm
Mohammed Gamal wrote:
> Simplify ins/insb and outs/outsb instructions
>
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86 emulator: Simplify String I/O emulation
2008-09-06 14:44 [PATCH] x86 emulator: Simplify String I/O emulation Mohammed Gamal
2008-09-07 7:21 ` Avi Kivity
@ 2008-09-07 13:29 ` Avi Kivity
1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2008-09-07 13:29 UTC (permalink / raw)
To: Mohammed Gamal; +Cc: kvm
Mohammed Gamal wrote:
> Simplify ins/insb and outs/outsb instructions
>
>
This is broken (ins uses es:rdi, outs uses ds:rsi), so I reverted it.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-07 13:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-06 14:44 [PATCH] x86 emulator: Simplify String I/O emulation Mohammed Gamal
2008-09-07 7:21 ` Avi Kivity
2008-09-07 13:29 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox