Eduardo Habkost
2994fd96d9
cpu: Make cpu_init() return QOM CPUState object
Instead of making cpu_init() return CPUArchState, return CPUState.
Changes were made using the Coccinelle semantic patch below.
@@
typedef CPUState;
identifier e;
expression args;
type CPUArchState;
@@
- e =
+ cpu =
cpu_init(args);
- if (!e) {
+ if (!cpu) {
...
}
- cpu = ENV_GET_CPU(env);
+ e = cpu->env_ptr;
@@
identifier new_env, new_cpu, env, cpu;
type CPUArchState;
expression args;
@@
-{
- CPUState *cpu = ENV_GET_CPU(env);
- CPUArchState *new_env = cpu_init(args);
- CPUState *new_cpu = ENV_GET_CPU(new_env);
+{
+ CPUState *cpu = ENV_GET_CPU(env);
+ CPUState *new_cpu = cpu_init(args);
+ CPUArchState *new_env = new_cpu->env_ptr;
...
}
@@
identifier c, cpu_init_func, cpu_model;
type StateType, CPUType;
@@
-static inline StateType* cpu_init(const char *cpu_model)
-{
- CPUType *c = cpu_init_func(cpu_model);
(
- if (c == NULL) {
- return NULL;
- }
- return &c->env;
|
- if (c) {
- return &c->env;
- }
- return NULL;
)
-}
+#define cpu_init(cpu_model) CPU(cpu_init_func(cpu_model))
@@
identifier cpu_init_func;
identifier model;
@@
-#define cpu_init(model) (&cpu_init_func(model)->env)
+#define cpu_init(model) CPU(cpu_init_func(model))
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael Walle <michael@walle.cc>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Cc: Anthony Green <green@moxielogic.com>
Cc: Jia Liu <proljc@gmail.com>
Cc: Alexander Graf <agraf@suse.de>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: Max Filippov <jcmvbkbc@gmail.com>
[AF: Fixed up cpu_copy() manually]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-03-10 17:33:51 +01:00
..
2014-06-16 13:24:36 +02:00
2015-03-09 15:00:08 +01:00
2015-03-09 15:00:08 +01:00
2014-09-25 18:54:22 +01:00
2015-03-10 17:33:51 +01:00
2014-06-24 20:01:24 +04:00
2014-09-25 18:54:22 +01:00
2015-01-07 16:16:25 +01:00
2014-07-08 12:10:36 +02:00
2014-04-08 11:20:05 +02:00
2015-01-07 16:16:27 +01:00
2014-11-04 23:26:15 +01:00
2013-09-02 10:06:42 +02:00
2014-09-08 12:50:47 +02:00
2013-07-01 01:11:14 +02:00
2015-01-12 10:14:04 +01:00
2015-03-09 15:00:05 +01:00
2014-06-16 13:24:29 +02:00
2015-01-07 16:16:27 +01:00
2011-12-02 10:50:57 +00:00
2007-09-16 21:08:06 +00:00
2015-03-09 15:00:05 +01:00
2015-03-09 15:00:05 +01:00
2014-12-16 18:43:19 +00:00
2014-03-13 19:20:48 +01:00
2015-03-09 15:00:08 +01:00
2015-03-09 14:59:53 +01:00
2014-03-05 03:06:23 +01:00
2014-05-28 09:33:54 -07:00
2015-03-09 15:00:07 +01:00
2015-03-09 15:00:03 +01:00
2014-03-13 19:20:46 +01:00