Received: from eggs.gnu.org ([2001:4830:134:3::10]:38385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVN8x-0004dR-N9 for qemu-devel@nongnu.org; Tue, 10 Mar 2015 12:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVN8v-0001EM-Qx for qemu-devel@nongnu.org; Tue, 10 Mar 2015 12:36:31 -0400 Date: Tue, 10 Mar 2015 13:35:45 -0300 From: Eduardo Habkost Message-ID: <20150310163545.GF3513@thinpad.lan.raisama.net> References: <1424983069-14080-1-git-send-email-ehabkost@redhat.com> <1424983069-14080-5-git-send-email-ehabkost@redhat.com> <54FF18E5.4020207@suse.de> <54FF1A76.50500@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <54FF1A76.50500@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 4/4] cpu: Make cpu_init() return QOM object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Peter Maydell , Jia Liu , Bastian Koppelmann , Anthony Green , Riku Voipio , qemu-devel@nongnu.org, Alexander Graf , Blue Swirl , Max Filippov , Michael Walle , qemu-ppc@nongnu.org, "Edgar E. Iglesias" , Paolo Bonzini , Guan Xuetao , Leon Alrae , Aurelien Jarno , Richard Henderson On Tue, Mar 10, 2015 at 05:23:18PM +0100, Andreas F=C3=A4rber wrote: > Am 10.03.2015 um 17:16 schrieb Andreas F=C3=A4rber: > > Am 26.02.2015 um 21:37 schrieb Eduardo Habkost: > >> Instead of making cpu_init() return CPUArchState, return a CPU objec= t. > >> > > [snip] > >=20 > > In file included from > > /home/andreas/QEMU/qemu-cpu/include/exec/cpu-all.h:26:0, > > from /home/andreas/QEMU/qemu-cpu/target-alpha/cpu.h:= 296, > > from /home/andreas/QEMU/qemu-cpu/linux-user/qemu.h:7= , > > from /home/andreas/QEMU/qemu-cpu/linux-user/main.c:2= 9: > > /home/andreas/QEMU/qemu-cpu/linux-user/main.c: In function =E2=80=98c= pu_copy=E2=80=99: > > /home/andreas/QEMU/qemu-cpu/include/qom/cpu.h:60:18: error: > > initialization from incompatible pointer type [-Werror] > > #define CPU(obj) ((CPUState *)(obj)) > > ^ > > /home/andreas/QEMU/qemu-cpu/target-alpha/cpu.h:432:29: note: in > > expansion of macro =E2=80=98CPU=E2=80=99 > > #define cpu_init(cpu_model) CPU(cpu_alpha_init(cpu_model)) > > ^ > > /home/andreas/QEMU/qemu-cpu/linux-user/main.c:3455:29: note: in > > expansion of macro =E2=80=98cpu_init=E2=80=99 > > CPUArchState *new_env =3D cpu_init(cpu_model); > > ^ > > cc1: all warnings being treated as errors > > /home/andreas/QEMU/qemu-cpu/rules.mak:57: recipe for target > > 'linux-user/main.o' failed > > make[1]: *** [linux-user/main.o] Error 1 >=20 > The following fixes it for me: >=20 > diff --git a/linux-user/main.c b/linux-user/main.c > index dd33665..6bd23af 100644 > --- a/linux-user/main.c > +++ b/linux-user/main.c > @@ -3452,8 +3452,8 @@ void init_task_state(TaskState *ts) > CPUArchState *cpu_copy(CPUArchState *env) > { > CPUState *cpu =3D ENV_GET_CPU(env); > - CPUArchState *new_env =3D cpu_init(cpu_model); > - CPUState *new_cpu =3D ENV_GET_CPU(new_env); > + CPUState *new_cpu =3D cpu_init(cpu_model); > + CPUArchState *new_env =3D cpu->env_ptr; > CPUBreakpoint *bp; > CPUWatchpoint *wp; Oops. That change was supposed to be done by the Coccinelle patch. I am sure that some previous version of the Coccinelle patch was doing it right, but for some reason the latest version (the one I submitted) was broken (and I can't understand why). I guess I shouldn't have insisted in making a pure coccinelle-based patch and should have changed cpu_copy() manually instead (like you just did). --=20 Eduardo