mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 02:54:58 -06:00
cpu: make cpu_generic_init() abort QEMU on error
Almost every user of cpu_generic_init() checks for returned NULL and then reports failure in a custom way and aborts process. Some users assume that call can't fail and don't check for failure, though they should have checked for it. In either cases cpu_generic_init() failure is fatal, so instead of checking for failure and reporting it various ways, make cpu_generic_init() report errors in consistent way and terminate QEMU on failure. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <1505318697-77161-3-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
3c72234c98
commit
4482e05cbb
38 changed files with 7 additions and 176 deletions
|
@ -817,10 +817,6 @@ void ppce500_init(MachineState *machine, PPCE500Params *params)
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -189,10 +189,6 @@ static void ppc_core99_init(MachineState *machine)
|
|||
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 */
|
||||
|
|
|
@ -118,10 +118,6 @@ static void ppc_heathrow_init(MachineState *machine)
|
|||
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 */
|
||||
|
|
|
@ -187,10 +187,6 @@ static void bamboo_init(MachineState *machine)
|
|||
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) {
|
||||
|
|
|
@ -57,11 +57,6 @@ PowerPCCPU *ppc4xx_init(const char *cpu_model,
|
|||
|
||||
/* 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 */
|
||||
|
|
|
@ -522,10 +522,6 @@ static void ppc_prep_init(MachineState *machine)
|
|||
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) {
|
||||
|
@ -726,11 +722,6 @@ static void ibm_40p_init(MachineState *machine)
|
|||
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");
|
||||
|
|
|
@ -97,10 +97,6 @@ static PowerPCCPU *ppc440_init_xilinx(ram_addr_t *ram_size,
|
|||
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 */);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue