Commit 41167be5 authored by Wei Yongjun's avatar Wei Yongjun Committed by Avi Kivity

KVM: x86 emulator: change OUT instruction to use dst instead of src

Change OUT instruction to use dst instead of src, so we can
reuse those code for all out instructions.
Signed-off-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 943858e2
...@@ -2321,12 +2321,12 @@ static struct opcode opcode_table[256] = { ...@@ -2321,12 +2321,12 @@ static struct opcode opcode_table[256] = {
/* 0xE0 - 0xE7 */ /* 0xE0 - 0xE7 */
N, N, N, N, N, N, N, N,
D(ByteOp | SrcImmUByte | DstAcc), D(SrcImmUByte | DstAcc), D(ByteOp | SrcImmUByte | DstAcc), D(SrcImmUByte | DstAcc),
D(ByteOp | SrcImmUByte | DstAcc), D(SrcImmUByte | DstAcc), D(ByteOp | SrcAcc | DstImmUByte), D(SrcAcc | DstImmUByte),
/* 0xE8 - 0xEF */ /* 0xE8 - 0xEF */
D(SrcImm | Stack), D(SrcImm | ImplicitOps), D(SrcImm | Stack), D(SrcImm | ImplicitOps),
D(SrcImmFAddr | No64), D(SrcImmByte | ImplicitOps), D(SrcImmFAddr | No64), D(SrcImmByte | ImplicitOps),
D(SrcNone | ByteOp | DstAcc), D(SrcNone | DstAcc), D(SrcNone | ByteOp | DstAcc), D(SrcNone | DstAcc),
D(SrcNone | ByteOp | DstAcc), D(SrcNone | DstAcc), D(ByteOp | SrcAcc | ImplicitOps), D(SrcAcc | ImplicitOps),
/* 0xF0 - 0xF7 */ /* 0xF0 - 0xF7 */
N, N, N, N, N, N, N, N,
D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3), D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3),
...@@ -3148,15 +3148,16 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt) ...@@ -3148,15 +3148,16 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
break; break;
case 0xee: /* out dx,al */ case 0xee: /* out dx,al */
case 0xef: /* out dx,(e/r)ax */ 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: do_io_out:
c->dst.bytes = min(c->dst.bytes, 4u); c->src.bytes = min(c->src.bytes, 4u);
if (!emulator_io_permited(ctxt, ops, c->src.val, c->dst.bytes)) { if (!emulator_io_permited(ctxt, ops, c->dst.val,
c->src.bytes)) {
emulate_gp(ctxt, 0); emulate_gp(ctxt, 0);
goto done; goto done;
} }
ops->pio_out_emulated(c->dst.bytes, c->src.val, &c->dst.val, 1, ops->pio_out_emulated(c->src.bytes, c->dst.val,
ctxt->vcpu); &c->src.val, 1, ctxt->vcpu);
c->dst.type = OP_NONE; /* Disable writeback. */ c->dst.type = OP_NONE; /* Disable writeback. */
break; break;
case 0xf4: /* hlt */ case 0xf4: /* hlt */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment