From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KILiU-0004M3-6y for qemu-devel@nongnu.org; Mon, 14 Jul 2008 06:55:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KILiS-0004IE-EW for qemu-devel@nongnu.org; Mon, 14 Jul 2008 06:55:37 -0400 Received: from [199.232.76.173] (port=44608 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KILiS-0004Hx-5A for qemu-devel@nongnu.org; Mon, 14 Jul 2008 06:55:36 -0400 Received: from mail2.shareable.org ([80.68.89.115]:55870) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KILiR-0004rh-HF for qemu-devel@nongnu.org; Mon, 14 Jul 2008 06:55:35 -0400 Received: from jamie by mail2.shareable.org with local (Exim 4.63) (envelope-from ) id 1KILiN-0000jP-TH for qemu-devel@nongnu.org; Mon, 14 Jul 2008 11:55:31 +0100 Date: Mon, 14 Jul 2008 11:55:31 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [RFC][PATCH] x86: Optional segment type and limit checks - v2 Message-ID: <20080714105531.GB2381@shareable.org> References: <4874AB47.9090208@siemens.com> <487B2BC8.9050804@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <487B2BC8.9050804@siemens.com> 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 Jan Kiszka wrote: > This is the second version of my segment type and register check. It > reduces the impact on the translator code significantly, and it also > fixes a bug of the "size" helper variant in the previous version. > > The idea of this patch is to generate calls to a check helper only in > case the user requested this support via "-seg-checks". This feature > remains off by default as most x86 OSes do not care about protection via > segmentation anymore (and it was even removed from 64-bit modes by the > CPU vendors). Moreover, checking the segment type and limit on every > memory access is nothing that makes QEMU faster, so you will only want > this if you are looking for very accurate emulation. > > On Fabrice's request I tried to find the conditions which allow enabling > -seg-checks by default but kicking it out most of the time during code > translation. That works for 64-bit mode, of course, but I still see no > clear indication for the case that 32-bit guests are not interested in > type checking specifically. If you see one, let me know. Some 32-bit guests effectively disable segment range calculations checks by setting the maximum limit and zero offset. Apparently, this is faster on some real CPUs too. Could type checking be done at translation time, including the segment types in the translation cache key? For guests like older Linux, with zero base and non-maximum limit in user mode, could limit checking be done by the MMU TLB instead? -- Jamie