aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/an5206.c9
-rw-r--r--hw/axis_dev88.c9
-rw-r--r--hw/boards.h107
-rw-r--r--hw/dummy_m68k.c9
-rw-r--r--hw/etraxfs.c9
-rw-r--r--hw/gumstix.c12
-rw-r--r--hw/integratorcp.c9
-rw-r--r--hw/mainstone.c9
-rw-r--r--hw/mcf5208.c9
-rw-r--r--hw/mips_jazz.c12
-rw-r--r--hw/mips_malta.c9
-rw-r--r--hw/mips_mipssim.c9
-rw-r--r--hw/mips_r4k.c9
-rw-r--r--hw/musicpal.c9
-rw-r--r--hw/nseries.c12
-rw-r--r--hw/omap_sx1.c12
-rw-r--r--hw/palm.c9
-rw-r--r--hw/pc.c12
-rw-r--r--hw/ppc405_boards.c12
-rw-r--r--hw/ppc440_bamboo.c9
-rw-r--r--hw/ppc_newworld.c9
-rw-r--r--hw/ppc_oldworld.c9
-rw-r--r--hw/ppc_prep.c9
-rw-r--r--hw/ppce500_mpc8544ds.c9
-rw-r--r--hw/r2d.c9
-rw-r--r--hw/realview.c7
-rw-r--r--hw/shix.c9
-rw-r--r--hw/spitz.c16
-rw-r--r--hw/stellaris.c12
-rw-r--r--hw/sun4m.c42
-rw-r--r--hw/sun4u.c15
-rw-r--r--hw/syborg.c9
-rw-r--r--hw/tosa.c9
-rw-r--r--hw/versatilepb.c12
-rw-r--r--hw/xen_machine_pv.c9
-rw-r--r--module.h2
-rw-r--r--target-arm/machine.c25
-rw-r--r--target-cris/machine.c6
-rw-r--r--target-i386/machine.c9
-rw-r--r--target-m68k/machine.c9
-rw-r--r--target-mips/machine.c9
-rw-r--r--target-ppc/machine.c11
-rw-r--r--target-sh4/machine.c8
-rw-r--r--target-sparc/machine.c22
-rw-r--r--vl.c2
45 files changed, 321 insertions, 263 deletions
diff --git a/hw/an5206.c b/hw/an5206.c
index 5cdda14136..d417d923b9 100644
--- a/hw/an5206.c
+++ b/hw/an5206.c
@@ -84,8 +84,15 @@ static void an5206_init(ram_addr_t ram_size,
env->pc = entry;
}
-QEMUMachine an5206_machine = {
+static QEMUMachine an5206_machine = {
.name = "an5206",
.desc = "Arnewsh 5206",
.init = an5206_init,
};
+
+static void an5206_machine_init(void)
+{
+ qemu_register_machine(&an5206_machine);
+}
+
+machine_init(an5206_machine_init);
diff --git a/hw/axis_dev88.c b/hw/axis_dev88.c
index db7fbabe72..506ef28768 100644
--- a/hw/axis_dev88.c
+++ b/hw/axis_dev88.c
@@ -372,8 +372,15 @@ void axisdev88_init (ram_addr_t ram_size,
printf ("ram size =%ld\n", ram_size);
}
-QEMUMachine axisdev88_machine = {
+static QEMUMachine axisdev88_machine = {
.name = "axis-dev88",
.desc = "AXIS devboard 88",
.init = axisdev88_init,
};
+
+static void axisdev88_machine_init(void)
+{
+ qemu_register_machine(&axisdev88_machine);
+}
+
+machine_init(axisdev88_machine_init);
diff --git a/hw/boards.h b/hw/boards.h
index 9a99a851d0..3144017668 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -24,111 +24,4 @@ void register_machines(void);
extern QEMUMachine *current_machine;
-/* Axis ETRAX. */
-extern QEMUMachine bareetraxfs_machine;
-extern QEMUMachine axisdev88_machine;
-
-/* pc.c */
-extern QEMUMachine pc_machine;
-extern QEMUMachine isapc_machine;
-
-/* xen_machine.c */
-extern QEMUMachine xenpv_machine;
-
-/* ppc.c */
-extern QEMUMachine prep_machine;
-extern QEMUMachine core99_machine;
-extern QEMUMachine heathrow_machine;
-extern QEMUMachine ref405ep_machine;
-extern QEMUMachine taihu_machine;
-extern QEMUMachine bamboo_machine;
-extern QEMUMachine mpc8544ds_machine;
-
-/* mips_r4k.c */
-extern QEMUMachine mips_machine;
-
-/* mips_jazz.c */
-extern QEMUMachine mips_magnum_machine;
-extern QEMUMachine mips_pica61_machine;
-
-/* mips_malta.c */
-extern QEMUMachine mips_malta_machine;
-
-/* mips_mipssim.c */
-extern QEMUMachine mips_mipssim_machine;
-
-/* shix.c */
-extern QEMUMachine shix_machine;
-
-/* r2d.c */
-extern QEMUMachine r2d_machine;
-
-/* sun4m.c */
-extern QEMUMachine ss5_machine, ss10_machine, ss600mp_machine, ss20_machine;
-extern QEMUMachine voyager_machine, ss_lx_machine, ss4_machine, scls_machine;
-extern QEMUMachine sbook_machine;
-extern QEMUMachine ss2_machine;
-extern QEMUMachine ss1000_machine, ss2000_machine;
-
-/* sun4u.c */
-extern QEMUMachine sun4u_machine;
-extern QEMUMachine sun4v_machine;
-extern QEMUMachine niagara_machine;
-
-/* integratorcp.c */
-extern QEMUMachine integratorcp_machine;
-
-/* versatilepb.c */
-extern QEMUMachine versatilepb_machine;
-extern QEMUMachine versatileab_machine;
-
-/* realview.c */
-extern QEMUMachine realview_machine;
-
-/* spitz.c */
-extern QEMUMachine akitapda_machine;
-extern QEMUMachine spitzpda_machine;
-extern QEMUMachine borzoipda_machine;
-extern QEMUMachine terrierpda_machine;
-
-/* omap_sx1.c */
-extern QEMUMachine sx1_machine_v1;
-extern QEMUMachine sx1_machine_v2;
-
-/* palm.c */
-extern QEMUMachine palmte_machine;
-
-/* nseries.c */
-extern QEMUMachine n800_machine;
-extern QEMUMachine n810_machine;
-
-/* gumstix.c */
-extern QEMUMachine connex_machine;
-extern QEMUMachine verdex_machine;
-
-/* stellaris.c */
-extern QEMUMachine lm3s811evb_machine;
-extern QEMUMachine lm3s6965evb_machine;
-
-/* an5206.c */
-extern QEMUMachine an5206_machine;
-
-/* mcf5208.c */
-extern QEMUMachine mcf5208evb_machine;
-
-/* dummy_m68k.c */
-extern QEMUMachine dummy_m68k_machine;
-
-/* mainstone.c */
-extern QEMUMachine mainstone2_machine;
-
-/* musicpal.c */
-extern QEMUMachine musicpal_machine;
-
-/* tosa.c */
-extern QEMUMachine tosapda_machine;
-
-/* syborg.c */
-extern QEMUMachine syborg_machine;
-
#endif
diff --git a/hw/dummy_m68k.c b/hw/dummy_m68k.c
index cb9b2eb88e..5718ab64e1 100644
--- a/hw/dummy_m68k.c
+++ b/hw/dummy_m68k.c
@@ -63,8 +63,15 @@ static void dummy_m68k_init(ram_addr_t ram_size,
env->pc = entry;
}
-QEMUMachine dummy_m68k_machine = {
+static QEMUMachine dummy_m68k_machine = {
.name = "dummy",
.desc = "Dummy board",
.init = dummy_m68k_init,
};
+
+static void dummy_m68k_machine_init(void)
+{
+ qemu_register_machine(&dummy_m68k_machine);
+}
+
+machine_init(dummy_m68k_machine_init);
diff --git a/hw/etraxfs.c b/hw/etraxfs.c
index 9cdf41cb32..27205ad579 100644
--- a/hw/etraxfs.c
+++ b/hw/etraxfs.c
@@ -158,8 +158,15 @@ void bareetraxfs_init (ram_addr_t ram_size,
printf ("ram size =%ld\n", ram_size);
}
-QEMUMachine bareetraxfs_machine = {
+static QEMUMachine bareetraxfs_machine = {
.name = "bareetraxfs",
.desc = "Bare ETRAX FS board",
.init = bareetraxfs_init,
};
+
+static void bareetraxfs_machine_init(void)
+{
+ qemu_register_machine(&bareetraxfs_machine);
+}
+
+machine_init(bareetraxfs_machine_init);
diff --git a/hw/gumstix.c b/hw/gumstix.c
index 7dd67ce417..85b95eef59 100644
--- a/hw/gumstix.c
+++ b/hw/gumstix.c
@@ -109,14 +109,22 @@ static void verdex_init(ram_addr_t ram_size,
pxa2xx_gpio_in_get(cpu->gpio)[99]);
}
-QEMUMachine connex_machine = {
+static QEMUMachine connex_machine = {
.name = "connex",
.desc = "Gumstix Connex (PXA255)",
.init = connex_init,
};
-QEMUMachine verdex_machine = {
+static QEMUMachine verdex_machine = {
.name = "verdex",
.desc = "Gumstix Verdex (PXA270)",
.init = verdex_init,
};
+
+static void gumstix_machine_init(void)
+{
+ qemu_register_machine(&connex_machine);
+ qemu_register_machine(&verdex_machine);
+}
+
+machine_init(gumstix_machine_init);
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index ee733fbc23..ac0bd264ff 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -508,12 +508,19 @@ static void integratorcp_init(ram_addr_t ram_size,
arm_load_kernel(env, &integrator_binfo);
}
-QEMUMachine integratorcp_machine = {
+static QEMUMachine integratorcp_machine = {
.name = "integratorcp",
.desc = "ARM Integrator/CP (ARM926EJ-S)",
.init = integratorcp_init,
};
+static void integratorcp_machine_init(void)
+{
+ qemu_register_machine(&integratorcp_machine);
+}
+
+machine_init(integratorcp_machine_init);
+
static void integratorcp_register_devices(void)
{
sysbus_register_dev("integrator_pic", sizeof(icp_pic_state), icp_pic_init);
diff --git a/hw/mainstone.c b/hw/mainstone.c
index cb10414e61..151ea0e341 100644
--- a/hw/mainstone.c
+++ b/hw/mainstone.c
@@ -135,8 +135,15 @@ static void mainstone_init(ram_addr_t ram_size,
kernel_cmdline, initrd_filename, cpu_model, mainstone, 0x196);
}
-QEMUMachine mainstone2_machine = {
+static QEMUMachine mainstone2_machine = {
.name = "mainstone",
.desc = "Mainstone II (PXA27x)",
.init = mainstone_init,
};
+
+static void mainstone_machine_init(void)
+{
+ qemu_register_machine(&mainstone2_machine);
+}
+
+machine_init(mainstone_machine_init);
diff --git a/hw/mcf5208.c b/hw/mcf5208.c
index 50d7f4fd83..21b2bc8a4c 100644
--- a/hw/mcf5208.c
+++ b/hw/mcf5208.c
@@ -286,8 +286,15 @@ static void mcf5208evb_init(ram_addr_t ram_size,
env->pc = entry;
}
-QEMUMachine mcf5208evb_machine = {
+static QEMUMachine mcf5208evb_machine = {
.name = "mcf5208evb",
.desc = "MCF5206EVB",
.init = mcf5208evb_init,
};
+
+static void mcf5208evb_machine_init(void)
+{
+ qemu_register_machine(&mcf5208evb_machine);
+}
+
+machine_init(mcf5208evb_machine_init);
diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c
index 49c0b467fc..bf1621e8a7 100644
--- a/hw/mips_jazz.c
+++ b/hw/mips_jazz.c
@@ -286,16 +286,24 @@ void mips_pica61_init (ram_addr_t ram_size,
mips_jazz_init(ram_size, cpu_model, JAZZ_PICA61);
}
-QEMUMachine mips_magnum_machine = {
+static QEMUMachine mips_magnum_machine = {
.name = "magnum",
.desc = "MIPS Magnum",
.init = mips_magnum_init,
.use_scsi = 1,
};
-QEMUMachine mips_pica61_machine = {
+static QEMUMachine mips_pica61_machine = {
.name = "pica61",
.desc = "Acer Pica 61",
.init = mips_pica61_init,
.use_scsi = 1,
};
+
+static void mips_jazz_machine_init(void)
+{
+ qemu_register_machine(&mips_magnum_machine);
+ qemu_register_machine(&mips_pica61_machine);
+}
+
+machine_init(mips_jazz_machine_init);
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 564eaa6114..eb81edf1c2 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -949,8 +949,15 @@ void mips_malta_init (ram_addr_t ram_size,
}
}
-QEMUMachine mips_malta_machine = {
+static QEMUMachine mips_malta_machine = {
.name = "malta",
.desc = "MIPS Malta Core LV",
.init = mips_malta_init,
};
+
+static void mips_malta_machine_init(void)
+{
+ qemu_register_machine(&mips_malta_machine);
+}
+
+machine_init(mips_malta_machine_init);
diff --git a/hw/mips_mipssim.c b/hw/mips_mipssim.c
index b3f190e21a..e4414b42e0 100644
--- a/hw/mips_mipssim.c
+++ b/hw/mips_mipssim.c
@@ -178,8 +178,15 @@ mips_mipssim_init (ram_addr_t ram_size,
mipsnet_init(0x4200, env->irq[2], &nd_table[0]);
}
-QEMUMachine mips_mipssim_machine = {
+static QEMUMachine mips_mipssim_machine = {
.name = "mipssim",
.desc = "MIPS MIPSsim platform",
.init = mips_mipssim_init,
};
+
+static void mips_mipssim_machine_init(void)
+{
+ qemu_register_machine(&mips_mipssim_machine);
+}
+
+machine_init(mips_mipssim_machine_init);
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 9ad8de6746..6892060a7e 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -275,8 +275,15 @@ void mips_r4k_init (ram_addr_t ram_size,
i8042_init(i8259[1], i8259[12], 0x60);
}
-QEMUMachine mips_machine = {
+static QEMUMachine mips_machine = {
.name = "mips",
.desc = "mips r4k platform",
.init = mips_r4k_init,
};
+
+static void mips_machine_init(void)
+{
+ qemu_register_machine(&mips_machine);
+}
+
+machine_init(mips_machine_init);
diff --git a/hw/musicpal.c b/hw/musicpal.c
index 87dda0ce5c..fe065866e2 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -1596,12 +1596,19 @@ static void musicpal_init(ram_addr_t ram_size,
arm_load_kernel(env, &musicpal_binfo);
}
-QEMUMachine musicpal_machine = {
+static QEMUMachine musicpal_machine = {
.name = "musicpal",
.desc = "Marvell 88w8618 / MusicPal (ARM926EJ-S)",
.init = musicpal_init,
};
+static void musicpal_machine_init(void)
+{
+ qemu_register_machine(&musicpal_machine);
+}
+
+machine_init(musicpal_machine_init);
+
static void musicpal_register_devices(void)
{
sysbus_register_dev("mv88w8618_pic", sizeof(mv88w8618_pic_state),
diff --git a/hw/nseries.c b/hw/nseries.c
index daf1b8ba92..c219bfe402 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -1403,14 +1403,22 @@ static void n810_init(ram_addr_t ram_size,
cpu_model, &n810_binfo, 810);
}
-QEMUMachine n800_machine = {
+static QEMUMachine n800_machine = {
.name = "n800",
.desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)",
.init = n800_init,
};
-QEMUMachine n810_machine = {
+static QEMUMachine n810_machine = {
.name = "n810",
.desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)",
.init = n810_init,
};
+
+static void nseries_machine_init(void)
+{
+ qemu_register_machine(&n800_machine);
+ qemu_register_machine(&n810_machine);
+}
+
+machine_init(nseries_machine_init);
diff --git a/hw/omap_sx1.c b/hw/omap_sx1.c
index 5a538833d1..ee8e39d7cd 100644
--- a/hw/omap_sx1.c
+++ b/hw/omap_sx1.c
@@ -223,14 +223,22 @@ static void sx1_init_v2(ram_addr_t ram_size,
kernel_cmdline, initrd_filename, cpu_model, 2);
}
-QEMUMachine sx1_machine_v2 = {
+static QEMUMachine sx1_machine_v2 = {
.name = "sx1",
.desc = "Siemens SX1 (OMAP310) V2",
.init = sx1_init_v2,
};
-QEMUMachine sx1_machine_v1 = {
+static QEMUMachine sx1_machine_v1 = {
.name = "sx1-v1",
.desc = "Siemens SX1 (OMAP310) V1",
.init = sx1_init_v1,
};
+
+static void sx1_machine_init(void)
+{
+ qemu_register_machine(&sx1_machine_v2);
+ qemu_register_machine(&sx1_machine_v1);
+}
+
+machine_init(sx1_machine_init);
diff --git a/hw/palm.c b/hw/palm.c
index fb8e380417..e9be058218 100644
--- a/hw/palm.c
+++ b/hw/palm.c
@@ -275,8 +275,15 @@ static void palmte_init(ram_addr_t ram_size,
dpy_resize(ds);
}
-QEMUMachine palmte_machine = {
+static QEMUMachine palmte_machine = {
.name = "cheetah",
.desc = "Palm Tungsten|E aka. Cheetah PDA (OMAP310)",
.init = palmte_init,
};
+
+static void palmte_machine_init(void)
+{
+ qemu_register_machine(&palmte_machine);
+}
+
+machine_init(palmte_machine_init);
diff --git a/hw/pc.c b/hw/pc.c
index 667256e36b..43b739146b 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1184,16 +1184,24 @@ void cmos_set_s3_resume(void)
rtc_set_memory(rtc_state, 0xF, 0xFE);
}
-QEMUMachine pc_machine = {
+static QEMUMachine pc_machine = {
.name = "pc",
.desc = "Standard PC",
.init = pc_init_pci,
.max_cpus = 255,
};
-QEMUMachine isapc_machine = {
+static QEMUMachine isapc_machine = {
.name = "isapc",
.desc = "ISA-only PC",
.init = pc_init_isa,
.max_cpus = 1,
};
+
+static void pc_machine_init(void)
+{
+ qemu_register_machine(&pc_machine);
+ qemu_register_machine(&isapc_machine);
+}
+
+machine_init(pc_machine_init);
diff --git a/hw/ppc405_boards.c b/hw/ppc405_boards.c
index 0b4eb9333e..1ace32e6f7 100644
--- a/hw/ppc405_boards.c
+++ b/hw/ppc405_boards.c
@@ -344,7 +344,7 @@ static void ref405ep_init (ram_addr_t ram_size,
printf("bdloc %016lx\n", (unsigned long)bdloc);
}
-QEMUMachine ref405ep_machine = {
+static QEMUMachine ref405ep_machine = {
.name = "ref405ep",
.desc = "ref405ep",
.init = ref405ep_init,
@@ -624,8 +624,16 @@ static void taihu_405ep_init(ram_addr_t ram_size,
#endif
}
-QEMUMachine taihu_machine = {
+static QEMUMachine taihu_machine = {
.name = "taihu",
.desc = "taihu",
.init = taihu_405ep_init,
};
+
+static void ppc405_machine_init(void)
+{
+ qemu_register_machine(&ref405ep_machine);
+ qemu_register_machine(&taihu_machine);
+}
+
+machine_init(ppc405_machine_init);
diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
index aaf0a48a5f..cbe7236a4f 100644
--- a/hw/ppc440_bamboo.c
+++ b/hw/ppc440_bamboo.c
@@ -185,8 +185,15 @@ static void bamboo_init(ram_addr_t ram_size,
kvmppc_init();
}
-QEMUMachine bamboo_machine = {
+static QEMUMachine bamboo_machine = {
.name = "bamboo",
.desc = "bamboo",
.init = bamboo_init,
};
+
+static void bamboo_machine_init(void)
+{
+ qemu_register_machine(&bamboo_machine);
+}
+
+machine_init(bamboo_machine_init);
diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index 29faa06318..ce35dd9c37 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -351,9 +351,16 @@ static void ppc_core99_init (ram_addr_t ram_size,
qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
}
-QEMUMachine core99_machine = {
+static QEMUMachine core99_machine = {
.name = "mac99",
.desc = "Mac99 based PowerMAC",
.init = ppc_core99_init,
.max_cpus = MAX_CPUS,
};
+
+static void core99_machine_init(void)
+{
+ qemu_register_machine(&core99_machine);
+}
+
+machine_init(core99_machine_init);
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index a822bfe1d9..c6ec635ef8 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -381,9 +381,16 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
qemu_register_boot_set(fw_cfg_boot_set, fw_cfg);
}
-QEMUMachine heathrow_machine = {
+static QEMUMachine heathrow_machine = {
.name = "g3beige",
.desc = "Heathrow based PowerMAC",
.init = ppc_heathrow_init,
.max_cpus = MAX_CPUS,
};
+
+static void heathrow_machine_init(void)
+{
+ qemu_register_machine(&heathrow_machine);
+}
+
+machine_init(heathrow_machine_init);
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index a805c293e7..ef499b3054 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -756,9 +756,16 @@ static void ppc_prep_init (ram_addr_t ram_size,
register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL);
}
-QEMUMachine prep_machine = {
+static QEMUMachine prep_machine = {
.name = "prep",
.desc = "PowerPC PREP platform",
.init = ppc_prep_init,
.max_cpus = MAX_CPUS,
};
+
+static void prep_machine_init(void)
+{
+ qemu_register_machine(&prep_machine);
+}
+
+machine_init(prep_machine_init);
diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index b6303157be..632fb05add 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -281,8 +281,15 @@ static void mpc8544ds_init(ram_addr_t ram_size,
return;
}
-QEMUMachine mpc8544ds_machine = {
+static QEMUMachine mpc8544ds_machine = {
.name = "mpc8544ds",
.desc = "mpc8544ds",
.init = mpc8544ds_init,
};
+
+static void mpc8544ds_machine_init(void)
+{
+ qemu_register_machine(&mpc8544ds_machine);
+}
+
+machine_init(mpc8544ds_machine_init);
diff --git a/hw/r2d.c b/hw/r2d.c
index 49bf9ac9e5..5b69c4f5d5 100644
--- a/hw/r2d.c
+++ b/hw/r2d.c
@@ -258,8 +258,15 @@ static void r2d_init(ram_addr_t ram_size,
}
}
-QEMUMachine r2d_machine = {
+static QEMUMachine r2d_machine = {
.name = "r2d",
.desc = "r2d-plus board",
.init = r2d_init,
};
+
+static void r2d_machine_init(void)
+{
+ qemu_register_machine(&r2d_machine);
+}
+
+machine_init(r2d_machine_init);
diff --git a/hw/realview.c b/hw/realview.c
index da2948b30d..49e07fd1d2 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -202,3 +202,10 @@ QEMUMachine realview_machine = {
.init = realview_init,
.use_scsi = 1,
};
+
+static void realview_machine_init(void)
+{
+ qemu_register_machine(&realview_machine);
+}
+
+machine_init(realview_machine_init);
diff --git a/hw/shix.c b/hw/shix.c
index 9277be07d0..eeee6bbc43 100644
--- a/hw/shix.c
+++ b/hw/shix.c
@@ -88,8 +88,15 @@ static void shix_init(ram_addr_t ram_size,
fprintf(stderr, "initialization terminated\n");
}
-QEMUMachine shix_machine = {
+static QEMUMachine shix_machine = {
.name = "shix",
.desc = "shix card",
.init = shix_init,
};
+
+static void shix_machine_init(void)
+{
+ qemu_register_machine(&shix_machine);
+}
+
+machine_init(shix_machine_init);
diff --git a/hw/spitz.c b/hw/spitz.c
index c902006fc7..dd167806c2 100644
--- a/hw/spitz.c
+++ b/hw/spitz.c
@@ -1050,24 +1050,34 @@ QEMUMachine akitapda_machine = {
.init = akita_init,
};
-QEMUMachine spitzpda_machine = {
+static QEMUMachine spitzpda_machine = {
.name = "spitz",
.desc = "Spitz PDA (PXA270)",
.init = spitz_init,
};
-QEMUMachine borzoipda_machine = {
+static QEMUMachine borzoipda_machine = {
.name = "borzoi",
.desc = "Borzoi PDA (PXA270)",
.init = borzoi_init,
};
-QEMUMachine terrierpda_machine = {
+static QEMUMachine terrierpda_machine = {
.name = "terrier",
.desc = "Terrier PDA (PXA270)",
.init = terrier_init,
};
+static void spitz_machine_init(void)
+{
+ qemu_register_machine(&akitapda_machine);
+ qemu_register_machine(&spitzpda_machine);
+ qemu_register_machine(&borzoipda_machine);
+ qemu_register_machine(&terrierpda_machine);
+}
+
+machine_init(spitz_machine_init);
+
static SSISlaveInfo corgi_ssp_info = {
.init = corgi_ssp_init,
.transfer = corgi_ssp_transfer
diff --git a/hw/stellaris.c b/hw/stellaris.c
index a50800ff99..e7f3604f78 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -1396,18 +1396,26 @@ static void lm3s6965evb_init(ram_addr_t ram_size,
stellaris_init(kernel_filename, cpu_model, &stellaris_boards[1]);
}
-QEMUMachine lm3s811evb_machine = {
+static QEMUMachine lm3s811evb_machine = {
.name = "lm3s811evb",
.desc = "Stellaris LM3S811EVB",
.init = lm3s811evb_init,
};
-QEMUMachine lm3s6965evb_machine = {
+static QEMUMachine lm3s6965evb_machine = {
.name = "lm3s6965evb",
.desc = "Stellaris LM3S6965EVB",
.init = lm3s6965evb_init,
};
+static void stellaris_machine_init(void)
+{
+ qemu_register_machine(&lm3s811evb_machine);
+ qemu_register_machine(&lm3s6965evb_machine);
+}
+
+machine_init(stellaris_machine_init);
+
static SSISlaveInfo stellaris_ssi_bus_info = {
.init = stellaris_ssi_bus_init,
.transfer = stellaris_ssi_bus_transfer
diff --git a/hw/sun4m.c b/hw/sun4m.c
index ec933786ef..f6b35effde 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -1032,14 +1032,14 @@ static void sbook_init(ram_addr_t RAM_size,
kernel_cmdline, initrd_filename, cpu_model);
}
-QEMUMachine ss5_machine = {
+static QEMUMachine ss5_machine = {
.name = "SS-5",
.desc = "Sun4m platform, SPARCstation 5",
.init = ss5_init,
.use_scsi = 1,
};
-QEMUMachine ss10_machine = {
+static QEMUMachine ss10_machine = {
.name = "SS-10",
.desc = "Sun4m platform, SPARCstation 10",
.init = ss10_init,
@@ -1047,7 +1047,7 @@ QEMUMachine ss10_machine = {
.max_cpus = 4,
};
-QEMUMachine ss600mp_machine = {
+static QEMUMachine ss600mp_machine = {
.name = "SS-600MP",
.desc = "Sun4m platform, SPARCserver 600MP",
.init = ss600mp_init,
@@ -1055,7 +1055,7 @@ QEMUMachine ss600mp_machine = {
.max_cpus = 4,
};
-QEMUMachine ss20_machine = {
+static QEMUMachine ss20_machine = {
.name = "SS-20",
.desc = "Sun4m platform, SPARCstation 20",
.init = ss20_init,
@@ -1063,35 +1063,35 @@ QEMUMachine ss20_machine = {
.max_cpus = 4,
};
-QEMUMachine voyager_machine = {
+static QEMUMachine voyager_machine = {
.name = "Voyager",
.desc = "Sun4m platform, SPARCstation Voyager",
.init = vger_init,
.use_scsi = 1,
};
-QEMUMachine ss_lx_machine = {
+static QEMUMachine ss_lx_machine = {
.name = "LX",
.desc = "Sun4m platform, SPARCstation LX",
.init = ss_lx_init,
.use_scsi = 1,
};
-QEMUMachine ss4_machine = {
+static QEMUMachine ss4_machine = {
.name = "SS-4",
.desc = "Sun4m platform, SPARCstation 4",
.init = ss4_init,
.use_scsi = 1,
};
-QEMUMachine scls_machine = {
+static QEMUMachine scls_machine = {
.name = "SPARCClassic",
.desc = "Sun4m platform, SPARCClassic",
.init = scls_init,
.use_scsi = 1,
};
-QEMUMachine sbook_machine = {
+static QEMUMachine sbook_machine = {
.name = "SPARCbook",
.desc = "Sun4m platform, SPARCbook",
.init = sbook_init,
@@ -1335,7 +1335,7 @@ static void ss2000_init(ram_addr_t RAM_size,
kernel_cmdline, initrd_filename, cpu_model);
}
-QEMUMachine ss1000_machine = {
+static QEMUMachine ss1000_machine = {
.name = "SS-1000",
.desc = "Sun4d platform, SPARCserver 1000",
.init = ss1000_init,
@@ -1343,7 +1343,7 @@ QEMUMachine ss1000_machine = {
.max_cpus = 8,
};
-QEMUMachine ss2000_machine = {
+static QEMUMachine ss2000_machine = {
.name = "SS-2000",
.desc = "Sun4d platform, SPARCcenter 2000",
.init = ss2000_init,
@@ -1543,9 +1543,27 @@ static void ss2_init(ram_addr_t RAM_size,
kernel_cmdline, initrd_filename, cpu_model);
}
-QEMUMachine ss2_machine = {
+static QEMUMachine ss2_machine = {
.name = "SS-2",
.desc = "Sun4c platform, SPARCstation 2",
.init = ss2_init,
.use_scsi = 1,
};
+
+static void ss2_machine_init(void)
+{
+ qemu_register_machine(&ss5_machine);
+ qemu_register_machine(&ss10_machine);
+ qemu_register_machine(&ss600mp_machine);
+ qemu_register_machine(&ss20_machine);
+ qemu_register_machine(&voyager_machine);
+ qemu_register_machine(&ss_lx_machine);
+ qemu_register_machine(&ss4_machine);
+ qemu_register_machine(&scls_machine);
+ qemu_register_machine(&sbook_machine);
+ qemu_register_machine(&ss1000_machine);
+ qemu_register_machine(&ss2000_machine);
+ qemu_register_machine(&ss2_machine);
+}
+
+machine_init(ss2_machine_init);
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 1c8b136024..1ff0efa897 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -589,23 +589,32 @@ static void niagara_init(ram_addr_t RAM_size,
kernel_cmdline, initrd_filename, cpu_model, &hwdefs[2]);
}
-QEMUMachine sun4u_machine = {
+static QEMUMachine sun4u_machine = {
.name = "sun4u",
.desc = "Sun4u platform",
.init = sun4u_init,
.max_cpus = 1, // XXX for now
};
-QEMUMachine sun4v_machine = {
+static QEMUMachine sun4v_machine = {
.name = "sun4v",
.desc = "Sun4v platform",
.init = sun4v_init,
.max_cpus = 1, // XXX for now
};
-QEMUMachine niagara_machine = {
+static QEMUMachine niagara_machine = {
.name = "Niagara",
.desc = "Sun4v platform, Niagara",
.init = niagara_init,
.max_cpus = 1, // XXX for now
};
+
+static void sun4u_machine_init(void)
+{
+ qemu_register_machine(&sun4u_machine);
+ qemu_register_machine(&sun4v_machine);
+ qemu_register_machine(&niagara_machine);
+}
+
+machine_init(sun4u_machine_init);
diff --git a/hw/syborg.c b/hw/syborg.c
index 99f9dbbdba..ae0ca67027 100644
--- a/hw/syborg.c
+++ b/hw/syborg.c
@@ -98,8 +98,15 @@ static void syborg_init(ram_addr_t ram_size,
arm_load_kernel(env, &syborg_binfo);
}
-QEMUMachine syborg_machine = {
+static QEMUMachine syborg_machine = {
.name = "syborg",
.desc = "Syborg (Symbian Virtual Platform)",
.init = syborg_init,
};
+
+static void syborg_machine_init(void)
+{
+ qemu_register_machine(&syborg_machine);
+}
+
+machine_init(syborg_machine_init);
diff --git a/hw/tosa.c b/hw/tosa.c
index 24227d83de..a606156e97 100644
--- a/hw/tosa.c
+++ b/hw/tosa.c
@@ -238,12 +238,19 @@ static void tosa_init(ram_addr_t ram_size,
sl_bootparam_write(SL_PXA_PARAM_BASE);
}
-QEMUMachine tosapda_machine = {
+static QEMUMachine tosapda_machine = {
.name = "tosa",
.desc = "Tosa PDA (PXA255)",
.init = tosa_init,
};
+static void tosapda_machine_init(void)
+{
+ qemu_register_machine(&tosapda_machine);
+}
+
+machine_init(tosapda_machine_init);
+
static I2CSlaveInfo tosa_dac_info = {
.init = tosa_dac_init,
.event = tosa_dac_event,
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index ecbd3bf2e3..5ae57e329d 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -309,20 +309,28 @@ static void vab_init(ram_addr_t ram_size,
initrd_filename, cpu_model, 0x25e);
}
-QEMUMachine versatilepb_machine = {
+static QEMUMachine versatilepb_machine = {
.name = "versatilepb",
.desc = "ARM Versatile/PB (ARM926EJ-S)",
.init = vpb_init,
.use_scsi = 1,
};
-QEMUMachine versatileab_machine = {
+static QEMUMachine versatileab_machine = {
.name = "versatileab",
.desc = "ARM Versatile/AB (ARM926EJ-S)",
.init = vab_init,
.use_scsi = 1,
};
+static void versatile_machine_init(void)
+{
+ qemu_register_machine(&versatilepb_machine);
+ qemu_register_machine(&versatileab_machine);
+}
+
+machine_init(versatile_machine_init);
+
static void versatilepb_register_devices(void)
{
sysbus_register_dev("versatilepb_sic", sizeof(vpb_sic_state),
diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c
index 58209b89a9..f59f633a8c 100644
--- a/hw/xen_machine_pv.c
+++ b/hw/xen_machine_pv.c
@@ -110,9 +110,16 @@ static void xen_init_pv(ram_addr_t ram_size, int vga_ram_size,
xen_init_display(xen_domid);
}
-QEMUMachine xenpv_machine = {
+static QEMUMachine xenpv_machine = {
.name = "xenpv",
.desc = "Xen Para-virtualized PC",
.init = xen_init_pv,
.max_cpus = 1,
};
+
+static void xenpv_machine_init(void)
+{
+ qemu_register_machine(&xenpv_machine);
+}
+
+machine_init(xenpv_machine_init);
diff --git a/module.h b/module.h
index 903c95b5d3..9263f1c7e2 100644
--- a/module.h
+++ b/module.h
@@ -23,11 +23,13 @@ static void __attribute__((constructor)) do_qemu_init_ ## function(void) { \
typedef enum {
MODULE_INIT_BLOCK,
MODULE_INIT_DEVICE,
+ MODULE_INIT_MACHINE,
MODULE_INIT_MAX
} module_init_type;
#define block_init(function) module_init(function, MODULE_INIT_BLOCK)
#define device_init(function) module_init(function, MODULE_INIT_DEVICE)
+#define machine_init(function) module_init(function, MODULE_INIT_MACHINE)
void register_module_init(void (*fn)(void), module_init_type type);
diff --git a/target-arm/machine.c b/target-arm/machine.c
index d5a49141ae..b1deacb8f6 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -1,31 +1,6 @@
#include "hw/hw.h"
#include "hw/boards.h"
-void register_machines(void)
-{
- qemu_register_machine(&integratorcp_machine);
- qemu_register_machine(&versatilepb_machine);
- qemu_register_machine(&versatileab_machine);
- qemu_register_machine(&realview_machine);
- qemu_register_machine(&akitapda_machine);
- qemu_register_machine(&spitzpda_machine);
- qemu_register_machine(&borzoipda_machine);
- qemu_register_machine(&terrierpda_machine);
- qemu_register_machine(&sx1_machine_v1);
- qemu_register_machine(&sx1_machine_v2);
- qemu_register_machine(&palmte_machine);
- qemu_register_machine(&n800_machine);
- qemu_register_machine(&n810_machine);
- qemu_register_machine(&lm3s811evb_machine);
- qemu_register_machine(&lm3s6965evb_machine);
- qemu_register_machine(&connex_machine);
- qemu_register_machine(&verdex_machine);
- qemu_register_machine(&mainstone2_machine);
- qemu_register_machine(&musicpal_machine);
- qemu_register_machine(&tosapda_machine);
- qemu_register_machine(&syborg_machine);
-}
-
void cpu_save(QEMUFile *f, void *opaque)
{
int i;
diff --git a/target-cris/machine.c b/target-cris/machine.c
index 2d3396d8b3..8f9c0dd59f 100644
--- a/target-cris/machine.c
+++ b/target-cris/machine.c
@@ -1,12 +1,6 @@
#include "hw/hw.h"
#include "hw/boards.h"
-void register_machines(void)
-{
- qemu_register_machine(&bareetraxfs_machine);
- qemu_register_machine(&axisdev88_machine);
-}
-
void cpu_save(QEMUFile *f, void *opaque)
{
CPUCRISState *env = opaque;
diff --git a/target-i386/machine.c b/target-i386/machine.c
index 1b0d36d404..55716fe561 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -5,15 +5,6 @@
#include "exec-all.h"
-void register_machines(void)
-{
- qemu_register_machine(&pc_machine);
- qemu_register_machine(&isapc_machine);
-#ifdef CONFIG_XEN
- qemu_register_machine(&xenpv_machine);
-#endif
-}
-
static void cpu_put_seg(QEMUFile *f, SegmentCache *dt)
{
qemu_put_be32(f, dt->selector);
diff --git a/target-m68k/machine.c b/target-m68k/machine.c
index fbdcac9d1f..e69de29bb2 100644
--- a/target-m68k/machine.c
+++ b/target-m68k/machine.c
@@ -1,9 +0,0 @@
-#include "hw/hw.h"
-#include "hw/boards.h"
-
-void register_machines(void)
-{
- qemu_register_machine(&mcf5208evb_machine);
- qemu_register_machine(&an5206_machine);
- qemu_register_machine(&dummy_m68k_machine);
-}
diff --git a/target-mips/machine.c b/target-mips/machine.c
index 1c3a8c99c4..4b89d29c72 100644
--- a/target-mips/machine.c
+++ b/target-mips/machine.c
@@ -3,15 +3,6 @@
#include "exec-all.h"
-void register_machines(void)
-{
- qemu_register_machine(&mips_malta_machine);
- qemu_register_machine(&mips_magnum_machine);
- qemu_register_machine(&mips_pica61_machine);
- qemu_register_machine(&mips_mipssim_machine);
- qemu_register_machine(&mips_machine);
-}
-
static void save_tc(QEMUFile *f, TCState *tc)
{
int i;
diff --git a/target-ppc/machine.c b/target-ppc/machine.c
index 8b82005a10..c15776f690 100644
--- a/target-ppc/machine.c
+++ b/target-ppc/machine.c
@@ -1,17 +1,6 @@
#include "hw/hw.h"
#include "hw/boards.h"
-void register_machines(void)
-{
- qemu_register_machine(&heathrow_machine);
- qemu_register_machine(&core99_machine);
- qemu_register_machine(&prep_machine);
- qemu_register_machine(&ref405ep_machine);
- qemu_register_machine(&taihu_machine);
- qemu_register_machine(&bamboo_machine);
- qemu_register_machine(&mpc8544ds_machine);
-}
-
void cpu_save(QEMUFile *f, void *opaque)
{
CPUState *env = (CPUState *)opaque;
diff --git a/target-sh4/machine.c b/target-sh4/machine.c
index 2d78aae6dd..e69de29bb2 100644
--- a/target-sh4/machine.c
+++ b/target-sh4/machine.c
@@ -1,8 +0,0 @@
-#include "hw/hw.h"
-#include "hw/boards.h"
-
-void register_machines(void)
-{
- qemu_register_machine(&shix_machine);
- qemu_register_machine(&r2d_machine);
-}
diff --git a/target-sparc/machine.c b/target-sparc/machine.c
index e845fac358..4984e8d886 100644
--- a/target-sparc/machine.c
+++ b/target-sparc/machine.c
@@ -4,28 +4,6 @@
#include "exec-all.h"
-void register_machines(void)
-{
-#ifdef TARGET_SPARC64
- qemu_register_machine(&sun4u_machine);
- qemu_register_machine(&sun4v_machine);
- qemu_register_machine(&niagara_machine);
-#else
- qemu_register_machine(&ss5_machine);
- qemu_register_machine(&ss10_machine);
- qemu_register_machine(&ss600mp_machine);
- qemu_register_machine(&ss20_machine);
- qemu_register_machine(&ss2_machine);
- qemu_register_machine(&voyager_machine);
- qemu_register_machine(&ss_lx_machine);
- qemu_register_machine(&ss4_machine);
- qemu_register_machine(&scls_machine);
- qemu_register_machine(&sbook_machine);
- qemu_register_machine(&ss1000_machine);
- qemu_register_machine(&ss2000_machine);
-#endif
-}
-
void cpu_save(QEMUFile *f, void *opaque)
{
CPUState *env = opaque;
diff --git a/vl.c b/vl.c
index e28da7ed7d..68c8514aa5 100644
--- a/vl.c
+++ b/vl.c
@@ -4876,7 +4876,7 @@ int main(int argc, char **argv, char **envp)
}
#endif
- register_machines();
+ module_call_init(MODULE_INIT_MACHINE);
machine = first_machine;
cpu_model = NULL;
initrd_filename = NULL;