1. 11 3月, 2015 6 次提交
    • E
      cpu: Make cpu_init() return QOM CPUState object · 2994fd96
      Eduardo Habkost 提交于
      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: NEduardo 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: NAndreas Färber <afaerber@suse.de>
      2994fd96
    • E
      unicore32: Use uc32_cpu_init() · c3898f77
      Eduardo Habkost 提交于
      Instead of using the legacy cpu_init() function, use uc32_cpu_init() to
      create a UniCore32CPU object.
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      c3898f77
    • E
      m68k: Use cpu_m68k_init() · eeff620f
      Eduardo Habkost 提交于
      Instead of using the legacy cpu_init() function, use cpu_m68k_init()
      directly to create a M68kCPU object.
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      eeff620f
    • E
      target-unicore32: Make uc32_cpu_init() return UniCore32CPU · 41979669
      Eduardo Habkost 提交于
      This way, the cpu_init() function in target-unicore32 will follow the
      same pattern used on all other architectures.
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      41979669
    • M
      target-i386: Clean up misuse of qdev_init() in realize method · 6e8e2651
      Markus Armbruster 提交于
      x86_cpu_apic_realize() calls qdev_init() to realize the APIC.
      qdev_init()'s error handling has unwanted side effects: it unparents
      the device, and it calls qerror_report_err().
      
      qerror_report_err() is always inappropriate in realize methods,
      because it doesn't return the Error object.  It either reports the
      error to stderr or the human monitor, or it stores it in the QMP
      monitor, where it makes the QMP command fail even though the realize
      method succeeded.
      
      Fortunately, qdev_init() can't actually fail here, because realize
      can't fail for any of the three possible APIC device models.
      
      Clean up by cutting out the qdev_init() middle-man: set property
      "realized" directly.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      6e8e2651
    • P
      cpu: Add missing documentation for some CPUClass methods · c08295d4
      Peter Maydell 提交于
      The CPUClass QOM methods virtio_is_big_endian, write_elf{32,64}_note
      and write_elf{32,64}_qemunote were added without any description
      being added to the doc comment. Correct this omission.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Acked-by: NGreg Kurz <gkurz@linux.vnet.ibm.com>
      Signed-off-by: NAndreas Färber <afaerber@suse.de>
      c08295d4
  2. 10 3月, 2015 34 次提交