| 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/core/boards.h" |
| 17 | #include "system/address-spaces.h" |
| 18 | #include "hw/core/cpu.h" |
| 19 | #include "hw/arm/machines-qom.h" |
| 20 | #include "hw/riscv/machines-qom.h" |
| 21 | |
| 22 | static void machine_none_init(MachineState *mch) |
| 23 | { |
| 24 | CPUState *cpu = NULL; |
| 25 | |
| 26 | /* Initialize CPU (if user asked for it) */ |
| 27 | if (mch->cpu_type) { |
| 28 | cpu = cpu_create(mch->cpu_type); |
| 29 | if (!cpu) { |
| 30 | error_report("Unable to initialize CPU"); |
| 31 | exit(1); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | /* RAM at address zero */ |
| 36 | if (mch->ram) { |
| 37 | memory_region_add_subregion(get_system_memory(), 0, mch->ram); |
| 38 | } |
| 39 | |
| 40 | if (mch->kernel_filename) { |
| 41 | error_report("The -kernel parameter is not supported " |
| 42 | "(use the generic 'loader' device instead)."); |
| 43 | exit(1); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | static void machine_none_machine_init(MachineClass *mc) |
| 48 | { |
| 49 | mc->desc = "empty machine"; |
| 50 | mc->init = machine_none_init; |
| 51 | mc->max_cpus = 1; |
| 52 | mc->default_ram_size = 0; |
| 53 | mc->default_ram_id = "ram"; |
| 54 | mc->no_serial = 1; |
| 55 | mc->no_parallel = 1; |
| 56 | mc->no_floppy = 1; |
| 57 | mc->no_cdrom = 1; |
| 58 | } |
| 59 | |
| 60 | DEFINE_MACHINE_WITH_INTERFACES("none", machine_none_machine_init, |
| 61 | { TYPE_TARGET_AARCH64_MACHINE }, |
| 62 | { TYPE_TARGET_ARM_MACHINE }, |
| 63 | { TYPE_TARGET_RISCV32_MACHINE }, |
| 64 | { TYPE_TARGET_RISCV64_MACHINE }, |
| 65 | { }) |