xref: /qemu/hw/core/null-machine.c (revision 9e7871b1fca452e6ca125ff74baa3332e99ad5fe)
1b4a738bfSAnthony Liguori /*
2b4a738bfSAnthony Liguori  * Empty machine
3b4a738bfSAnthony Liguori  *
4b4a738bfSAnthony Liguori  * Copyright IBM, Corp. 2012
5b4a738bfSAnthony Liguori  *
6b4a738bfSAnthony Liguori  * Authors:
7b4a738bfSAnthony Liguori  *  Anthony Liguori   <aliguori@us.ibm.com>
8b4a738bfSAnthony Liguori  *
9b4a738bfSAnthony Liguori  * This work is licensed under the terms of the GNU GPL, version 2 or later.
10b4a738bfSAnthony Liguori  * See the COPYING file in the top-level directory.
11b4a738bfSAnthony Liguori  *
12b4a738bfSAnthony Liguori  */
13b4a738bfSAnthony Liguori 
1418c86e2bSPeter Maydell #include "qemu/osdep.h"
153964ec6cSThomas Huth #include "qemu/error-report.h"
16b4a738bfSAnthony Liguori #include "hw/boards.h"
173964ec6cSThomas Huth #include "sysemu/sysemu.h"
183964ec6cSThomas Huth #include "exec/address-spaces.h"
192e5b09fdSMarkus Armbruster #include "hw/core/cpu.h"
20b4a738bfSAnthony Liguori 
213964ec6cSThomas Huth static void machine_none_init(MachineState *mch)
22b4a738bfSAnthony Liguori {
233964ec6cSThomas Huth     CPUState *cpu = NULL;
243964ec6cSThomas Huth 
252278b939SIgor Mammedov     /* Initialize CPU (if user asked for it) */
262278b939SIgor Mammedov     if (mch->cpu_type) {
272278b939SIgor Mammedov         cpu = cpu_create(mch->cpu_type);
283964ec6cSThomas Huth         if (!cpu) {
293964ec6cSThomas Huth             error_report("Unable to initialize CPU");
303964ec6cSThomas Huth             exit(1);
313964ec6cSThomas Huth         }
323964ec6cSThomas Huth     }
333964ec6cSThomas Huth 
343964ec6cSThomas Huth     /* RAM at address zero */
35c74e7190SIgor Mammedov     if (mch->ram) {
36c74e7190SIgor Mammedov         memory_region_add_subregion(get_system_memory(), 0, mch->ram);
373964ec6cSThomas Huth     }
38991db247SThomas Huth 
39991db247SThomas Huth     if (mch->kernel_filename) {
40991db247SThomas Huth         error_report("The -kernel parameter is not supported "
41991db247SThomas Huth                      "(use the generic 'loader' device instead).");
42991db247SThomas Huth         exit(1);
43991db247SThomas Huth     }
44b4a738bfSAnthony Liguori }
45b4a738bfSAnthony Liguori 
46e264d29dSEduardo Habkost static void machine_none_machine_init(MachineClass *mc)
47b4a738bfSAnthony Liguori {
48e264d29dSEduardo Habkost     mc->desc = "empty machine";
49e264d29dSEduardo Habkost     mc->init = machine_none_init;
503964ec6cSThomas Huth     mc->max_cpus = 1;
513964ec6cSThomas Huth     mc->default_ram_size = 0;
52c74e7190SIgor Mammedov     mc->default_ram_id = "ram";
53*9e7871b1SPhilippe Mathieu-Daudé     mc->no_serial = 1;
54*9e7871b1SPhilippe Mathieu-Daudé     mc->no_parallel = 1;
55*9e7871b1SPhilippe Mathieu-Daudé     mc->no_floppy = 1;
56*9e7871b1SPhilippe Mathieu-Daudé     mc->no_cdrom = 1;
57*9e7871b1SPhilippe Mathieu-Daudé     mc->no_sdcard = 1;
58b4a738bfSAnthony Liguori }
59b4a738bfSAnthony Liguori 
60e264d29dSEduardo Habkost DEFINE_MACHINE("none", machine_none_machine_init)
61