From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJayi-0005IO-3k for qemu-devel@nongnu.org; Thu, 17 Jul 2008 17:25:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJayf-0005Gh-LH for qemu-devel@nongnu.org; Thu, 17 Jul 2008 17:25:30 -0400 Received: from [199.232.76.173] (port=37571 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJayf-0005GS-Cw for qemu-devel@nongnu.org; Thu, 17 Jul 2008 17:25:29 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:48250) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KJaye-00076H-LZ for qemu-devel@nongnu.org; Thu, 17 Jul 2008 17:25:29 -0400 Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate03.web.de (Postfix) with ESMTP id CB425E430ADA for ; Thu, 17 Jul 2008 23:25:25 +0200 (CEST) Received: from [88.65.255.225] (helo=[192.168.1.198]) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1KJayb-0001nv-00 for qemu-devel@nongnu.org; Thu, 17 Jul 2008 23:25:25 +0200 Message-ID: <487FB8C0.4030008@web.de> Date: Thu, 17 Jul 2008 23:25:20 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <487F3393.3040609@siemens.com> <487F51E1.9070102@bellard.org> <487F73AE.50509@siemens.com> In-Reply-To: <487F73AE.50509@siemens.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig625C95928DA1F5A9E73EA582" Sender: jan.kiszka@web.de Subject: [Qemu-devel] Re: [RFC][PATCH] x86: CS limit checks Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig625C95928DA1F5A9E73EA582 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Jan Kiszka wrote: > Fabrice Bellard wrote: >> Jan Kiszka wrote: >>> Here is a proposal for adding code segment limit checks to x86. This >>> patch should not need the -seg-checks switch as its tests are mostly >>> performed during translation time. Moreover, I tried to confine the >>> small additional overhead in the TB lookup procedure to x86 and Sparc= =2E >>> >>> Note that this patch depends on my debugging series, namely [1], as t= hat >>> one reduces the x86-specific code passages for TB generation. Also no= te >>> that this patch is early and only lightly tested so far, not yet >>> intended for inclusion, but definitely for commenting on! >> Using more than 32 bits for cs_limit (and cs_base) in the TB is >> wasteful, so I strongly suggest to use a uint32_t type. In that case, >> cs_limit must be explicitely ignored in 64 bit code. >> >> @@ -172,6 +173,8 @@ static inline TranslationBlock *tb_find_ >> flags =3D env->hflags; >> flags |=3D (env->eflags & (IOPL_MASK | TF_MASK | VM_MASK)); >> cs_base =3D env->segs[R_CS].base; >> + if ((env->hflags & (HF_PE_MASK | HF_CS64_MASK)) =3D=3D HF_PE_MASK= ) >> + cs_limit =3D env->segs[R_CS].limit; >> pc =3D cs_base + env->eip; >> >> This test should be suppressed for performance reasons. >=20 > Yes, the test should be moved to the translator code. This will also > allow to reduce the width of cs_base/limit. cs_base must remain target_ulong - sparc relies on it for storing npc. Jan --------------enig625C95928DA1F5A9E73EA582 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkh/uMUACgkQniDOoMHTA+n3pACfQCfoKGMjgYIzuY27TIqNkvGn wbQAn2rOVZl9mRs4Syh1zXuRu29I1xbe =jZXd -----END PGP SIGNATURE----- --------------enig625C95928DA1F5A9E73EA582--