From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Vivier Subject: Re: [PATCH] Correct management of REP prefix Date: Mon, 01 Oct 2007 10:55:45 +0200 Message-ID: <4700B611.1000803@bull.net> References: <1190928863669-git-send-email-Laurent.Vivier@bull.net> <46FF6702.2060203@qumranet.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0677567893==" Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Avi Kivity Return-path: In-Reply-To: <46FF6702.2060203-atKUWr5tajBWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --===============0677567893== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigDE0A399C478476AC6354BE3C" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDE0A399C478476AC6354BE3C Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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). >> =20 >=20 > 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 --=20 ------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org -------------- "Software is hard" - Donald Knuth --------------enigDE0A399C478476AC6354BE3C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.7 (GNU/Linux) iD8DBQFHALYb9Kffa9pFVzwRAkMJAJ9BOiCWOSIqWnupeTn5Av79AuvjGgCglr1P PlZ4ZbDWkRiCFRFlsCDojXM= =SAWd -----END PGP SIGNATURE----- --------------enigDE0A399C478476AC6354BE3C-- --===============0677567893== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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/ --===============0677567893== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --===============0677567893==--