target-i386: Eliminate cpu_init() function

Instead of putting extra logic inside cpu.h, just do everything inside
cpu_x86_init_user().

Backports commit 15258d46baef5f8265ad5f1002905664cf58f051 from qem
This commit is contained in:
Eduardo Habkost 2018-02-12 15:34:30 -05:00 committed by Lioncash
parent 68fa057b7c
commit 51b49a5b97
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 5 additions and 12 deletions

View file

@ -1805,7 +1805,7 @@ out:
return cpu; 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; Error *error = NULL;
X86CPU *cpu; X86CPU *cpu;
@ -1822,10 +1822,10 @@ out:
error_free(error); error_free(error);
if (cpu != NULL) { if (cpu != NULL) {
object_unref(uc, OBJECT(cpu)); 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) static void x86_cpu_cpudef_class_init(struct uc_struct *uc, ObjectClass *oc, void *data)

View file

@ -979,7 +979,6 @@ typedef struct CPUX86State {
#include "cpu-qom.h" #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); X86CPU *cpu_x86_create(struct uc_struct *uc, const char *cpu_model, Error **errp);
int cpu_x86_exec(struct uc_struct *uc, CPUX86State *s); int cpu_x86_exec(struct uc_struct *uc, CPUX86State *s);
void x86_cpudef_setup(void); void x86_cpudef_setup(void);
@ -1165,14 +1164,8 @@ uint64_t cpu_get_tsc(CPUX86State *env);
# define PHYS_ADDR_MASK 0xfffffffffLL # define PHYS_ADDR_MASK 0xfffffffffLL
# endif # endif
static inline CPUX86State *cpu_init(struct uc_struct *uc, const char *cpu_model) CPUX86State *cpu_x86_init_user(struct uc_struct *uc, const char *cpu_model);
{ #define cpu_init cpu_x86_init_user
X86CPU *cpu = cpu_x86_init_user(uc, cpu_model);
if (cpu == NULL) {
return NULL;
}
return &cpu->env;
}
#ifdef TARGET_I386 #ifdef TARGET_I386
#define cpu_exec cpu_x86_exec #define cpu_exec cpu_x86_exec