diff options
author | Peter Maydell | 2017-09-01 18:28:54 +0200 |
---|---|---|
committer | Peter Maydell | 2017-09-01 18:28:54 +0200 |
commit | 32f0f68bb77289b75a82925f712bb52e16eac3ba (patch) | |
tree | 5b1ef822b632fbf483ea3c7c8a1c2cc391230e65 /qom/cpu.c | |
parent | Merge remote-tracking branch 'remotes/elmarco/tags/tidy-pull-request' into st... (diff) | |
parent | ppc: replace cpu_ppc_init() with cpu_generic_init() (diff) | |
download | qemu-32f0f68bb77289b75a82925f712bb52e16eac3ba.tar.gz qemu-32f0f68bb77289b75a82925f712bb52e16eac3ba.tar.xz qemu-32f0f68bb77289b75a82925f712bb52e16eac3ba.zip |
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging
x86, cpu queue, 2017-09-01
CPU creation refactor plus x86 patches.
# gpg: Signature made Fri 01 Sep 2017 15:59:02 BST
# gpg: using RSA key 0x2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6
* remotes/ehabkost/tags/x86-and-machine-pull-request: (29 commits)
ppc: replace cpu_ppc_init() with cpu_generic_init()
unicore32: replace uc32_cpu_init() with cpu_generic_init()
openrisc: replace cpu_openrisc_init() with cpu_generic_init()
moxie: replace cpu_moxie_init() with cpu_generic_init()
lm32: replace cpu_lm32_init() with cpu_generic_init()
x86: replace cpu_x86_init() with cpu_generic_init()
cris: replace cpu_cris_init() with cpu_generic_init()
arm: replace cpu_arm_init() with cpu_generic_init()
sh4: replace cpu_sh4_init() with cpu_generic_init()
tricore: replace cpu_tricore_init() with cpu_generic_init()
xtensa: replace cpu_xtensa_init() with cpu_generic_init()
tilegx: replace cpu_tilegx_init() with cpu_generic_init()
nios2: replace cpu_nios2_init() with cpu_generic_init()
microblaze: replace cpu_mb_init() with cpu_generic_init()
m68k: replace cpu_m68k_init() with cpu_generic_init()
hppa: replace cpu_hppa_init() with cpu_generic_init()
alpha: replace cpu_alpha_init() with cpu_generic_init()
s390x: replace cpu_s390x_init() with cpu_generic_init()
sparc: replace cpu_sparc_init() with cpu_generic_init()
sparc: make cpu feature parsing property based
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qom/cpu.c')
-rw-r--r-- | qom/cpu.c | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -34,7 +34,7 @@ CPUInterruptHandler cpu_interrupt_handler; -bool cpu_exists(int64_t id) +CPUState *cpu_by_arch_id(int64_t id) { CPUState *cpu; @@ -42,36 +42,39 @@ bool cpu_exists(int64_t id) CPUClass *cc = CPU_GET_CLASS(cpu); if (cc->get_arch_id(cpu) == id) { - return true; + return cpu; } } - return false; + return NULL; +} + +bool cpu_exists(int64_t id) +{ + return !!cpu_by_arch_id(id); } CPUState *cpu_generic_init(const char *typename, const char *cpu_model) { - char *str, *name, *featurestr; CPUState *cpu = NULL; ObjectClass *oc; CPUClass *cc; Error *err = NULL; + gchar **model_pieces; - str = g_strdup(cpu_model); - name = strtok(str, ","); + model_pieces = g_strsplit(cpu_model, ",", 2); - oc = cpu_class_by_name(typename, name); + oc = cpu_class_by_name(typename, model_pieces[0]); if (oc == NULL) { - g_free(str); + g_strfreev(model_pieces); return NULL; } cc = CPU_CLASS(oc); - featurestr = strtok(NULL, ","); /* TODO: all callers of cpu_generic_init() need to be converted to * call parse_features() only once, before calling cpu_generic_init(). */ - cc->parse_features(object_class_get_name(oc), featurestr, &err); - g_free(str); + cc->parse_features(object_class_get_name(oc), model_pieces[1], &err); + g_strfreev(model_pieces); if (err != NULL) { goto out; } |