diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2010-08-05 23:45:12 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:51:09 -0400 |
commit | 41167be544603e077b866a2922737556dc2294e8 (patch) | |
tree | b9d9c97305a2424c5b2a90620442ba77329a2114 /arch/x86/kvm/emulate.c | |
parent | 943858e27544cd10e6095093a40be911a31892b1 (diff) |
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: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | 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 dc074a0c60ca..8e12e1b11ff8 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -2321,12 +2321,12 @@ static struct opcode opcode_table[256] = { | |||
2321 | /* 0xE0 - 0xE7 */ | 2321 | /* 0xE0 - 0xE7 */ |
2322 | N, N, N, N, | 2322 | N, N, N, N, |
2323 | D(ByteOp | SrcImmUByte | DstAcc), D(SrcImmUByte | DstAcc), | 2323 | D(ByteOp | SrcImmUByte | DstAcc), D(SrcImmUByte | DstAcc), |
2324 | D(ByteOp | SrcImmUByte | DstAcc), D(SrcImmUByte | DstAcc), | 2324 | D(ByteOp | SrcAcc | DstImmUByte), D(SrcAcc | DstImmUByte), |
2325 | /* 0xE8 - 0xEF */ | 2325 | /* 0xE8 - 0xEF */ |
2326 | D(SrcImm | Stack), D(SrcImm | ImplicitOps), | 2326 | D(SrcImm | Stack), D(SrcImm | ImplicitOps), |
2327 | D(SrcImmFAddr | No64), D(SrcImmByte | ImplicitOps), | 2327 | D(SrcImmFAddr | No64), D(SrcImmByte | ImplicitOps), |
2328 | D(SrcNone | ByteOp | DstAcc), D(SrcNone | DstAcc), | 2328 | D(SrcNone | ByteOp | DstAcc), D(SrcNone | DstAcc), |
2329 | D(SrcNone | ByteOp | DstAcc), D(SrcNone | DstAcc), | 2329 | D(ByteOp | SrcAcc | ImplicitOps), D(SrcAcc | ImplicitOps), |
2330 | /* 0xF0 - 0xF7 */ | 2330 | /* 0xF0 - 0xF7 */ |
2331 | N, N, N, N, | 2331 | N, N, N, N, |
2332 | D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3), | 2332 | D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3), |
@@ -3148,15 +3148,16 @@ special_insn: | |||
3148 | break; | 3148 | break; |
3149 | case 0xee: /* out dx,al */ | 3149 | case 0xee: /* out dx,al */ |
3150 | case 0xef: /* out dx,(e/r)ax */ | 3150 | case 0xef: /* out dx,(e/r)ax */ |
3151 | c->src.val = c->regs[VCPU_REGS_RDX]; | 3151 | c->dst.val = c->regs[VCPU_REGS_RDX]; |
3152 | do_io_out: | 3152 | do_io_out: |
3153 | c->dst.bytes = min(c->dst.bytes, 4u); | 3153 | c->src.bytes = min(c->src.bytes, 4u); |
3154 | if (!emulator_io_permited(ctxt, ops, c->src.val, c->dst.bytes)) { | 3154 | if (!emulator_io_permited(ctxt, ops, c->dst.val, |
3155 | c->src.bytes)) { | ||
3155 | emulate_gp(ctxt, 0); | 3156 | emulate_gp(ctxt, 0); |
3156 | goto done; | 3157 | goto done; |
3157 | } | 3158 | } |
3158 | ops->pio_out_emulated(c->dst.bytes, c->src.val, &c->dst.val, 1, | 3159 | ops->pio_out_emulated(c->src.bytes, c->dst.val, |
3159 | ctxt->vcpu); | 3160 | &c->src.val, 1, ctxt->vcpu); |
3160 | c->dst.type = OP_NONE; /* Disable writeback. */ | 3161 | c->dst.type = OP_NONE; /* Disable writeback. */ |
3161 | break; | 3162 | break; |
3162 | case 0xf4: /* hlt */ | 3163 | case 0xf4: /* hlt */ |