xref: /qemu/hw/core/null-machine.c (revision 3964ec6c0b49e4c2fa3e48fdbbb7d8ff0c1cb00b)
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"
15b4a738bfSAnthony Liguori #include "qemu-common.h"
16*3964ec6cSThomas Huth #include "qemu/error-report.h"
17b4a738bfSAnthony Liguori #include "hw/hw.h"
18b4a738bfSAnthony Liguori #include "hw/boards.h"
19*3964ec6cSThomas Huth #include "sysemu/sysemu.h"
20*3964ec6cSThomas Huth #include "exec/address-spaces.h"
21*3964ec6cSThomas Huth #include "cpu.h"
22b4a738bfSAnthony Liguori 
23*3964ec6cSThomas Huth static void machine_none_init(MachineState *mch)
24b4a738bfSAnthony Liguori {
25*3964ec6cSThomas Huth     CPUState *cpu = NULL;
26*3964ec6cSThomas Huth 
27*3964ec6cSThomas Huth     /* Initialize CPU (if a model has been specified) */
28*3964ec6cSThomas Huth     if (mch->cpu_model) {
29*3964ec6cSThomas Huth         cpu = cpu_init(mch->cpu_model);
30*3964ec6cSThomas Huth         if (!cpu) {
31*3964ec6cSThomas Huth             error_report("Unable to initialize CPU");
32*3964ec6cSThomas Huth             exit(1);
33*3964ec6cSThomas Huth         }
34*3964ec6cSThomas Huth     }
35*3964ec6cSThomas Huth 
36*3964ec6cSThomas Huth     /* RAM at address zero */
37*3964ec6cSThomas Huth     if (mch->ram_size) {
38*3964ec6cSThomas Huth         MemoryRegion *ram = g_new(MemoryRegion, 1);
39*3964ec6cSThomas Huth 
40*3964ec6cSThomas Huth         memory_region_allocate_system_memory(ram, NULL, "ram", mch->ram_size);
41*3964ec6cSThomas Huth         memory_region_add_subregion(get_system_memory(), 0, ram);
42*3964ec6cSThomas Huth     }
43b4a738bfSAnthony Liguori }
44b4a738bfSAnthony Liguori 
45e264d29dSEduardo Habkost static void machine_none_machine_init(MachineClass *mc)
46b4a738bfSAnthony Liguori {
47e264d29dSEduardo Habkost     mc->desc = "empty machine";
48e264d29dSEduardo Habkost     mc->init = machine_none_init;
49*3964ec6cSThomas Huth     mc->max_cpus = 1;
50*3964ec6cSThomas Huth     mc->default_ram_size = 0;
51b4a738bfSAnthony Liguori }
52b4a738bfSAnthony Liguori 
53e264d29dSEduardo Habkost DEFINE_MACHINE("none", machine_none_machine_init)
54