* [PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode
@ 2010-08-06 3:36 Wei Yongjun
2010-08-06 3:45 ` [PATCH 2/3] KVM: x86 emulator: change OUT instruction to use dst instead of src Wei Yongjun
2010-08-17 9:44 ` [PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode Avi Kivity
0 siblings, 2 replies; 4+ messages in thread
From: Wei Yongjun @ 2010-08-06 3:36 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
Introduce DstImmUByte for dst operand decode, which
will be used for out instruction.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
arch/x86/kvm/emulate.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a2a079f..f952fd0 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -54,6 +54,7 @@
#define DstAcc (4<<1) /* Destination Accumulator */
#define DstDI (5<<1) /* Destination is in ES:(E)DI */
#define DstMem64 (6<<1) /* 64bit memory operand */
+#define DstImmUByte (7<<1) /* 8-bit unsigned immediate operand */
#define DstMask (7<<1)
/* Source operand type. */
#define SrcNone (0<<4) /* No source operand. */
@@ -2632,6 +2633,12 @@ done_prefixes:
decode_register_operand(&c->dst, c,
c->twobyte && (c->b == 0xb6 || c->b == 0xb7));
break;
+ case DstImmUByte:
+ c->dst.type = OP_IMM;
+ c->dst.addr.mem = c->eip;
+ c->dst.bytes = 1;
+ c->dst.val = insn_fetch(u8, 1, c->eip);
+ break;
case DstMem:
case DstMem64:
c->dst = memop;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] KVM: x86 emulator: change OUT instruction to use dst instead of src
2010-08-06 3:36 [PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode Wei Yongjun
@ 2010-08-06 3:45 ` Wei Yongjun
2010-08-06 3:46 ` [PATCH 3/3] KVM: x86 emulator: remove dup code of in/out instruction Wei Yongjun
2010-08-17 9:44 ` [PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode Avi Kivity
1 sibling, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2010-08-06 3:45 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
Change OUT instruction to use dst instead of src, so we can
reuse those code for all out instructions.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
arch/x86/kvm/emulate.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index f952fd0..95815b9 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2261,12 +2261,12 @@ static struct opcode opcode_table[256] = {
/* 0xE0 - 0xE7 */
N, N, N, N,
D(ByteOp | SrcImmUByte | DstAcc), D(SrcImmUByte | DstAcc),
- D(ByteOp | SrcImmUByte | DstAcc), D(SrcImmUByte | DstAcc),
+ D(ByteOp | SrcAcc | DstImmUByte), D(SrcAcc | DstImmUByte),
/* 0xE8 - 0xEF */
D(SrcImm | Stack), D(SrcImm | ImplicitOps),
D(SrcImmFAddr | No64), D(SrcImmByte | ImplicitOps),
D(SrcNone | ByteOp | DstAcc), D(SrcNone | DstAcc),
- D(SrcNone | ByteOp | DstAcc), D(SrcNone | DstAcc),
+ D(ByteOp | SrcAcc | ImplicitOps), D(SrcAcc | ImplicitOps),
/* 0xF0 - 0xF7 */
N, N, N, N,
D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3),
@@ -3107,15 +3107,16 @@ special_insn:
break;
case 0xee: /* out dx,al */
case 0xef: /* out dx,(e/r)ax */
- c->src.val = c->regs[VCPU_REGS_RDX];
+ c->dst.val = c->regs[VCPU_REGS_RDX];
do_io_out:
- c->dst.bytes = min(c->dst.bytes, 4u);
- if (!emulator_io_permited(ctxt, ops, c->src.val, c->dst.bytes)) {
+ c->src.bytes = min(c->src.bytes, 4u);
+ if (!emulator_io_permited(ctxt, ops, c->dst.val,
+ c->src.bytes)) {
emulate_gp(ctxt, 0);
goto done;
}
- ops->pio_out_emulated(c->dst.bytes, c->src.val, &c->dst.val, 1,
- ctxt->vcpu);
+ ops->pio_out_emulated(c->src.bytes, c->dst.val,
+ &c->src.val, 1, ctxt->vcpu);
c->dst.type = OP_NONE; /* Disable writeback. */
break;
case 0xf4: /* hlt */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] KVM: x86 emulator: remove dup code of in/out instruction
2010-08-06 3:45 ` [PATCH 2/3] KVM: x86 emulator: change OUT instruction to use dst instead of src Wei Yongjun
@ 2010-08-06 3:46 ` Wei Yongjun
0 siblings, 0 replies; 4+ messages in thread
From: Wei Yongjun @ 2010-08-06 3:46 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
arch/x86/kvm/emulate.c | 24 ++++--------------------
1 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 95815b9..0e360c6 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2870,28 +2870,12 @@ special_insn:
break;
case 0x6c: /* insb */
case 0x6d: /* insw/insd */
- c->dst.bytes = min(c->dst.bytes, 4u);
- if (!emulator_io_permited(ctxt, ops, c->regs[VCPU_REGS_RDX],
- c->dst.bytes)) {
- emulate_gp(ctxt, 0);
- goto done;
- }
- if (!pio_in_emulated(ctxt, ops, c->dst.bytes,
- c->regs[VCPU_REGS_RDX], &c->dst.val))
- goto done; /* IO is needed, skip writeback */
- break;
+ c->src.val = c->regs[VCPU_REGS_RDX];
+ goto do_io_in;
case 0x6e: /* outsb */
case 0x6f: /* outsw/outsd */
- c->src.bytes = min(c->src.bytes, 4u);
- if (!emulator_io_permited(ctxt, ops, c->regs[VCPU_REGS_RDX],
- c->src.bytes)) {
- emulate_gp(ctxt, 0);
- goto done;
- }
- ops->pio_out_emulated(c->src.bytes, c->regs[VCPU_REGS_RDX],
- &c->src.val, 1, ctxt->vcpu);
-
- c->dst.type = OP_NONE; /* nothing to writeback */
+ c->dst.val = c->regs[VCPU_REGS_RDX];
+ goto do_io_out;
break;
case 0x70 ... 0x7f: /* jcc (short) */
if (test_cc(c->b, ctxt->eflags))
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode
2010-08-06 3:36 [PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode Wei Yongjun
2010-08-06 3:45 ` [PATCH 2/3] KVM: x86 emulator: change OUT instruction to use dst instead of src Wei Yongjun
@ 2010-08-17 9:44 ` Avi Kivity
1 sibling, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-08-17 9:44 UTC (permalink / raw)
To: Wei Yongjun; +Cc: kvm
On 08/06/2010 06:36 AM, Wei Yongjun wrote:
> Introduce DstImmUByte for dst operand decode, which
> will be used for out instruction.
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-17 9:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 3:36 [PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode Wei Yongjun
2010-08-06 3:45 ` [PATCH 2/3] KVM: x86 emulator: change OUT instruction to use dst instead of src Wei Yongjun
2010-08-06 3:46 ` [PATCH 3/3] KVM: x86 emulator: remove dup code of in/out instruction Wei Yongjun
2010-08-17 9:44 ` [PATCH 1/3] KVM: x86 emulator: introduce DstImmUByte for dst operand decode Avi Kivity
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.