diff --git a/hw/boards.h b/hw/boards.h index 3144017668..f6733b7cc9 100644 --- a/hw/boards.h +++ b/hw/boards.h @@ -16,11 +16,11 @@ typedef struct QEMUMachine { QEMUMachineInitFunc *init; int use_scsi; int max_cpus; + int is_default; struct QEMUMachine *next; } QEMUMachine; int qemu_register_machine(QEMUMachine *m); -void register_machines(void); extern QEMUMachine *current_machine; diff --git a/hw/etraxfs.c b/hw/etraxfs.c index 27205ad579..f043c19d01 100644 --- a/hw/etraxfs.c +++ b/hw/etraxfs.c @@ -162,6 +162,7 @@ static QEMUMachine bareetraxfs_machine = { .name = "bareetraxfs", .desc = "Bare ETRAX FS board", .init = bareetraxfs_init, + .is_default = 1, }; static void bareetraxfs_machine_init(void) diff --git a/hw/integratorcp.c b/hw/integratorcp.c index ac0bd264ff..493866c92f 100644 --- a/hw/integratorcp.c +++ b/hw/integratorcp.c @@ -512,6 +512,7 @@ static QEMUMachine integratorcp_machine = { .name = "integratorcp", .desc = "ARM Integrator/CP (ARM926EJ-S)", .init = integratorcp_init, + .is_default = 1, }; static void integratorcp_machine_init(void) diff --git a/hw/mcf5208.c b/hw/mcf5208.c index 21b2bc8a4c..47a0f3eae0 100644 --- a/hw/mcf5208.c +++ b/hw/mcf5208.c @@ -290,6 +290,7 @@ static QEMUMachine mcf5208evb_machine = { .name = "mcf5208evb", .desc = "MCF5206EVB", .init = mcf5208evb_init, + .is_default = 1, }; static void mcf5208evb_machine_init(void) diff --git a/hw/mips_malta.c b/hw/mips_malta.c index eb81edf1c2..d8621824cb 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -953,6 +953,7 @@ static QEMUMachine mips_malta_machine = { .name = "malta", .desc = "MIPS Malta Core LV", .init = mips_malta_init, + .is_default = 1, }; static void mips_malta_machine_init(void) diff --git a/hw/pc.c b/hw/pc.c index 43b739146b..e9682fadf2 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1189,6 +1189,7 @@ static QEMUMachine pc_machine = { .desc = "Standard PC", .init = pc_init_pci, .max_cpus = 255, + .is_default = 1, }; static QEMUMachine isapc_machine = { diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index c6ec635ef8..377ed593a0 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -386,6 +386,7 @@ static QEMUMachine heathrow_machine = { .desc = "Heathrow based PowerMAC", .init = ppc_heathrow_init, .max_cpus = MAX_CPUS, + .is_default = 1, }; static void heathrow_machine_init(void) diff --git a/hw/shix.c b/hw/shix.c index eeee6bbc43..19b0155a49 100644 --- a/hw/shix.c +++ b/hw/shix.c @@ -92,6 +92,7 @@ static QEMUMachine shix_machine = { .name = "shix", .desc = "shix card", .init = shix_init, + .is_default = 1, }; static void shix_machine_init(void) diff --git a/hw/sun4m.c b/hw/sun4m.c index 1c0f46729a..a2e02316e8 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -1037,6 +1037,7 @@ static QEMUMachine ss5_machine = { .desc = "Sun4m platform, SPARCstation 5", .init = ss5_init, .use_scsi = 1, + .is_default = 1, }; static QEMUMachine ss10_machine = { diff --git a/hw/sun4u.c b/hw/sun4u.c index 1ff0efa897..08789bccc1 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -594,6 +594,7 @@ static QEMUMachine sun4u_machine = { .desc = "Sun4u platform", .init = sun4u_init, .max_cpus = 1, // XXX for now + .is_default = 1, }; static QEMUMachine sun4v_machine = { diff --git a/vl.c b/vl.c index a0ce977b7a..a24692c428 100644 --- a/vl.c +++ b/vl.c @@ -3497,6 +3497,18 @@ static QEMUMachine *find_machine(const char *name) return NULL; } +static QEMUMachine *find_default_machine(void) +{ + QEMUMachine *m; + + for(m = first_machine; m != NULL; m = m->next) { + if (m->is_default) { + return m; + } + } + return NULL; +} + /***********************************************************/ /* main execution loop */ @@ -4876,7 +4888,7 @@ int main(int argc, char **argv, char **envp) #endif module_call_init(MODULE_INIT_MACHINE); - machine = first_machine; + machine = find_default_machine(); cpu_model = NULL; initrd_filename = NULL; ram_size = 0; @@ -4967,7 +4979,7 @@ int main(int argc, char **argv, char **envp) for(m = first_machine; m != NULL; m = m->next) { printf("%-10s %s%s\n", m->name, m->desc, - m == first_machine ? " (default)" : ""); + m->is_default ? " (default)" : ""); } exit(*optarg != '?'); }