null-machine.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include "qemu/osdep.h"
  14. #include "qemu/error-report.h"
  15. #include "hw/boards.h"
  16. #include "sysemu/sysemu.h"
  17. #include "exec/address-spaces.h"
  18. #include "hw/core/cpu.h"
  19. static void machine_none_init(MachineState *mch)
  20. {
  21. CPUState *cpu = NULL;
  22. /* Initialize CPU (if user asked for it) */
  23. if (mch->cpu_type) {
  24. cpu = cpu_create(mch->cpu_type);
  25. if (!cpu) {
  26. error_report("Unable to initialize CPU");
  27. exit(1);
  28. }
  29. }
  30. /* RAM at address zero */
  31. if (mch->ram_size) {
  32. MemoryRegion *ram = g_new(MemoryRegion, 1);
  33. memory_region_allocate_system_memory(ram, NULL, "ram", mch->ram_size);
  34. memory_region_add_subregion(get_system_memory(), 0, ram);
  35. }
  36. if (mch->kernel_filename) {
  37. error_report("The -kernel parameter is not supported "
  38. "(use the generic 'loader' device instead).");
  39. exit(1);
  40. }
  41. }
  42. static void machine_none_machine_init(MachineClass *mc)
  43. {
  44. mc->desc = "empty machine";
  45. mc->init = machine_none_init;
  46. mc->max_cpus = 1;
  47. mc->default_ram_size = 0;
  48. }
  49. DEFINE_MACHINE("none", machine_none_machine_init)