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:
parent
6a287ba88e
commit
ba09afc8b5
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue