From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgYm3-0004Sp-1y for qemu-devel@nongnu.org; Mon, 18 Jun 2012 06:01:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgYlw-0000ka-PT for qemu-devel@nongnu.org; Mon, 18 Jun 2012 06:01:30 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55737 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgYlw-0000kC-J3 for qemu-devel@nongnu.org; Mon, 18 Jun 2012 06:01:24 -0400 Message-ID: <4FDEFC6F.10104@suse.de> Date: Mon, 18 Jun 2012 12:01:19 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <20120618074756.GA47810@cs.nctu.edu.tw> In-Reply-To: <20120618074756.GA47810@cs.nctu.edu.tw> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Any better way to access CPUArchState in vl.c? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?IumZs+mfi+S7uyAoV2VpLVJlbiBDaGVuKSI=?= Cc: qemu-devel@nongnu.org Hi Wei-Ren, Am 18.06.2012 09:47, schrieb =E9=99=B3=E9=9F=8B=E4=BB=BB (Wei-Ren Chen): > Say I want to print env->some_field in vl.c. I #include "dyngen-exec.= h" > in vl.c, but got compilation error immediately. >=20 > /tmp/chenwj/qemu/dyngen-exec.h:64:10: error: attempt to use poisoned = "CPUArchState" > /tmp/chenwj/qemu/dyngen-exec.h:64:23: error: expected '=3D', ',', ';'= , 'asm' or '__attribute__' before '*' token > /tmp/chenwj/qemu/dyngen-exec.h:64:24: error: attempt to use poisoned = "env" >=20 > After googling, I figure out QEMU poison some identifiers which cannot = be used > in target indenpent code. Although we can get some_field by the followi= ng way, >=20 > int some_field =3D &env->some_field; >=20 > but it's not very convenient if we have many field of CPUState want to = access. Is > there a better way to do so? Thanks! Poisoned is the "env" variable. You cannot just #include "dyngen-exec.h" and expect it to be usable since AREG0 targets don't guarantee it's set properly (may be NULL even with traditional targets at times). CPUArchState should currently be usable in vl.c, you just need explicit access to it (e.g., a function argument). Question is, what are you trying to do? In particular, of which CPU (think SMP) are you trying to print ->some_field? :) Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg