xref: /openbmc/qemu/include/hw/core/sysemu-cpu-ops.h (revision faf39e828374d83ca82b02c0c25cdeca9ce9581e)
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 SYSEMU_CPU_OPS_H
11 #define SYSEMU_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      * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
21      *       a memory access with the specified memory transaction attributes.
22      */
23     int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
24     /**
25      * @get_crash_info: Callback for reporting guest crash information in
26      * GUEST_PANICKED events.
27      */
28     GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
29     /**
30      * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
31      * 32-bit VM coredump.
32      */
33     int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
34                             int cpuid, void *opaque);
35     /**
36      * @write_elf64_note: Callback for writing a CPU-specific ELF note to a
37      * 64-bit VM coredump.
38      */
39     int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
40                             int cpuid, void *opaque);
41     /**
42      * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
43      * note to a 32-bit VM coredump.
44      */
45     int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
46                                 void *opaque);
47     /**
48      * @write_elf64_qemunote: Callback for writing a CPU- and QEMU-specific ELF
49      * note to a 64-bit VM coredump.
50      */
51     int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
52                                 void *opaque);
53     /**
54      * @virtio_is_big_endian: Callback to return %true if a CPU which supports
55      * runtime configurable endianness is currently big-endian.
56      * Non-configurable CPUs can use the default implementation of this method.
57      * This method should not be used by any callers other than the pre-1.0
58      * virtio devices.
59      */
60     bool (*virtio_is_big_endian)(CPUState *cpu);
61 
62     /**
63      * @legacy_vmsd: Legacy state for migration.
64      *               Do not use in new targets, use #DeviceClass::vmsd instead.
65      */
66     const VMStateDescription *legacy_vmsd;
67 
68 } SysemuCPUOps;
69 
70 #endif /* SYSEMU_CPU_OPS_H */
71