pc: Don't use QEMUMachine anymore

Now that we have a DEFINE_PC_MACHINE helper macro that just requires an
initialization function, it is trivial to convert them to register a QOM
machine class directly, instead of using QEMUMachine.

Backports commit 865906f7fdadd2732441ab158787f81f6a212bfe from qemu
This commit is contained in:
Eduardo Habkost 2018-03-09 14:12:03 -05:00 committed by Lioncash
parent b65a3ece3b
commit 12acb995fa
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 36 additions and 23 deletions

View file

@ -47,4 +47,26 @@ void x86_cpu_register_types(struct uc_struct *uc);
#define PC_DEFAULT_MACHINE_OPTIONS \
.max_cpus = 255
// Unicorn: Modified to work with Unicorn.
#define DEFINE_PC_MACHINE(suffix, namestr, initfn) \
static void pc_machine_##suffix##_class_init(struct uc_struct *uc, ObjectClass *oc, void *data) \
{ \
MachineClass *mc = MACHINE_CLASS(uc, oc); \
mc->max_cpus = 255; \
mc->is_default = 1; \
mc->name = namestr; \
mc->init = initfn; \
mc->arch = UC_ARCH_X86; \
} \
static const TypeInfo pc_machine_type_##suffix = { \
.name = namestr TYPE_MACHINE_SUFFIX, \
.parent = TYPE_PC_MACHINE, \
.class_init = pc_machine_##suffix##_class_init, \
}; \
void pc_machine_init_##suffix(struct uc_struct *uc); \
void pc_machine_init_##suffix(struct uc_struct *uc) \
{ \
type_register(uc, &pc_machine_type_##suffix); \
}
#endif