2
0

sysemu-cpu-ops.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * CPU operations specific to system emulation
  3. *
  4. * Copyright (c) 2012 SUSE LINUX Products GmbH
  5. *
  6. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  7. * See the COPYING file in the top-level directory.
  8. */
  9. #ifndef SYSTEM_CPU_OPS_H
  10. #define SYSTEM_CPU_OPS_H
  11. #include "hw/core/cpu.h"
  12. /*
  13. * struct SysemuCPUOps: System operations specific to a CPU class
  14. */
  15. typedef struct SysemuCPUOps {
  16. /**
  17. * @has_work: Callback for checking if there is work to do.
  18. */
  19. bool (*has_work)(CPUState *cpu); /* MANDATORY NON-NULL */
  20. /**
  21. * @get_memory_mapping: Callback for obtaining the memory mappings.
  22. */
  23. bool (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
  24. Error **errp);
  25. /**
  26. * @get_paging_enabled: Callback for inquiring whether paging is enabled.
  27. */
  28. bool (*get_paging_enabled)(const CPUState *cpu);
  29. /**
  30. * @get_phys_page_debug: Callback for obtaining a physical address.
  31. */
  32. hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
  33. /**
  34. * @get_phys_page_attrs_debug: Callback for obtaining a physical address
  35. * and the associated memory transaction attributes to use for the
  36. * access.
  37. * CPUs which use memory transaction attributes should implement this
  38. * instead of get_phys_page_debug.
  39. */
  40. hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
  41. MemTxAttrs *attrs);
  42. /**
  43. * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
  44. * a memory access with the specified memory transaction attributes.
  45. */
  46. int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
  47. /**
  48. * @get_crash_info: Callback for reporting guest crash information in
  49. * GUEST_PANICKED events.
  50. */
  51. GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
  52. /**
  53. * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
  54. * 32-bit VM coredump.
  55. */
  56. int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
  57. int cpuid, DumpState *s);
  58. /**
  59. * @write_elf64_note: Callback for writing a CPU-specific ELF note to a
  60. * 64-bit VM coredump.
  61. */
  62. int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
  63. int cpuid, DumpState *s);
  64. /**
  65. * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
  66. * note to a 32-bit VM coredump.
  67. */
  68. int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
  69. DumpState *s);
  70. /**
  71. * @write_elf64_qemunote: Callback for writing a CPU- and QEMU-specific ELF
  72. * note to a 64-bit VM coredump.
  73. */
  74. int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
  75. DumpState *s);
  76. /**
  77. * @virtio_is_big_endian: Callback to return %true if a CPU which supports
  78. * runtime configurable endianness is currently big-endian.
  79. * Non-configurable CPUs can use the default implementation of this method.
  80. * This method should not be used by any callers other than the pre-1.0
  81. * virtio devices.
  82. */
  83. bool (*virtio_is_big_endian)(CPUState *cpu);
  84. /**
  85. * @legacy_vmsd: Legacy state for migration.
  86. * Do not use in new targets, use #DeviceClass::vmsd instead.
  87. */
  88. const VMStateDescription *legacy_vmsd;
  89. } SysemuCPUOps;
  90. #endif /* SYSTEM_CPU_OPS_H */