null-machine.c 1.3 KB

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