qemu-e2k/target-s390x
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
..
arch_dump.c target-s390x: Add missing 'static' and 'const' attributes 2014-03-27 19:22:48 +04:00
cc_helper.c target-s390x: fix and optimize slb* and slbg* computation of carry/borrow flag 2015-02-03 12:27:05 -08:00
cpu-qom.h s390x/migration: migrate CPU state 2014-10-10 13:31:51 +02:00
cpu.c s390x/migration: migrate CPU state 2014-10-10 13:31:51 +02:00
cpu.h cpu: Make cpu_init() return QOM CPUState object 2015-03-10 17:33:51 +01:00
fpu_helper.c softmmu: introduce cpu_ldst.h 2014-06-05 16:10:33 +02:00
gdbstub.c s390x/gdb: coding style fixes 2014-09-01 09:45:19 +02:00
helper.c s390x/helper: Remove s390_cpu_physical_memory_map 2015-02-18 09:37:15 +01:00
helper.h target-s390: Implement LURA, LURAG, STURG 2015-02-03 12:06:37 -08:00
insn-data.def target-s390: Implement ECAG 2015-02-03 12:06:37 -08:00
insn-format.def target-s390: Add format based disassassmbly infrastructure 2013-01-05 12:00:27 -08:00
int_helper.c tcg: Invert the inclusion of helper.h 2014-05-28 09:33:54 -07:00
interrupt.c s390x: Fix sclp console input 2014-11-05 12:01:28 +01:00
ioinst.c s390x/ioinst: Rework memory access in TPI instruction 2015-02-18 09:37:15 +01:00
ioinst.h s390x/ioinst: Rework memory access in TPI instruction 2015-02-18 09:37:15 +01:00
kvm.c Remove superfluous '\n' around error_report() 2015-03-10 08:15:33 +03:00
machine.c s390x/migration: migrate CPU state 2014-10-10 13:31:51 +02:00
Makefile.objs s390x/mmu: Move mmu_translate() and friends to separate file 2015-02-18 09:36:38 +01:00
mem_helper.c s390x/mmu: Skip exceptions properly when translating addresses for debug 2015-02-18 09:37:14 +01:00
misc_helper.c s390x/ipl: support diagnose 308 subcodes 5 and 6 2015-02-13 16:14:09 +01:00
mmu_helper.c s390x/mmu: Add function for accessing guest memory 2015-02-18 09:37:15 +01:00
translate.c tcg: Introduce tcg_op_buf_count and tcg_op_buf_full 2015-02-12 21:21:38 -08:00