All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Matteo Signorini <signorinimatteo@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: LEAVE emulation infinite loop
Date: Sun, 24 Apr 2011 10:14:43 +0300	[thread overview]
Message-ID: <4DB3CDE3.6050404@redhat.com> (raw)
In-Reply-To: <BANLkTims=tpZ4R68YaWVpniap+yRdAtxSA@mail.gmail.com>

On 04/24/2011 10:08 AM, Matteo Signorini wrote:
> Hello everybody,
> I have a problem with an opcode emulation not yet emulated in kvm-kmod
> 2.6.38-rc7.
> The opcode is the "LEAVE" that as Intel Manual says:
>
> "Set RSP to RBP, then pop RBP"
>
> The problem is that despite to the fact that the opcode of the leave
> (C9) is correctly fetched and decoded, it falls in an infinite loop
> (found by some printk debug prints)
>
> Now I'm wondering...the eip needed in order to continue the vm
> execution is moved-on by the insns_fetch operation so after the first
> byte decode of the LEAVE opcode I shouldn't execute it again...so what
> I'm doing wrong?
>
> I posted here the diff output so you can see which changes I made on
> kvm original source code
>
>
>          case 0xc5:              /* lds */
>                  rc = emulate_load_segment(ctxt, ops, VCPU_SREG_DS);
>                  break;
> +       case 0xc9:              /* leave */
> +               c->regs[VCPU_REGS_RSP] = c->regs[VCPU_REGS_RBP];
> +               rc = emulate_pop_sreg(ctxt, ops, VCPU_REGS_RBP);
> +               goto done;
>          case 0xcb:              /* ret far */
>                  rc = emulate_ret_far(ctxt, ops);
>                  break;
>
>

Why are you calling emulate_pop_sreg()? RBP is not a segment register.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  reply	other threads:[~2011-04-24  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-24  7:08 LEAVE emulation infinite loop Matteo Signorini
2011-04-24  7:14 ` Avi Kivity [this message]
2011-04-25  9:05   ` Matteo Signorini
2011-04-26  8:50     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DB3CDE3.6050404@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=signorinimatteo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.