cpu: Add Error argument to cpu_exec_init()

Add an Error argument to cpu_exec_init() to let users collect the
error. This is in preparation to change the CPU enumeration logic
in cpu_exec_init(). With the new enumeration logic, cpu_exec_init()
can fail if cpu_index values corresponding to max_cpus have already
been handed out.

Since all current callers of cpu_exec_init() are from instance_init,
use error_abort Error argument to abort in case of an error.

Backports commit 5a790cc4b942e651fec7edc597c19b637fad5a76 from qemu
This commit is contained in:
Bharata B Rao 2018-03-21 07:50:22 -04:00 committed by Lioncash
parent c133a7b306
commit e373c001fa
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
7 changed files with 7 additions and 7 deletions

View file

@ -577,7 +577,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx)
}
#endif
void cpu_exec_init(CPUState *cpu, void *opaque)
void cpu_exec_init(CPUState *cpu, Error **errp, void *opaque)
{
struct uc_struct *uc = opaque;
CPUClass *cc = CPU_GET_CLASS(uc, cpu);

View file

@ -63,7 +63,7 @@ static inline void cpu_list_lock(void)
}
#endif
void cpu_exec_init(CPUState *env, void *opaque);
void cpu_exec_init(CPUState *env, Error **errp, void *opaque);
void QEMU_NORETURN cpu_loop_exit(CPUState *cpu);
void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);

View file

@ -434,7 +434,7 @@ static void arm_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
uint32_t Aff1, Aff0;
cs->env_ptr = &cpu->env;
cpu_exec_init(cs, opaque);
cpu_exec_init(cs, &error_abort, opaque);
cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
g_free, g_free);

View file

@ -4241,7 +4241,7 @@ static void x86_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
CPUX86State *env = &cpu->env;
cs->env_ptr = env;
cpu_exec_init(cs, opaque);
cpu_exec_init(cs, &error_abort, opaque);
object_property_add(uc, obj, "family", "int",
x86_cpuid_version_get_family,

View file

@ -228,7 +228,7 @@ static void m68k_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
CPUM68KState *env = &cpu->env;
cs->env_ptr = env;
cpu_exec_init(cs, opaque);
cpu_exec_init(cs, &error_abort, opaque);
}
static void m68k_cpu_class_init(struct uc_struct *uc, ObjectClass *c, void *data)

View file

@ -130,7 +130,7 @@ static void mips_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
cs->env_ptr = env;
env->cpu_model = mcc->cpu_def;
cpu_exec_init(cs, opaque);
cpu_exec_init(cs, &error_abort, opaque);
}
static char *mips_cpu_type_name(const char *cpu_model)

View file

@ -818,7 +818,7 @@ static void sparc_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
CPUSPARCState *env = &cpu->env;
cs->env_ptr = env;
cpu_exec_init(cs, opaque);
cpu_exec_init(cs, &error_abort, opaque);
if (scc->cpu_def) {
env->def = *scc->cpu_def;