From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJTJU-0006e6-8w for qemu-devel@nongnu.org; Thu, 17 Jul 2008 09:14:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJTJR-0006bt-3e for qemu-devel@nongnu.org; Thu, 17 Jul 2008 09:14:27 -0400 Received: from [199.232.76.173] (port=59628 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJTJQ-0006bk-Cm for qemu-devel@nongnu.org; Thu, 17 Jul 2008 09:14:24 -0400 Received: from gecko.sbs.de ([194.138.37.40]:21024) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KJTJP-0005ve-UM for qemu-devel@nongnu.org; Thu, 17 Jul 2008 09:14:24 -0400 Message-ID: <487F45AB.6070906@siemens.com> Date: Thu, 17 Jul 2008 15:14:19 +0200 From: Jan Kiszka MIME-Version: 1.0 Subject: Re: [Qemu-devel] [RFC][PATCH] x86: CS limit checks References: <487F3393.3040609@siemens.com> <200807171317.42420.paul@codesourcery.com> In-Reply-To: <200807171317.42420.paul@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org Paul Brook wrote: > On Thursday 17 July 2008, Jan Kiszka wrote: >> + if (s->pc < s->cs_base || s->pc - s->cs_base > s->cs_limit) { >> + /* At least some of the opcode fetches violate the CS limit. >> + Overwrite the generated code with a GPF raising one. */ >> + gen_opc_ptr = gen_opc_start; >> + gen_opparam_ptr = gen_opparam_start; >> + gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base); >> + } > > I'm fairly sure this is wrong. The TB may fault before it gets to the end of > the segment. Likewise if the instruction spanning the limit happens to be an > illegal op you will generate the wrong kind of exception. What a pity, it looked so easy. OK, will think about those aspects again. BTW, what happens when the translator hits an unresolvable address and faults? Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux