diff options
author | Nadav Amit <namit@cs.technion.ac.il> | 2014-06-02 11:34:11 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-06-18 11:46:19 -0400 |
commit | 32e94d0696c26c6ba4f3ff53e70f6e0e825979bc (patch) | |
tree | 906c7d91be5d9fa12b0991f3d2d5413d3f18348e | |
parent | aaa05f2437b9450f30b301db962ec4d45ec90fbb (diff) |
KVM: x86: smsw emulation is incorrect in 64-bit mode
In 64-bit mode, when the destination is a register, the assignment is done
according to the operand size. Otherwise (memory operand or no 64-bit mode), a
16-bit assignment is performed.
Currently, 16-bit assignment is always done to the destination.
Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | arch/x86/kvm/emulate.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index a151f8d24a1d..9b5d97db7631 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -3235,7 +3235,8 @@ static int em_lidt(struct x86_emulate_ctxt *ctxt) | |||
3235 | 3235 | ||
3236 | static int em_smsw(struct x86_emulate_ctxt *ctxt) | 3236 | static int em_smsw(struct x86_emulate_ctxt *ctxt) |
3237 | { | 3237 | { |
3238 | ctxt->dst.bytes = 2; | 3238 | if (ctxt->dst.type == OP_MEM) |
3239 | ctxt->dst.bytes = 2; | ||
3239 | ctxt->dst.val = ctxt->ops->get_cr(ctxt, 0); | 3240 | ctxt->dst.val = ctxt->ops->get_cr(ctxt, 0); |
3240 | return X86EMUL_CONTINUE; | 3241 | return X86EMUL_CONTINUE; |
3241 | } | 3242 | } |