From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgxIl-0002eB-Nb for qemu-devel@nongnu.org; Tue, 19 Jun 2012 08:13:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgxIf-00035D-HD for qemu-devel@nongnu.org; Tue, 19 Jun 2012 08:12:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49142 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgxIf-000355-AX for qemu-devel@nongnu.org; Tue, 19 Jun 2012 08:12:49 -0400 Message-ID: <4FE06CB9.6000202@suse.de> Date: Tue, 19 Jun 2012 14:12:41 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <20120618074756.GA47810@cs.nctu.edu.tw> <4FDEFC6F.10104@suse.de> <20120619090230.GA39361@cs.nctu.edu.tw> <4FE04C66.2070203@suse.de> <20120619115403.GA49013@cs.nctu.edu.tw> In-Reply-To: <20120619115403.GA49013@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 Am 19.06.2012 13:54, schrieb =E9=99=B3=E9=9F=8B=E4=BB=BB (Wei-Ren Chen): >> If you only have one CPU then using first_cpu->some_field1 should be >> almost as easy. :) >=20 > I am afraid first_cpu (CPUArchState) is got poisoned, too. :/ > Even I comment out CPUArchState from poison.h, >=20 > --- vl.c > extern CPUArchState *first_cpu; >=20 > static void main_loop(void) > { > ... snip ... >=20 > printf("%d", first_cpu->created); > } > --- >=20 > I still get compilation error below, >=20 > --- > /tmp/chenwj/qemu/vl.c:1548:20: error: expected '=3D', ',', ';', 'asm' o= r '__attribute__' before '*' token > /tmp/chenwj/qemu/vl.c: In function 'main_loop': > /tmp/chenwj/qemu/vl.c:1568:18: error: 'first_cpu' undeclared (first use= in this function) > --- >=20 > Any thought on what I am missing? Thanks. Sorry, my mistake: vl.c is not compiled per-target like I thought but per target_phys_addr_t in libhwX, thus it cannot access cpu.h or CPUArchState (only CPUState). That means evaluations of fields in CPUARMState need to be done in target-arm/ and you might want to check the Notifiers or in the worst case _atexit() to hook some callback function up. With QOM CPUState there's finalizers in theory but I don't think they get called yet for anything except linux-user thread exit. 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