diff --git a/qemu/target-i386/cpu.c b/qemu/target-i386/cpu.c index 5dd83c95..79db26e5 100644 --- a/qemu/target-i386/cpu.c +++ b/qemu/target-i386/cpu.c @@ -1805,7 +1805,7 @@ out: return cpu; } -X86CPU *cpu_x86_init_user(struct uc_struct *uc, const char *cpu_model) +CPUX86State *cpu_x86_init_user(struct uc_struct *uc, const char *cpu_model) { Error *error = NULL; X86CPU *cpu; @@ -1822,10 +1822,10 @@ out: error_free(error); if (cpu != NULL) { object_unref(uc, OBJECT(cpu)); - cpu = NULL; } + return NULL; } - return cpu; + return &cpu->env; } static void x86_cpu_cpudef_class_init(struct uc_struct *uc, ObjectClass *oc, void *data) diff --git a/qemu/target-i386/cpu.h b/qemu/target-i386/cpu.h index 705bfb52..ac6f4edb 100644 --- a/qemu/target-i386/cpu.h +++ b/qemu/target-i386/cpu.h @@ -979,7 +979,6 @@ typedef struct CPUX86State { #include "cpu-qom.h" -X86CPU *cpu_x86_init_user(struct uc_struct *uc, const char *cpu_model); X86CPU *cpu_x86_create(struct uc_struct *uc, const char *cpu_model, Error **errp); int cpu_x86_exec(struct uc_struct *uc, CPUX86State *s); void x86_cpudef_setup(void); @@ -1165,14 +1164,8 @@ uint64_t cpu_get_tsc(CPUX86State *env); # define PHYS_ADDR_MASK 0xfffffffffLL # endif -static inline CPUX86State *cpu_init(struct uc_struct *uc, const char *cpu_model) -{ - X86CPU *cpu = cpu_x86_init_user(uc, cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +CPUX86State *cpu_x86_init_user(struct uc_struct *uc, const char *cpu_model); +#define cpu_init cpu_x86_init_user #ifdef TARGET_I386 #define cpu_exec cpu_x86_exec