1 /* 2 * Empty machine 3 * 4 * Copyright IBM, Corp. 2012 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * 9 * This work is licensed under the terms of the GNU GPL, version 2 or later. 10 * See the COPYING file in the top-level directory. 11 * 12 */ 13 14 #include "qemu/osdep.h" 15 #include "qemu/error-report.h" 16 #include "hw/boards.h" 17 #include "sysemu/sysemu.h" 18 #include "exec/address-spaces.h" 19 #include "qom/cpu.h" 20 21 static void machine_none_init(MachineState *mch) 22 { 23 CPUState *cpu = NULL; 24 25 /* Initialize CPU (if user asked for it) */ 26 if (mch->cpu_type) { 27 cpu = cpu_create(mch->cpu_type); 28 if (!cpu) { 29 error_report("Unable to initialize CPU"); 30 exit(1); 31 } 32 } 33 34 /* RAM at address zero */ 35 if (mch->ram_size) { 36 MemoryRegion *ram = g_new(MemoryRegion, 1); 37 38 memory_region_allocate_system_memory(ram, NULL, "ram", mch->ram_size); 39 memory_region_add_subregion(get_system_memory(), 0, ram); 40 } 41 42 if (mch->kernel_filename) { 43 error_report("The -kernel parameter is not supported " 44 "(use the generic 'loader' device instead)."); 45 exit(1); 46 } 47 } 48 49 static void machine_none_machine_init(MachineClass *mc) 50 { 51 mc->desc = "empty machine"; 52 mc->init = machine_none_init; 53 mc->max_cpus = 1; 54 mc->default_ram_size = 0; 55 } 56 57 DEFINE_MACHINE("none", machine_none_machine_init) 58