mirror of
https://github.com/yuzu-mirror/unicorn.git
synced 2026-04-05 14:35:45 +00:00
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:
parent
b65a3ece3b
commit
12acb995fa
3 changed files with 36 additions and 23 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue