public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] Correct management of REP prefix
Date: Mon, 01 Oct 2007 10:55:45 +0200	[thread overview]
Message-ID: <4700B611.1000803@bull.net> (raw)
In-Reply-To: <46FF6702.2060203-atKUWr5tajBWk0Htik3J/w@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 1379 bytes --]

Avi Kivity wrote:
> Laurent Vivier wrote:
>> This patch corrects some errors appearing when we have an emulation
>> failure
>> on an operation using REP prefix.
>>
>> When x86_emulate_insn() fails, saving EIP and ECX is not enough as
>> emulation
>> should have modified other registers like RSI or RDI. Moreover, the
>> emulation
>> can fail on the writeback, and in this case we are not able to restore
>> registers.
>>
>> This patch takes another approach: at the beginning of
>> x86_emulate_insn() we restore state we have at end of
>> x86_decode_insn(). To do that, we store EIP in
>> a new field in decode_cache, decode_eip. This field store the EIP as
>> it is at
>> the end of x86_decode_insn(); and at beginning of x86_emulate_insn(),
>> we restore
>> all registers as they are in vcpu. We can do that, because the
>> x86_decode_insn()
>> doesn't modify registers (except EIP).
>>   
> 
> How about doing it slightly differently: keep c->eip at its current
> meaning, and add c->eip_orig to revert to? That will make the patch
> smaller and reduce the changes of something being missed.

I didn't do like that because I was afraid to miss some points to restore orig_eip.

But a patch will follow...

Laurent
-- 
------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org  --------------
          "Software is hard" - Donald Knuth


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #3: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

  parent reply	other threads:[~2007-10-01  8:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27 21:34 [PATCH] Correct management of REP prefix Laurent Vivier
     [not found] ` <1190928863669-git-send-email-Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
2007-09-30  9:06   ` Avi Kivity
     [not found]     ` <46FF6702.2060203-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-10-01  8:55       ` Laurent Vivier [this message]
     [not found]         ` <4700B611.1000803-6ktuUTfB/bM@public.gmane.org>
2007-10-02  6:14           ` Avi Kivity
2007-10-01  9:01   ` Laurent Vivier
     [not found]     ` <11912292661049-git-send-email-Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
2007-10-02  6:11       ` Avi Kivity
2007-10-02 22:23       ` Kamble, Nitin A
     [not found]         ` <5461330FA59EDB46BE9AB8AAF2C431AD055A4295-1a9uaKK1+wJcIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-10-03  7:23           ` Laurent Vivier
     [not found]             ` <4703438A.6010307-6ktuUTfB/bM@public.gmane.org>
2007-10-03 17:10               ` Kamble, Nitin A

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=4700B611.1000803@bull.net \
    --to=laurent.vivier-6ktuutfb/bm@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox