summaryrefslogtreecommitdiffstats
path: root/include/hw/i386
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2015-05-15 14:18:53 -0300
committerMichael S. Tsirkin <mst@redhat.com>2015-05-31 16:26:42 +0200
commit61f219dfb093c0df91926928c780299cdf429619 (patch)
tree7eb9ac3dd6e3ad3c0d7fc8e7d0b5724f331d1596 /include/hw/i386
parentb6b5c8e492ae7b71a16fe702b7409bff0feebfa7 (diff)
downloadhqemu-61f219dfb093c0df91926928c780299cdf429619.zip
hqemu-61f219dfb093c0df91926928c780299cdf429619.tar.gz
pc: Define machines using a DEFINE_PC_MACHINE macro
This will automatically generate the existing QEMUMachine structs based on the *_MACHINE_OPTIONS macros, and automatically add registration code for them. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/i386')
-rw-r--r--include/hw/i386/pc.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 672f1f7..a5b1fb0 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -525,4 +525,20 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
.hot_add_cpu = pc_hot_add_cpu, \
.max_cpus = 255
+#define DEFINE_PC_MACHINE(suffix, namestr, initfn, OPTS, COMPAT) \
+ static QEMUMachine pc_machine_##suffix = { \
+ OPTS, \
+ .name = namestr, \
+ .init = initfn, \
+ .compat_props = (GlobalProperty[]) { \
+ COMPAT \
+ { /* end of list */ } \
+ }, \
+ }; \
+ static void pc_machine_init_##suffix(void) \
+ { \
+ qemu_register_pc_machine(&pc_machine_##suffix); \
+ } \
+ machine_init(pc_machine_init_##suffix)
+
#endif
OpenPOWER on IntegriCloud