qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/4] cpu: Make cpu_init() return QOM object


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 4/4] cpu: Make cpu_init() return QOM object
Date: Tue, 10 Mar 2015 17:23:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

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;


Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]