Message ID | 54FF1A76.50500@suse.de |
---|---|
State | New |
Headers | show |
On Tue, Mar 10, 2015 at 05:23:18PM +0100, Andreas Färber wrote: > Am 10.03.2015 um 17:16 schrieb Andreas Färber: > > Am 26.02.2015 um 21:37 schrieb Eduardo Habkost: > >> Instead of making cpu_init() return CPUArchState, return a CPU object. > >> > > [snip] > > > > 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:29: > > /home/andreas/QEMU/qemu-cpu/linux-user/main.c: In function ‘cpu_copy’: > > /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 ‘CPU’ > > #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 ‘cpu_init’ > > CPUArchState *new_env = 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 > > The following fixes it for me: > > 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 = ENV_GET_CPU(env); > - CPUArchState *new_env = cpu_init(cpu_model); > - CPUState *new_cpu = ENV_GET_CPU(new_env); > + CPUState *new_cpu = cpu_init(cpu_model); > + CPUArchState *new_env = 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).
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 = ENV_GET_CPU(env); - CPUArchState *new_env = cpu_init(cpu_model); - CPUState *new_cpu = ENV_GET_CPU(new_env); + CPUState *new_cpu = cpu_init(cpu_model); + CPUArchState *new_env = cpu->env_ptr; CPUBreakpoint *bp; CPUWatchpoint *wp;