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