From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJ4Rg-000773-21 for qemu-devel@nongnu.org; Sun, 08 May 2011 09:54:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJ4Rf-0001Oa-16 for qemu-devel@nongnu.org; Sun, 08 May 2011 09:54:51 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:46614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJ4Re-0001OV-Pv for qemu-devel@nongnu.org; Sun, 08 May 2011 09:54:50 -0400 Received: by gwb19 with SMTP id 19so1896973gwb.4 for ; Sun, 08 May 2011 06:54:50 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <19735.38079.qm@web38403.mail.mud.yahoo.com> <413381.49201.qm@web38404.mail.mud.yahoo.com> Date: Sun, 8 May 2011 14:54:49 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Binary translation (of code) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tarmo Pikaro Cc: Blue Swirl , qemu-devel@nongnu.org On Sun, May 8, 2011 at 2:46 PM, Blue Swirl wrote: > On Sun, May 8, 2011 at 4:05 PM, Tarmo Pikaro wrote: >> >>> In general, this is not possible. Consider for example self-modifying >>> or otherwise dynamically created code, or just code that examines >>> itself. >> >>> In some specific trivial cases it could work, and QEMU could be made >>> to abort if translation would be needed. >> >> I think self-modifying=A0code is kinda rare case - it's made typically f= or >> protection againt=A0hackers , and=A0typically on pc side. Nintendo=A0rom= s probably >> don't use this kind of >> protection. > > It doesn't have to be protection, for example GCC generates > trampolines to stack when using nested functions. An example related to console games is that Gameboy games copy some routines into RAM and jump into them during one phase of the screen refresh because of hardware limitations. I forget the details but I think you cannot access ROM during some part of the screen refresh, even for code execution. This would break if you statically translated the ROM. Console games do whacky things. Stefan