aboutsummaryrefslogtreecommitdiff
path: root/target-i386/helper.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-04-02 23:20:08 +0200
committerAndreas Färber <afaerber@suse.de>2012-04-10 17:10:27 +0200
commit5fd2087a1b7b3075828de741d76188441ee35bc8 (patch)
tree42a1d1abec5d4997f4905c860a87fa58a61c83a5 /target-i386/helper.c
parent30471bc94e1eb4ce1c87a56b6210a3baa1698d58 (diff)
target-i386: QOM'ify CPU
Embed CPUX86State as first member of X86CPU. Distinguish between "x86_64-cpu" and "i386-cpu". Drop cpu_x86_close() in favor of calling object_delete() directly. For now let CPUClass::reset() call cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-i386/helper.c')
-rw-r--r--target-i386/helper.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 83122bf617..fb87975af2 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -101,11 +101,6 @@ void cpu_state_reset(CPUX86State *env)
cpu_watchpoint_remove_all(env, BP_CPU);
}
-void cpu_x86_close(CPUX86State *env)
-{
- g_free(env);
-}
-
static void cpu_x86_version(CPUX86State *env, int *family, int *model)
{
int cpuver = env->cpuid_version;
@@ -1248,10 +1243,12 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector,
CPUX86State *cpu_x86_init(const char *cpu_model)
{
+ X86CPU *cpu;
CPUX86State *env;
static int inited;
- env = g_malloc0(sizeof(CPUX86State));
+ cpu = X86_CPU(object_new(TYPE_X86_CPU));
+ env = &cpu->env;
cpu_exec_init(env);
env->cpu_model_str = cpu_model;
@@ -1265,7 +1262,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
#endif
}
if (cpu_x86_register(env, cpu_model) < 0) {
- cpu_x86_close(env);
+ object_delete(OBJECT(cpu));
return NULL;
}
env->cpuid_apic_id = env->cpu_index;