From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40847 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PgPfS-0005vH-PX for qemu-devel@nongnu.org; Fri, 21 Jan 2011 17:41:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PgPfQ-0007wk-Q1 for qemu-devel@nongnu.org; Fri, 21 Jan 2011 17:41:17 -0500 Received: from mail-yx0-f173.google.com ([209.85.213.173]:34240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PgPfQ-0007wb-NN for qemu-devel@nongnu.org; Fri, 21 Jan 2011 17:41:16 -0500 Received: by yxl31 with SMTP id 31so753298yxl.4 for ; Fri, 21 Jan 2011 14:41:15 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <4D35D84F.5070501@gmail.com> References: <4D355D75.6070004@gmail.com> <4D35D84F.5070501@gmail.com> Date: Sat, 22 Jan 2011 06:41:15 +0800 Message-ID: Subject: Re: [Qemu-devel] Changing the content of target cpu registers From: =?ISO-8859-1?Q?Rapha=EBl_Lef=E8vre?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Blue Swirl , QEMU Developers On Wed, Jan 19, 2011 at 2:13 AM, Stefano Bonifazi wrote: > On 01/18/2011 06:17 PM, Blue Swirl wrote: >> >> On Tue, Jan 18, 2011 at 9:29 AM, Stefano Bonifazi >> =A0wrote: >>> >>> Hi all! >>> =A0I am working on qemu-user (qemu-ppc). >>> I'd like to edit the values of target registers during the execution. C= an >>> I >>> do that by simply changing the content of env->gpr[] or do these only >>> contain a copy of the values of the registers? >>> In this last case, where are the real values of the target registers >>> stored >>> so that by modifying them I can alter the behavior of the target code >>> execution? >> >> env->gpr is the canonical location, but the translator assigns TCG >> variables to them (cpu_gpr[] in translate.c), so GPR contents may be >> cached to these. But when helpers are called or the TB finishes, >> env->gpr should be valid again. > > Hi! > =A0Thank you for your answer! > So if I understand well if I set env->gpr in a code section where there i= s > no TCG translation on progress, I can edit directly the target CPU regist= er > right? > Best Regards! > Stefano B. > > In fact, I need to apologize for my poor comprehension to your questions even after digesting the explinations from Blue Swirl. By tracing code of qemu, "env->gpr" should be able to be modified any place directly(or indirectly) whether the TCG involved or not.