diff options
author | Andreas Färber <afaerber@suse.de> | 2012-04-02 23:20:08 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-04-10 17:10:27 +0200 |
commit | 5fd2087a1b7b3075828de741d76188441ee35bc8 (patch) | |
tree | 42a1d1abec5d4997f4905c860a87fa58a61c83a5 /target-i386/cpu.c | |
parent | 30471bc94e1eb4ce1c87a56b6210a3baa1698d58 (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/cpu.c')
-rw-r--r-- | target-i386/cpu.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 465ea15f45..36790da947 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -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) |