From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDAzK-0004Qa-VQ for qemu-devel@nongnu.org; Thu, 09 Jul 2015 08:31:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDAzF-0005E3-PZ for qemu-devel@nongnu.org; Thu, 09 Jul 2015 08:31:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41214 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDAzF-0005Dt-It for qemu-devel@nongnu.org; Thu, 09 Jul 2015 08:31:33 -0400 Message-ID: <559E69A3.2020000@suse.de> Date: Thu, 09 Jul 2015 14:31:31 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Virtualising qmp_query_cpus() arch specifics List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , "qemu-devel@nongnu.org Developers" Cc: Paolo Bonzini , Markus Armbruster , Michael Roth Am 09.07.2015 um 08:36 schrieb Peter Crosthwaite: > Hi All, >=20 > So for my multi-arch work, one of the eventual requirements is to > remove all #define TARGET_FOO from core code. I came across this in > cpus.c/qmp_query_cpus(): >=20 > #if defined(TARGET_I386) > X86CPU *x86_cpu =3D X86_CPU(cpu); > CPUX86State *env =3D &x86_cpu->env; > #elif defined(TARGET_PPC) > PowerPCCPU *ppc_cpu =3D POWERPC_CPU(cpu); > CPUPPCState *env =3D &ppc_cpu->env; > ... >=20 > #if defined(TARGET_I386) > info->value->has_pc =3D true; > info->value->pc =3D env->eip + env->segs[R_CS].base; > #elif defined(TARGET_PPC) > info->value->has_nip =3D true; > info->value->nip =3D env->nip; > ... >=20 > This should probably be a QOM CPU virtual function. What makes me > uneasy about it however, is a direct implementation means the QAPI > autogenerated CPUInfoList struct would need to be exposed to > target-foo/cpu.c. Is this ok or an abstraction fail? Do we need some > other other minimal struct to communicate between target-foo and QMP > with these particulars? Any third options? Wouldn't that just be a get_pc() matching your set_pc() hook? Unfortunately there's name differences above, pc vs. nip. Maybe we can just use a generic field and keep #ifdef stuff only as legacy compat? Cheers, Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Felix Imend=C3=B6rffer, Jane Smithard, Dilip Upmanyu, Graham Norton; = HRB 21284 (AG N=C3=BCrnberg)