diff options
author | Nadav Amit <namit@cs.technion.ac.il> | 2014-11-02 10:54:51 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-11-07 15:44:06 +0100 |
commit | 0fcc207c66a7cff024b05367b86d70d742072d61 (patch) | |
tree | 73714311883422e2306c204311255ae7463f2e7d /arch | |
parent | KVM: x86: Wrong flags on CMPS and SCAS emulation (diff) | |
download | linux-0fcc207c66a7cff024b05367b86d70d742072d61.tar.xz linux-0fcc207c66a7cff024b05367b86d70d742072d61.zip |
KVM: x86: Emulate push sreg as done in Core
According to Intel SDM push of segment selectors is done in the following
manner: "if the operand size is 32-bits, either a zero-extended value is pushed
on the stack or the segment selector is written on the stack using a 16-bit
move. For the last case, all recent Core and Atom processors perform a 16-bit
move, leaving the upper portion of the stack location unmodified."
This patch modifies the behavior to match the core behavior.
Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/emulate.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7aba1db168c9..a2a9c18b42e4 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1817,6 +1817,10 @@ static int em_push_sreg(struct x86_emulate_ctxt *ctxt) int seg = ctxt->src2.val; ctxt->src.val = get_segment_selector(ctxt, seg); + if (ctxt->op_bytes == 4) { + rsp_increment(ctxt, -2); + ctxt->op_bytes = 2; + } return em_push(ctxt); } |