mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
30471bc94e
commit
5fd2087a1b
4 changed files with 118 additions and 8 deletions
|
@ -1367,3 +1367,40 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* CPUClass::reset() */
|
||||
static void x86_cpu_reset(CPUState *s)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(s);
|
||||
X86CPUClass *xcc = X86_CPU_GET_CLASS(cpu);
|
||||
CPUX86State *env = &cpu->env;
|
||||
|
||||
xcc->parent_reset(s);
|
||||
|
||||
cpu_state_reset(env);
|
||||
}
|
||||
|
||||
static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
X86CPUClass *xcc = X86_CPU_CLASS(oc);
|
||||
CPUClass *cc = CPU_CLASS(oc);
|
||||
|
||||
xcc->parent_reset = cc->reset;
|
||||
cc->reset = x86_cpu_reset;
|
||||
}
|
||||
|
||||
static const TypeInfo x86_cpu_type_info = {
|
||||
.name = TYPE_X86_CPU,
|
||||
.parent = TYPE_CPU,
|
||||
.instance_size = sizeof(X86CPU),
|
||||
.abstract = false,
|
||||
.class_size = sizeof(X86CPUClass),
|
||||
.class_init = x86_cpu_common_class_init,
|
||||
};
|
||||
|
||||
static void x86_cpu_register_types(void)
|
||||
{
|
||||
type_register_static(&x86_cpu_type_info);
|
||||
}
|
||||
|
||||
type_init(x86_cpu_register_types)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue