1
0
Fork 0
mirror of https://github.com/yuzu-emu/unicorn.git synced 2025-01-11 09:15:38 +00:00

pc: Generate init functions with a macro

All pc-i440fx and pc-q35 init functions simply call the corresponding
compat function and then call the main init function. Use a macro to
generate that code.

Backports commit 99fbeafee8b568e796863980365080abdb8d675e from qemu
This commit is contained in:
Eduardo Habkost 2018-03-11 13:41:19 -04:00 committed by Lioncash
parent 6a287ba88e
commit ba09afc8b5
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -48,10 +48,16 @@ static void pc_compat_2_2(struct uc_struct *uc, MachineState *machine)
{
}
static int pc_init_pci_2_2(struct uc_struct *uc, MachineState *machine)
{
pc_compat_2_2(uc, machine);
return pc_init1(uc, machine);
}
// Unicorn: Modified for use with unicorn (no need for an option function)
#define DEFINE_I440FX_MACHINE(suffix, name, compatfn) \
static int pc_init_##suffix(struct uc_struct *uc, MachineState *machine) \
{ \
void (*compat)(struct uc_struct *uc, MachineState *m) = (compatfn); \
if (compat) { \
compat(uc, machine); \
} \
return pc_init1(uc, machine); \
} \
DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix)
DEFINE_PC_MACHINE(v2_2, "pc-i440fx-2.2", pc_init_pci_2_2);
DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2);