mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-02 02:11:09 +00:00
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:
parent
c133a7b306
commit
e373c001fa
|
@ -577,7 +577,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void cpu_exec_init(CPUState *cpu, void *opaque)
|
void cpu_exec_init(CPUState *cpu, Error **errp, void *opaque)
|
||||||
{
|
{
|
||||||
struct uc_struct *uc = opaque;
|
struct uc_struct *uc = opaque;
|
||||||
CPUClass *cc = CPU_GET_CLASS(uc, cpu);
|
CPUClass *cc = CPU_GET_CLASS(uc, cpu);
|
||||||
|
|
|
@ -63,7 +63,7 @@ static inline void cpu_list_lock(void)
|
||||||
}
|
}
|
||||||
#endif
|
#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(CPUState *cpu);
|
||||||
void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
|
void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
|
||||||
|
|
|
@ -434,7 +434,7 @@ static void arm_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
uint32_t Aff1, Aff0;
|
uint32_t Aff1, Aff0;
|
||||||
|
|
||||||
cs->env_ptr = &cpu->env;
|
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,
|
cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
|
||||||
g_free, g_free);
|
g_free, g_free);
|
||||||
|
|
||||||
|
|
|
@ -4241,7 +4241,7 @@ static void x86_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
CPUX86State *env = &cpu->env;
|
CPUX86State *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(cs, opaque);
|
cpu_exec_init(cs, &error_abort, opaque);
|
||||||
|
|
||||||
object_property_add(uc, obj, "family", "int",
|
object_property_add(uc, obj, "family", "int",
|
||||||
x86_cpuid_version_get_family,
|
x86_cpuid_version_get_family,
|
||||||
|
|
|
@ -228,7 +228,7 @@ static void m68k_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
CPUM68KState *env = &cpu->env;
|
CPUM68KState *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = 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)
|
static void m68k_cpu_class_init(struct uc_struct *uc, ObjectClass *c, void *data)
|
||||||
|
|
|
@ -130,7 +130,7 @@ static void mips_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
env->cpu_model = mcc->cpu_def;
|
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)
|
static char *mips_cpu_type_name(const char *cpu_model)
|
||||||
|
|
|
@ -818,7 +818,7 @@ static void sparc_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque)
|
||||||
CPUSPARCState *env = &cpu->env;
|
CPUSPARCState *env = &cpu->env;
|
||||||
|
|
||||||
cs->env_ptr = env;
|
cs->env_ptr = env;
|
||||||
cpu_exec_init(cs, opaque);
|
cpu_exec_init(cs, &error_abort, opaque);
|
||||||
|
|
||||||
if (scc->cpu_def) {
|
if (scc->cpu_def) {
|
||||||
env->def = *scc->cpu_def;
|
env->def = *scc->cpu_def;
|
||||||
|
|
Loading…
Reference in a new issue