/* NOTE: we need to init the CPU at this stage to get
qemu_host_page_size */
cpu = cpu_init(cpu_model);
- if (!cpu) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
env = cpu->env_ptr;
#if defined(TARGET_SPARC) || defined(TARGET_PPC)
cpu_reset(cpu);
memset(cpus, 0, sizeof(cpus));
for (i = 0; i < smp_cpus; ++i) {
cpus[i] = ALPHA_CPU(cpu_generic_init(TYPE_ALPHA_CPU, cpu_model));
- if (!cpus[i]) {
- error_report("Unable to find CPU definition");
- exit(1);
- }
}
cpus[0]->env.trap_arg0 = ram_size;
cpu_model = "arm926";
}
cpu = ARM_CPU(cpu_generic_init(TYPE_ARM_CPU, cpu_model));
- if (!cpu) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
/* For now we use a fixed - the original - RAM size */
memory_region_allocate_system_memory(ram, NULL, "musicpal.ram",
/* Core */
s->mpu_model = omap310;
s->cpu = ARM_CPU(cpu_generic_init(TYPE_ARM_CPU, core));
- if (s->cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
s->sdram_size = sdram_size;
s->sram_size = OMAP15XX_SRAM_SIZE;
/* Core */
s->mpu_model = omap2420;
s->cpu = ARM_CPU(cpu_generic_init(TYPE_ARM_CPU, core ?: "arm1136-r2"));
- if (s->cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
s->sdram_size = sdram_size;
s->sram_size = OMAP242X_SRAM_SIZE;
revision = "pxa270";
s->cpu = ARM_CPU(cpu_generic_init(TYPE_ARM_CPU, revision));
- if (s->cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
s->reset = qemu_allocate_irq(pxa2xx_reset, s, 0);
/* SDRAM & Internal Memory Storage */
s = g_new0(PXA2xxState, 1);
s->cpu = ARM_CPU(cpu_generic_init(TYPE_ARM_CPU, "pxa255"));
- if (s->cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
s->reset = qemu_allocate_irq(pxa2xx_reset, s, 0);
/* SDRAM & Internal Memory Storage */
s->cpu = ARM_CPU(cpu_generic_init(TYPE_ARM_CPU, rev));
- if (!s->cpu) {
- error_report("Unable to find CPU definition");
- exit(1);
- }
-
memory_region_allocate_system_memory(&s->sdram, NULL, "strongarm.sdram",
sdram_size);
memory_region_add_subregion(sysmem, SA_SDCS0, &s->sdram);
cpu_model = "lm32-full";
}
cpu = LM32_CPU(cpu_generic_init(TYPE_LM32_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model);
- exit(1);
- }
env = &cpu->env;
reset_info->cpu = cpu;
cpu_model = "lm32-full";
}
cpu = LM32_CPU(cpu_generic_init(TYPE_LM32_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model);
- exit(1);
- }
env = &cpu->env;
reset_info->cpu = cpu;
cpu_model = "lm32-full";
}
cpu = LM32_CPU(cpu_generic_init(TYPE_LM32_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model);
- exit(1);
- }
env = &cpu->env;
reset_info->cpu = cpu;
cpu_model = "m5206";
}
cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model));
- if (!cpu) {
- error_report("Unable to find m68k CPU definition");
- exit(1);
- }
env = &cpu->env;
/* Initialize CPU registers. */
cpu_model = "m5208";
}
cpu = M68K_CPU(cpu_generic_init(TYPE_M68K_CPU, cpu_model));
- if (!cpu) {
- fprintf(stderr, "Unable to find m68k CPU definition\n");
- exit(1);
- }
env = &cpu->env;
/* Initialize CPU registers. */
for (i = 0; i < s->num_vp; i++) {
cpu = cpu_mips_init(s->cpu_model);
- if (cpu == NULL) {
- error_setg(errp, "%s: CPU initialization failed", __func__);
- return;
- }
/* Init internal devices */
cpu_mips_irq_init_cpu(cpu);
cpu_model = "Loongson-2E";
}
cpu = cpu_mips_init(cpu_model);
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
env = &cpu->env;
qemu_register_reset(main_cpu_reset, cpu);
cpu_model = "R4000";
}
cpu = cpu_mips_init(cpu_model);
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
env = &cpu->env;
qemu_register_reset(main_cpu_reset, cpu);
for (i = 0; i < smp_cpus; i++) {
cpu = cpu_mips_init(cpu_model);
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
/* Init internal devices */
cpu_mips_irq_init_cpu(cpu);
#endif
}
cpu = cpu_mips_init(cpu_model);
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
env = &cpu->env;
reset_info = g_malloc0(sizeof(ResetData));
#endif
}
cpu = cpu_mips_init(cpu_model);
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
env = &cpu->env;
reset_info = g_malloc0(sizeof(ResetData));
cpu_model = "MoxieLite-moxie-cpu";
}
cpu = MOXIE_CPU(cpu_generic_init(TYPE_MOXIE_CPU, cpu_model));
- if (!cpu) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
env = &cpu->env;
qemu_register_reset(main_cpu_reset, cpu);
for (n = 0; n < smp_cpus; n++) {
cpu = OPENRISC_CPU(cpu_generic_init(TYPE_OPENRISC_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition!\n");
- exit(1);
- }
qemu_register_reset(main_cpu_reset, cpu);
main_cpu_reset(cpu);
}
cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
machine->cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to initialize CPU!\n");
- exit(1);
- }
env = &cpu->env;
cs = CPU(cpu);
for (i = 0; i < smp_cpus; i++) {
cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
machine->cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find PowerPC CPU definition\n");
- exit(1);
- }
env = &cpu->env;
/* Set time-base frequency to 100 Mhz */
for (i = 0; i < smp_cpus; i++) {
cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
machine->cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find PowerPC CPU definition\n");
- exit(1);
- }
env = &cpu->env;
/* Set time-base frequency to 16.6 Mhz */
machine->cpu_model = "440EP";
}
cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, machine->cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to initialize CPU!\n");
- exit(1);
- }
env = &cpu->env;
if (env->mmu_model != POWERPC_MMU_BOOKE) {
/* init CPUs */
cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find PowerPC %s CPU definition\n",
- cpu_model);
- exit(1);
- }
env = &cpu->env;
cpu_clk->cb = NULL; /* We don't care about CPU clock frequency changes */
for (i = 0; i < smp_cpus; i++) {
cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU,
machine->cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find PowerPC CPU definition\n");
- exit(1);
- }
env = &cpu->env;
if (env->flags & POWERPC_FLAG_RTC_CLK) {
machine->cpu_model = "604";
}
cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, machine->cpu_model));
- if (!cpu) {
- error_report("could not initialize CPU '%s'",
- machine->cpu_model);
- exit(1);
- }
env = &cpu->env;
if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) {
error_report("only 6xx bus is supported on this machine");
qemu_irq *irqs;
cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to initialize CPU!\n");
- exit(1);
- }
env = &cpu->env;
ppc_booke_timers_init(cpu, sysclk, 0/* no flags */);
}
cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
env = &cpu->env;
reset_info = g_malloc0(sizeof(ResetData));
cpu_model = "any";
cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(1);
- }
/* Allocate memory space */
memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal);
}
cpu = SPARC_CPU(cpu_generic_init(TYPE_SPARC_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
- exit(1);
- }
env = &cpu->env;
cpu_sparc_set_id(env, 0);
CPUSPARCState *env;
cpu = SPARC_CPU(cpu_generic_init(TYPE_SPARC_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n");
- exit(1);
- }
env = &cpu->env;
cpu_sparc_set_id(env, id);
cpu_model = default_cpu_model;
}
cpu = SPARC_CPU(cpu_generic_init(TYPE_SPARC_CPU, cpu_model));
- if (cpu == NULL) {
- fprintf(stderr, "Unable to find Sparc CPU definition\n");
- exit(1);
- }
env = &cpu->env;
env->tick = cpu_timer_create("tick", cpu, tick_irq,
machine->cpu_model = "tc1796";
}
cpu = TRICORE_CPU(cpu_generic_init(TYPE_TRICORE_CPU, machine->cpu_model));
- if (!cpu) {
- error_report("Unable to find CPU definition");
- exit(1);
- }
env = &cpu->env;
memory_region_init_ram(ext_cram, NULL, "powerlink_ext_c.ram",
2 * 1024 * 1024, &error_fatal);
}
cpu = UNICORE32_CPU(cpu_generic_init(TYPE_UNICORE32_CPU, cpu_model));
- if (!cpu) {
- error_report("Unable to find CPU definition");
- exit(1);
- }
env = &cpu->env;
puv3_soc_init(env);
for (n = 0; n < smp_cpus; n++) {
cpu = XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model));
- if (cpu == NULL) {
- error_report("unable to find CPU definition '%s'",
- cpu_model);
- exit(EXIT_FAILURE);
- }
env = &cpu->env;
env->sregs[PRID] = n;
for (n = 0; n < smp_cpus; n++) {
cpu = XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model));
- if (cpu == NULL) {
- error_report("unable to find CPU definition '%s'",
- cpu_model);
- exit(EXIT_FAILURE);
- }
env = &cpu->env;
env->sregs[PRID] = n;
*
* processes optional parameters and registers them as global properties
*
- * Returns: type of CPU to create or %NULL if an error occurred.
+ * Returns: type of CPU to create or prints error and terminates process
+ * if an error occurred.
*/
const char *cpu_parse_cpu_model(const char *typename, const char *cpu_model);
/* NOTE: we need to init the CPU at this stage to get
qemu_host_page_size */
cpu = cpu_init(cpu_model);
- if (!cpu) {
- fprintf(stderr, "Unable to find CPU definition\n");
- exit(EXIT_FAILURE);
- }
env = cpu->env_ptr;
cpu_reset(cpu);
if (err != NULL) {
error_report_err(err);
object_unref(OBJECT(cpu));
- return NULL;
+ exit(EXIT_FAILURE);
}
return cpu;
}
{
ObjectClass *oc;
CPUClass *cc;
- Error *err = NULL;
gchar **model_pieces;
const char *cpu_type;
oc = cpu_class_by_name(typename, model_pieces[0]);
if (oc == NULL) {
+ error_report("unable to find CPU model '%s'", model_pieces[0]);
g_strfreev(model_pieces);
- return NULL;
+ exit(EXIT_FAILURE);
}
cpu_type = object_class_get_name(oc);
cc = CPU_CLASS(oc);
- cc->parse_features(cpu_type, model_pieces[1], &err);
+ cc->parse_features(cpu_type, model_pieces[1], &error_fatal);
g_strfreev(model_pieces);
- if (err != NULL) {
- error_report_err(err);
- return NULL;
- }
return cpu_type;
}
/* TODO: all callers of cpu_generic_init() need to be converted to
* call cpu_parse_features() only once, before calling cpu_generic_init().
*/
- const char *cpu_type = cpu_parse_cpu_model(typename, cpu_model);
-
- if (cpu_type) {
- return cpu_create(cpu_type);
- }
- return NULL;
+ return cpu_create(cpu_parse_cpu_model(typename, cpu_model));
}
bool cpu_paging_enabled(const CPUState *cpu)