diff options
-rw-r--r-- | include/hw/boards.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h index 586f939a57..4fe2ce5235 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -159,4 +159,21 @@ struct MachineState { AccelState *accelerator; }; +#define DEFINE_MACHINE(namestr, machine_initfn) \ + static void machine_initfn##_class_init(ObjectClass *oc, void *data) \ + { \ + MachineClass *mc = MACHINE_CLASS(oc); \ + machine_initfn(mc); \ + } \ + static const TypeInfo machine_initfn##_typeinfo = { \ + .name = MACHINE_TYPE_NAME(namestr), \ + .parent = TYPE_MACHINE, \ + .class_init = machine_initfn##_class_init, \ + }; \ + static void machine_initfn##_register_types(void) \ + { \ + type_register_static(&machine_initfn##_typeinfo); \ + } \ + machine_init(machine_initfn##_register_types) + #endif |