]> Git Repo - qemu.git/blame - include/qom/cpu.h
qemu-print: New qemu_fprintf(), qemu_vfprintf()
[qemu.git] / include / qom / cpu.h
CommitLineData
dd83b06a
AF
1/*
2 * QEMU CPU model
3 *
4 * Copyright (c) 2012 SUSE LINUX Products GmbH
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see
18 * <http://www.gnu.org/licenses/gpl-2.0.html>
19 */
20#ifndef QEMU_CPU_H
21#define QEMU_CPU_H
22
961f8395 23#include "hw/qdev-core.h"
37b9de46 24#include "disas/bfd.h"
c658b94f 25#include "exec/hwaddr.h"
66b9b43c 26#include "exec/memattrs.h"
9af23989 27#include "qapi/qapi-types-run-state.h"
48151859 28#include "qemu/bitmap.h"
c0b05ec5 29#include "qemu/fprintf-fn.h"
068a5ea0 30#include "qemu/rcu_queue.h"
bdc44640 31#include "qemu/queue.h"
1de7afc9 32#include "qemu/thread.h"
dd83b06a 33
b5ba1cc6
QN
34typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size,
35 void *opaque);
c72bf468 36
577f42c0
AF
37/**
38 * vaddr:
39 * Type wide enough to contain any #target_ulong virtual address.
40 */
41typedef uint64_t vaddr;
42#define VADDR_PRId PRId64
43#define VADDR_PRIu PRIu64
44#define VADDR_PRIo PRIo64
45#define VADDR_PRIx PRIx64
46#define VADDR_PRIX PRIX64
47#define VADDR_MAX UINT64_MAX
48
dd83b06a
AF
49/**
50 * SECTION:cpu
51 * @section_id: QEMU-cpu
52 * @title: CPU Class
53 * @short_description: Base class for all CPUs
54 */
55
56#define TYPE_CPU "cpu"
57
0d6d1ab4
AF
58/* Since this macro is used a lot in hot code paths and in conjunction with
59 * FooCPU *foo_env_get_cpu(), we deviate from usual QOM practice by using
60 * an unchecked cast.
61 */
62#define CPU(obj) ((CPUState *)(obj))
63
dd83b06a
AF
64#define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU)
65#define CPU_GET_CLASS(obj) OBJECT_GET_CLASS(CPUClass, (obj), TYPE_CPU)
66
b35399bb
SS
67typedef enum MMUAccessType {
68 MMU_DATA_LOAD = 0,
69 MMU_DATA_STORE = 1,
70 MMU_INST_FETCH = 2
71} MMUAccessType;
72
568496c0 73typedef struct CPUWatchpoint CPUWatchpoint;
dd83b06a 74
c658b94f
AF
75typedef void (*CPUUnassignedAccess)(CPUState *cpu, hwaddr addr,
76 bool is_write, bool is_exec, int opaque,
77 unsigned size);
78
bdf7ae5b
AF
79struct TranslationBlock;
80
dd83b06a
AF
81/**
82 * CPUClass:
2b8c2754
AF
83 * @class_by_name: Callback to map -cpu command line model name to an
84 * instantiatable CPU type.
94a444b2 85 * @parse_features: Callback to parse command line arguments.
f5df5baf 86 * @reset: Callback to reset the #CPUState to its initial state.
91b1df8c 87 * @reset_dump_flags: #CPUDumpFlags to use for reset logging.
8c2e1b00 88 * @has_work: Callback for checking if there is work to do.
97a8ea5a 89 * @do_interrupt: Callback for interrupt handling.
c658b94f 90 * @do_unassigned_access: Callback for unassigned access handling.
0dff0939 91 * (this is deprecated: new targets should use do_transaction_failed instead)
93e22326
PB
92 * @do_unaligned_access: Callback for unaligned access handling, if
93 * the target defines #ALIGNED_ONLY.
0dff0939
PM
94 * @do_transaction_failed: Callback for handling failed memory transactions
95 * (ie bus faults or external aborts; not MMU faults)
c08295d4
PM
96 * @virtio_is_big_endian: Callback to return %true if a CPU which supports
97 * runtime configurable endianness is currently big-endian. Non-configurable
98 * CPUs can use the default implementation of this method. This method should
99 * not be used by any callers other than the pre-1.0 virtio devices.
f3659eee 100 * @memory_rw_debug: Callback for GDB memory access.
878096ee
AF
101 * @dump_state: Callback for dumping state.
102 * @dump_statistics: Callback for dumping statistics.
997395d3 103 * @get_arch_id: Callback for getting architecture-dependent CPU ID.
444d5590 104 * @get_paging_enabled: Callback for inquiring whether paging is enabled.
a23bbfda 105 * @get_memory_mapping: Callback for obtaining the memory mappings.
42f6ed91
JS
106 * @set_pc: Callback for setting the Program Counter register. This
107 * should have the semantics used by the target architecture when
108 * setting the PC from a source such as an ELF file entry point;
109 * for example on Arm it will also set the Thumb mode bit based
110 * on the least significant bit of the new PC value.
111 * If the target behaviour here is anything other than "set
112 * the PC register to the value passed in" then the target must
113 * also implement the synchronize_from_tb hook.
bdf7ae5b 114 * @synchronize_from_tb: Callback for synchronizing state from a TCG
42f6ed91
JS
115 * #TranslationBlock. This is called when we abandon execution
116 * of a TB before starting it, and must set all parts of the CPU
117 * state which the previous TB in the chain may not have updated.
118 * This always includes at least the program counter; some targets
119 * will need to do more. If this hook is not implemented then the
120 * default is to call @set_pc(tb->pc).
7510454e 121 * @handle_mmu_fault: Callback for handling an MMU fault.
00b941e5 122 * @get_phys_page_debug: Callback for obtaining a physical address.
1dc6fb1f
PM
123 * @get_phys_page_attrs_debug: Callback for obtaining a physical address and the
124 * associated memory transaction attributes to use for the access.
125 * CPUs which use memory transaction attributes should implement this
126 * instead of get_phys_page_debug.
d7f25a9e
PM
127 * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
128 * a memory access with the specified memory transaction attributes.
5b50e790
AF
129 * @gdb_read_register: Callback for letting GDB read a register.
130 * @gdb_write_register: Callback for letting GDB write a register.
568496c0
SF
131 * @debug_check_watchpoint: Callback: return true if the architectural
132 * watchpoint whose address has matched should really fire.
86025ee4 133 * @debug_excp_handler: Callback for handling debug exceptions.
c08295d4
PM
134 * @write_elf64_note: Callback for writing a CPU-specific ELF note to a
135 * 64-bit VM coredump.
136 * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
137 * note to a 32-bit VM coredump.
138 * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
139 * 32-bit VM coredump.
140 * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
141 * note to a 32-bit VM coredump.
b170fce3 142 * @vmsd: State description for migration.
a0e372f0 143 * @gdb_num_core_regs: Number of core registers accessible to GDB.
5b24c641 144 * @gdb_core_xml_file: File name for core registers GDB XML description.
2472b6c0
PM
145 * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
146 * before the insn which triggers a watchpoint rather than after it.
b3820e6c
DH
147 * @gdb_arch_name: Optional callback that returns the architecture name known
148 * to GDB. The caller must free the returned string with g_free.
200bf5b7
AB
149 * @gdb_get_dynamic_xml: Callback to return dynamically generated XML for the
150 * gdb stub. Returns a pointer to the XML contents for the specified XML file
151 * or NULL if the CPU doesn't have a dynamically generated content for it.
cffe7b32
RH
152 * @cpu_exec_enter: Callback for cpu_exec preparation.
153 * @cpu_exec_exit: Callback for cpu_exec cleanup.
9585db68 154 * @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec.
37b9de46 155 * @disas_set_info: Setup architecture specific components of disassembly info
40612000
JB
156 * @adjust_watchpoint_address: Perform a target-specific adjustment to an
157 * address before attempting to match it against watchpoints.
dd83b06a
AF
158 *
159 * Represents a CPU family or model.
160 */
161typedef struct CPUClass {
162 /*< private >*/
961f8395 163 DeviceClass parent_class;
dd83b06a
AF
164 /*< public >*/
165
2b8c2754 166 ObjectClass *(*class_by_name)(const char *cpu_model);
62a48a2a 167 void (*parse_features)(const char *typename, char *str, Error **errp);
2b8c2754 168
dd83b06a 169 void (*reset)(CPUState *cpu);
91b1df8c 170 int reset_dump_flags;
8c2e1b00 171 bool (*has_work)(CPUState *cpu);
97a8ea5a 172 void (*do_interrupt)(CPUState *cpu);
c658b94f 173 CPUUnassignedAccess do_unassigned_access;
93e22326 174 void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
b35399bb
SS
175 MMUAccessType access_type,
176 int mmu_idx, uintptr_t retaddr);
0dff0939
PM
177 void (*do_transaction_failed)(CPUState *cpu, hwaddr physaddr, vaddr addr,
178 unsigned size, MMUAccessType access_type,
179 int mmu_idx, MemTxAttrs attrs,
180 MemTxResult response, uintptr_t retaddr);
bf7663c4 181 bool (*virtio_is_big_endian)(CPUState *cpu);
f3659eee
AF
182 int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
183 uint8_t *buf, int len, bool is_write);
878096ee
AF
184 void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
185 int flags);
c86f106b 186 GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
11cb6c15 187 void (*dump_statistics)(CPUState *cpu, int flags);
997395d3 188 int64_t (*get_arch_id)(CPUState *cpu);
444d5590 189 bool (*get_paging_enabled)(const CPUState *cpu);
a23bbfda
AF
190 void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
191 Error **errp);
f45748f1 192 void (*set_pc)(CPUState *cpu, vaddr value);
bdf7ae5b 193 void (*synchronize_from_tb)(CPUState *cpu, struct TranslationBlock *tb);
98670d47 194 int (*handle_mmu_fault)(CPUState *cpu, vaddr address, int size, int rw,
7510454e 195 int mmu_index);
00b941e5 196 hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
1dc6fb1f
PM
197 hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
198 MemTxAttrs *attrs);
d7f25a9e 199 int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
5b50e790
AF
200 int (*gdb_read_register)(CPUState *cpu, uint8_t *buf, int reg);
201 int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
568496c0 202 bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
86025ee4 203 void (*debug_excp_handler)(CPUState *cpu);
b170fce3 204
c72bf468
JF
205 int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
206 int cpuid, void *opaque);
207 int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
208 void *opaque);
209 int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
210 int cpuid, void *opaque);
211 int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
212 void *opaque);
a0e372f0
AF
213
214 const struct VMStateDescription *vmsd;
5b24c641 215 const char *gdb_core_xml_file;
b3820e6c 216 gchar * (*gdb_arch_name)(CPUState *cpu);
200bf5b7 217 const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
cffe7b32
RH
218 void (*cpu_exec_enter)(CPUState *cpu);
219 void (*cpu_exec_exit)(CPUState *cpu);
9585db68 220 bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
37b9de46
PC
221
222 void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
40612000 223 vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
55c3ceef
RH
224 void (*tcg_initialize)(void);
225
226 /* Keep non-pointer data at the end to minimize holes. */
227 int gdb_num_core_regs;
228 bool gdb_stop_before_watchpoint;
dd83b06a
AF
229} CPUClass;
230
28ecfd7a
AF
231#ifdef HOST_WORDS_BIGENDIAN
232typedef struct icount_decr_u16 {
233 uint16_t high;
234 uint16_t low;
235} icount_decr_u16;
236#else
237typedef struct icount_decr_u16 {
238 uint16_t low;
239 uint16_t high;
240} icount_decr_u16;
241#endif
242
f0c3c505
AF
243typedef struct CPUBreakpoint {
244 vaddr pc;
245 int flags; /* BP_* */
246 QTAILQ_ENTRY(CPUBreakpoint) entry;
247} CPUBreakpoint;
248
568496c0 249struct CPUWatchpoint {
ff4700b0 250 vaddr vaddr;
05068c0d 251 vaddr len;
08225676 252 vaddr hitaddr;
66b9b43c 253 MemTxAttrs hitattrs;
ff4700b0
AF
254 int flags; /* BP_* */
255 QTAILQ_ENTRY(CPUWatchpoint) entry;
568496c0 256};
ff4700b0 257
a60f24b5 258struct KVMState;
f7575c96 259struct kvm_run;
a60f24b5 260
b0cb0a66
VP
261struct hax_vcpu_state;
262
8cd70437
AF
263#define TB_JMP_CACHE_BITS 12
264#define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
265
4b4629d9 266/* work queue */
14e6fe12
PB
267
268/* The union type allows passing of 64 bit target pointers on 32 bit
269 * hosts in a single parameter
270 */
271typedef union {
272 int host_int;
273 unsigned long host_ulong;
274 void *host_ptr;
275 vaddr target_ptr;
276} run_on_cpu_data;
277
278#define RUN_ON_CPU_HOST_PTR(p) ((run_on_cpu_data){.host_ptr = (p)})
279#define RUN_ON_CPU_HOST_INT(i) ((run_on_cpu_data){.host_int = (i)})
280#define RUN_ON_CPU_HOST_ULONG(ul) ((run_on_cpu_data){.host_ulong = (ul)})
281#define RUN_ON_CPU_TARGET_PTR(v) ((run_on_cpu_data){.target_ptr = (v)})
282#define RUN_ON_CPU_NULL RUN_ON_CPU_HOST_PTR(NULL)
283
284typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_cpu_data data);
285
d148d90e 286struct qemu_work_item;
4b4629d9 287
0b8497f0 288#define CPU_UNSET_NUMA_NODE_ID -1
d01c05c9 289#define CPU_TRACE_DSTATE_MAX_EVENTS 32
0b8497f0 290
dd83b06a
AF
291/**
292 * CPUState:
55e5c285 293 * @cpu_index: CPU index (informative).
7ea7b9ad
PM
294 * @cluster_index: Identifies which cluster this CPU is in.
295 * For boards which don't define clusters or for "loose" CPUs not assigned
296 * to a cluster this will be UNASSIGNED_CLUSTER_INDEX; otherwise it will
297 * be the same as the cluster-id property of the CPU object's TYPE_CPU_CLUSTER
298 * QOM parent.
ce3960eb
AF
299 * @nr_cores: Number of cores within this CPU package.
300 * @nr_threads: Number of threads within this CPU.
c265e976
PB
301 * @running: #true if CPU is currently running (lockless).
302 * @has_waiter: #true if a CPU is currently waiting for the cpu_exec_end;
ab129972 303 * valid under cpu_list_lock.
61a46217 304 * @created: Indicates whether the CPU thread has been successfully created.
259186a7
AF
305 * @interrupt_request: Indicates a pending interrupt request.
306 * @halted: Nonzero if the CPU is in suspended state.
4fdeee7c 307 * @stop: Indicates a pending stop request.
f324e766 308 * @stopped: Indicates the CPU has been artificially stopped.
4c055ab5 309 * @unplug: Indicates a pending CPU unplug request.
bac05aa9 310 * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU
ed2803da 311 * @singlestep_enabled: Flags for single-stepping.
efee7340 312 * @icount_extra: Instructions until next timer event.
1aab16c2
PB
313 * @icount_decr: Low 16 bits: number of cycles left, only used in icount mode.
314 * High 16 bits: Set to -1 to force TCG to stop executing linked TBs for this
315 * CPU and return to its top level loop (even in non-icount mode).
28ecfd7a
AF
316 * This allows a single read-compare-cbranch-write sequence to test
317 * for both decrementer underflow and exceptions.
414b15c9
PB
318 * @can_do_io: Nonzero if memory-mapped IO is safe. Deterministic execution
319 * requires that IO only be performed on the last instruction of a TB
320 * so that interrupts take effect immediately.
32857f4d
PM
321 * @cpu_ases: Pointer to array of CPUAddressSpaces (which define the
322 * AddressSpaces this CPU has)
12ebc9a7 323 * @num_ases: number of CPUAddressSpaces in @cpu_ases
32857f4d
PM
324 * @as: Pointer to the first AddressSpace, for the convenience of targets which
325 * only have a single AddressSpace
c05efcb1 326 * @env_ptr: Pointer to subclass-specific CPUArchState field.
eac8b355 327 * @gdb_regs: Additional GDB registers.
a0e372f0 328 * @gdb_num_regs: Number of total registers accessible to GDB.
35143f01 329 * @gdb_num_g_regs: Number of registers in GDB 'g' packets.
182735ef 330 * @next_cpu: Next CPU sharing TB cache.
0429a971 331 * @opaque: User data.
93afeade
AF
332 * @mem_io_pc: Host Program Counter at which the memory was accessed.
333 * @mem_io_vaddr: Target virtual address at which the memory was accessed.
8737c51c 334 * @kvm_fd: vCPU file descriptor for KVM.
376692b9
PB
335 * @work_mutex: Lock to prevent multiple access to queued_work_*.
336 * @queued_work_first: First asynchronous work pending.
d4381116
LV
337 * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes
338 * to @trace_dstate).
48151859 339 * @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask).
ed860129
PM
340 * @ignore_memory_transaction_failures: Cached copy of the MachineState
341 * flag of the same name: allows the board to suppress calling of the
342 * CPU do_transaction_failed hook function.
dd83b06a
AF
343 *
344 * State of one CPU core or thread.
345 */
346struct CPUState {
347 /*< private >*/
961f8395 348 DeviceState parent_obj;
dd83b06a
AF
349 /*< public >*/
350
ce3960eb
AF
351 int nr_cores;
352 int nr_threads;
353
814e612e 354 struct QemuThread *thread;
bcba2a72
AF
355#ifdef _WIN32
356 HANDLE hThread;
357#endif
9f09e18a 358 int thread_id;
c265e976 359 bool running, has_waiter;
f5c121b8 360 struct QemuCond *halt_cond;
216fc9a4 361 bool thread_kicked;
61a46217 362 bool created;
4fdeee7c 363 bool stop;
f324e766 364 bool stopped;
4c055ab5 365 bool unplug;
bac05aa9 366 bool crash_occurred;
e0c38211 367 bool exit_request;
9b990ee5 368 uint32_t cflags_next_tb;
8d04fb55 369 /* updates protected by BQL */
259186a7 370 uint32_t interrupt_request;
ed2803da 371 int singlestep_enabled;
e4cd9657 372 int64_t icount_budget;
efee7340 373 int64_t icount_extra;
6f03bef0 374 sigjmp_buf jmp_env;
bcba2a72 375
376692b9
PB
376 QemuMutex work_mutex;
377 struct qemu_work_item *queued_work_first, *queued_work_last;
378
32857f4d 379 CPUAddressSpace *cpu_ases;
12ebc9a7 380 int num_ases;
09daed84 381 AddressSpace *as;
6731d864 382 MemoryRegion *memory;
09daed84 383
c05efcb1 384 void *env_ptr; /* CPUArchState */
7d7500d9 385
f3ced3c5 386 /* Accessed in parallel; all accesses must be atomic */
8cd70437 387 struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE];
7d7500d9 388
eac8b355 389 struct GDBRegisterState *gdb_regs;
a0e372f0 390 int gdb_num_regs;
35143f01 391 int gdb_num_g_regs;
bdc44640 392 QTAILQ_ENTRY(CPUState) node;
d77953b9 393
f0c3c505 394 /* ice debug support */
b58deb34 395 QTAILQ_HEAD(, CPUBreakpoint) breakpoints;
f0c3c505 396
b58deb34 397 QTAILQ_HEAD(, CPUWatchpoint) watchpoints;
ff4700b0
AF
398 CPUWatchpoint *watchpoint_hit;
399
0429a971
AF
400 void *opaque;
401
93afeade
AF
402 /* In order to avoid passing too many arguments to the MMIO helpers,
403 * we store some rarely used information in the CPU context.
404 */
405 uintptr_t mem_io_pc;
406 vaddr mem_io_vaddr;
dbea78a4
PM
407 /*
408 * This is only needed for the legacy cpu_unassigned_access() hook;
409 * when all targets using it have been converted to use
410 * cpu_transaction_failed() instead it can be removed.
411 */
412 MMUAccessType mem_io_access_type;
93afeade 413
8737c51c 414 int kvm_fd;
a60f24b5 415 struct KVMState *kvm_state;
f7575c96 416 struct kvm_run *kvm_run;
8737c51c 417
d01c05c9 418 /* Used for events with 'vcpu' and *without* the 'disabled' properties */
d4381116 419 DECLARE_BITMAP(trace_dstate_delayed, CPU_TRACE_DSTATE_MAX_EVENTS);
d01c05c9 420 DECLARE_BITMAP(trace_dstate, CPU_TRACE_DSTATE_MAX_EVENTS);
48151859 421
f5df5baf 422 /* TODO Move common fields from CPUArchState here. */
6fda014e 423 int cpu_index;
7ea7b9ad 424 int cluster_index;
6fda014e 425 uint32_t halted;
99df7dce 426 uint32_t can_do_io;
6fda014e 427 int32_t exception_index;
7e4fb26d 428
99f31832
SAGDR
429 /* shared by kvm, hax and hvf */
430 bool vcpu_dirty;
431
2adcc85d
JH
432 /* Used to keep track of an outstanding cpu throttle thread for migration
433 * autoconverge
434 */
435 bool throttle_thread_scheduled;
436
ed860129
PM
437 bool ignore_memory_transaction_failures;
438
7e4fb26d
RH
439 /* Note that this is accessed at the start of every TB via a negative
440 offset from AREG0. Leave this field at the end so as to make the
441 (absolute value) offset as small as possible. This reduces code
442 size, especially for hosts without large memory offsets. */
1aab16c2
PB
443 union {
444 uint32_t u32;
445 icount_decr_u16 u16;
446 } icount_decr;
b0cb0a66 447
b0cb0a66 448 struct hax_vcpu_state *hax_vcpu;
e3b9ca81 449
c97d6d2c 450 int hvf_fd;
1f871c5e
PM
451
452 /* track IOMMUs whose translations we've cached in the TCG TLB */
453 GArray *iommu_notifiers;
dd83b06a
AF
454};
455
f481ee2d
PB
456typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ;
457extern CPUTailQ cpus;
458
068a5ea0
EC
459#define first_cpu QTAILQ_FIRST_RCU(&cpus)
460#define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node)
461#define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus, node)
bdc44640 462#define CPU_FOREACH_SAFE(cpu, next_cpu) \
068a5ea0 463 QTAILQ_FOREACH_SAFE_RCU(cpu, &cpus, node, next_cpu)
182735ef 464
f240eb6f 465extern __thread CPUState *current_cpu;
4917cf44 466
f3ced3c5
EC
467static inline void cpu_tb_jmp_cache_clear(CPUState *cpu)
468{
469 unsigned int i;
470
471 for (i = 0; i < TB_JMP_CACHE_SIZE; i++) {
472 atomic_set(&cpu->tb_jmp_cache[i], NULL);
473 }
474}
475
8d4e9146
FK
476/**
477 * qemu_tcg_mttcg_enabled:
478 * Check whether we are running MultiThread TCG or not.
479 *
480 * Returns: %true if we are in MTTCG mode %false otherwise.
481 */
482extern bool mttcg_enabled;
483#define qemu_tcg_mttcg_enabled() (mttcg_enabled)
484
444d5590
AF
485/**
486 * cpu_paging_enabled:
487 * @cpu: The CPU whose state is to be inspected.
488 *
489 * Returns: %true if paging is enabled, %false otherwise.
490 */
491bool cpu_paging_enabled(const CPUState *cpu);
492
a23bbfda
AF
493/**
494 * cpu_get_memory_mapping:
495 * @cpu: The CPU whose memory mappings are to be obtained.
496 * @list: Where to write the memory mappings to.
497 * @errp: Pointer for reporting an #Error.
498 */
499void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
500 Error **errp);
501
c72bf468
JF
502/**
503 * cpu_write_elf64_note:
504 * @f: pointer to a function that writes memory to a file
505 * @cpu: The CPU whose memory is to be dumped
506 * @cpuid: ID number of the CPU
507 * @opaque: pointer to the CPUState struct
508 */
509int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
510 int cpuid, void *opaque);
511
512/**
513 * cpu_write_elf64_qemunote:
514 * @f: pointer to a function that writes memory to a file
515 * @cpu: The CPU whose memory is to be dumped
516 * @cpuid: ID number of the CPU
517 * @opaque: pointer to the CPUState struct
518 */
519int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
520 void *opaque);
521
522/**
523 * cpu_write_elf32_note:
524 * @f: pointer to a function that writes memory to a file
525 * @cpu: The CPU whose memory is to be dumped
526 * @cpuid: ID number of the CPU
527 * @opaque: pointer to the CPUState struct
528 */
529int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
530 int cpuid, void *opaque);
531
532/**
533 * cpu_write_elf32_qemunote:
534 * @f: pointer to a function that writes memory to a file
535 * @cpu: The CPU whose memory is to be dumped
536 * @cpuid: ID number of the CPU
537 * @opaque: pointer to the CPUState struct
538 */
539int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
540 void *opaque);
dd83b06a 541
c86f106b
AN
542/**
543 * cpu_get_crash_info:
544 * @cpu: The CPU to get crash information for
545 *
546 * Gets the previously saved crash information.
547 * Caller is responsible for freeing the data.
548 */
549GuestPanicInformation *cpu_get_crash_info(CPUState *cpu);
550
878096ee
AF
551/**
552 * CPUDumpFlags:
553 * @CPU_DUMP_CODE:
554 * @CPU_DUMP_FPU: dump FPU register state, not just integer
555 * @CPU_DUMP_CCOP: dump info about TCG QEMU's condition code optimization state
556 */
557enum CPUDumpFlags {
558 CPU_DUMP_CODE = 0x00010000,
559 CPU_DUMP_FPU = 0x00020000,
560 CPU_DUMP_CCOP = 0x00040000,
561};
562
563/**
564 * cpu_dump_state:
565 * @cpu: The CPU whose state is to be dumped.
566 * @f: File to dump to.
567 * @cpu_fprintf: Function to dump with.
568 * @flags: Flags what to dump.
569 *
570 * Dumps CPU state.
571 */
572void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
573 int flags);
574
575/**
576 * cpu_dump_statistics:
577 * @cpu: The CPU whose state is to be dumped.
878096ee
AF
578 * @flags: Flags what to dump.
579 *
11cb6c15
MA
580 * Dump CPU statistics to the current monitor if we have one, else to
581 * stdout.
878096ee 582 */
11cb6c15 583void cpu_dump_statistics(CPUState *cpu, int flags);
878096ee 584
00b941e5 585#ifndef CONFIG_USER_ONLY
1dc6fb1f
PM
586/**
587 * cpu_get_phys_page_attrs_debug:
588 * @cpu: The CPU to obtain the physical page address for.
589 * @addr: The virtual address.
590 * @attrs: Updated on return with the memory transaction attributes to use
591 * for this access.
592 *
593 * Obtains the physical page corresponding to a virtual one, together
594 * with the corresponding memory transaction attributes to use for the access.
595 * Use it only for debugging because no protection checks are done.
596 *
597 * Returns: Corresponding physical page address or -1 if no page found.
598 */
599static inline hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
600 MemTxAttrs *attrs)
601{
602 CPUClass *cc = CPU_GET_CLASS(cpu);
603
604 if (cc->get_phys_page_attrs_debug) {
605 return cc->get_phys_page_attrs_debug(cpu, addr, attrs);
606 }
607 /* Fallback for CPUs which don't implement the _attrs_ hook */
608 *attrs = MEMTXATTRS_UNSPECIFIED;
609 return cc->get_phys_page_debug(cpu, addr);
610}
611
00b941e5
AF
612/**
613 * cpu_get_phys_page_debug:
614 * @cpu: The CPU to obtain the physical page address for.
615 * @addr: The virtual address.
616 *
617 * Obtains the physical page corresponding to a virtual one.
618 * Use it only for debugging because no protection checks are done.
619 *
620 * Returns: Corresponding physical page address or -1 if no page found.
621 */
622static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr)
623{
1dc6fb1f 624 MemTxAttrs attrs = {};
00b941e5 625
1dc6fb1f 626 return cpu_get_phys_page_attrs_debug(cpu, addr, &attrs);
00b941e5 627}
d7f25a9e
PM
628
629/** cpu_asidx_from_attrs:
630 * @cpu: CPU
631 * @attrs: memory transaction attributes
632 *
633 * Returns the address space index specifying the CPU AddressSpace
634 * to use for a memory access with the given transaction attributes.
635 */
636static inline int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs)
637{
638 CPUClass *cc = CPU_GET_CLASS(cpu);
9c8c334b 639 int ret = 0;
d7f25a9e
PM
640
641 if (cc->asidx_from_attrs) {
9c8c334b
RH
642 ret = cc->asidx_from_attrs(cpu, attrs);
643 assert(ret < cpu->num_ases && ret >= 0);
d7f25a9e 644 }
9c8c334b 645 return ret;
d7f25a9e 646}
00b941e5
AF
647#endif
648
267f685b
PB
649/**
650 * cpu_list_add:
651 * @cpu: The CPU to be added to the list of CPUs.
652 */
653void cpu_list_add(CPUState *cpu);
654
655/**
656 * cpu_list_remove:
657 * @cpu: The CPU to be removed from the list of CPUs.
658 */
659void cpu_list_remove(CPUState *cpu);
660
dd83b06a
AF
661/**
662 * cpu_reset:
663 * @cpu: The CPU whose state is to be reset.
664 */
665void cpu_reset(CPUState *cpu);
666
2b8c2754
AF
667/**
668 * cpu_class_by_name:
669 * @typename: The CPU base type.
670 * @cpu_model: The model string without any parameters.
671 *
672 * Looks up a CPU #ObjectClass matching name @cpu_model.
673 *
674 * Returns: A #CPUClass or %NULL if not matching class is found.
675 */
676ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model);
677
3c72234c
IM
678/**
679 * cpu_create:
680 * @typename: The CPU type.
681 *
682 * Instantiates a CPU and realizes the CPU.
683 *
684 * Returns: A #CPUState or %NULL if an error occurred.
685 */
686CPUState *cpu_create(const char *typename);
687
688/**
2278b939 689 * parse_cpu_model:
3c72234c
IM
690 * @cpu_model: The model string including optional parameters.
691 *
692 * processes optional parameters and registers them as global properties
693 *
4482e05c
IM
694 * Returns: type of CPU to create or prints error and terminates process
695 * if an error occurred.
3c72234c 696 */
2278b939 697const char *parse_cpu_model(const char *cpu_model);
9262685b 698
3993c6bd 699/**
8c2e1b00 700 * cpu_has_work:
3993c6bd
AF
701 * @cpu: The vCPU to check.
702 *
703 * Checks whether the CPU has work to do.
704 *
705 * Returns: %true if the CPU has work, %false otherwise.
706 */
8c2e1b00
AF
707static inline bool cpu_has_work(CPUState *cpu)
708{
709 CPUClass *cc = CPU_GET_CLASS(cpu);
710
711 g_assert(cc->has_work);
712 return cc->has_work(cpu);
713}
3993c6bd 714
60e82579
AF
715/**
716 * qemu_cpu_is_self:
717 * @cpu: The vCPU to check against.
718 *
719 * Checks whether the caller is executing on the vCPU thread.
720 *
721 * Returns: %true if called from @cpu's thread, %false otherwise.
722 */
723bool qemu_cpu_is_self(CPUState *cpu);
724
c08d7424
AF
725/**
726 * qemu_cpu_kick:
727 * @cpu: The vCPU to kick.
728 *
729 * Kicks @cpu's thread.
730 */
731void qemu_cpu_kick(CPUState *cpu);
732
2fa45344
AF
733/**
734 * cpu_is_stopped:
735 * @cpu: The CPU to check.
736 *
737 * Checks whether the CPU is stopped.
738 *
739 * Returns: %true if run state is not running or if artificially stopped;
740 * %false otherwise.
741 */
742bool cpu_is_stopped(CPUState *cpu);
743
d148d90e
SF
744/**
745 * do_run_on_cpu:
746 * @cpu: The vCPU to run on.
747 * @func: The function to be executed.
748 * @data: Data to pass to the function.
749 * @mutex: Mutex to release while waiting for @func to run.
750 *
751 * Used internally in the implementation of run_on_cpu.
752 */
14e6fe12 753void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data,
d148d90e
SF
754 QemuMutex *mutex);
755
f100f0b3
AF
756/**
757 * run_on_cpu:
758 * @cpu: The vCPU to run on.
759 * @func: The function to be executed.
760 * @data: Data to pass to the function.
761 *
762 * Schedules the function @func for execution on the vCPU @cpu.
763 */
14e6fe12 764void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
f100f0b3 765
3c02270d
CV
766/**
767 * async_run_on_cpu:
768 * @cpu: The vCPU to run on.
769 * @func: The function to be executed.
770 * @data: Data to pass to the function.
771 *
772 * Schedules the function @func for execution on the vCPU @cpu asynchronously.
773 */
14e6fe12 774void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
3c02270d 775
53f5ed95
PB
776/**
777 * async_safe_run_on_cpu:
778 * @cpu: The vCPU to run on.
779 * @func: The function to be executed.
780 * @data: Data to pass to the function.
781 *
782 * Schedules the function @func for execution on the vCPU @cpu asynchronously,
783 * while all other vCPUs are sleeping.
784 *
785 * Unlike run_on_cpu and async_run_on_cpu, the function is run outside the
786 * BQL.
787 */
14e6fe12 788void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
53f5ed95 789
38d8f5c8
AF
790/**
791 * qemu_get_cpu:
792 * @index: The CPUState@cpu_index value of the CPU to obtain.
793 *
794 * Gets a CPU matching @index.
795 *
796 * Returns: The CPU or %NULL if there is no matching CPU.
797 */
798CPUState *qemu_get_cpu(int index);
799
69e5ff06
IM
800/**
801 * cpu_exists:
802 * @id: Guest-exposed CPU ID to lookup.
803 *
804 * Search for CPU with specified ID.
805 *
806 * Returns: %true - CPU is found, %false - CPU isn't found.
807 */
808bool cpu_exists(int64_t id);
809
5ce46cb3
EH
810/**
811 * cpu_by_arch_id:
812 * @id: Guest-exposed CPU ID of the CPU to obtain.
813 *
814 * Get a CPU with matching @id.
815 *
816 * Returns: The CPU or %NULL if there is no matching CPU.
817 */
818CPUState *cpu_by_arch_id(int64_t id);
819
2adcc85d
JH
820/**
821 * cpu_throttle_set:
822 * @new_throttle_pct: Percent of sleep time. Valid range is 1 to 99.
823 *
824 * Throttles all vcpus by forcing them to sleep for the given percentage of
825 * time. A throttle_percentage of 25 corresponds to a 75% duty cycle roughly.
826 * (example: 10ms sleep for every 30ms awake).
827 *
828 * cpu_throttle_set can be called as needed to adjust new_throttle_pct.
829 * Once the throttling starts, it will remain in effect until cpu_throttle_stop
830 * is called.
831 */
832void cpu_throttle_set(int new_throttle_pct);
833
834/**
835 * cpu_throttle_stop:
836 *
837 * Stops the vcpu throttling started by cpu_throttle_set.
838 */
839void cpu_throttle_stop(void);
840
841/**
842 * cpu_throttle_active:
843 *
844 * Returns: %true if the vcpus are currently being throttled, %false otherwise.
845 */
846bool cpu_throttle_active(void);
847
848/**
849 * cpu_throttle_get_percentage:
850 *
851 * Returns the vcpu throttle percentage. See cpu_throttle_set for details.
852 *
853 * Returns: The throttle percentage in range 1 to 99.
854 */
855int cpu_throttle_get_percentage(void);
856
c3affe56
AF
857#ifndef CONFIG_USER_ONLY
858
859typedef void (*CPUInterruptHandler)(CPUState *, int);
860
861extern CPUInterruptHandler cpu_interrupt_handler;
862
863/**
864 * cpu_interrupt:
865 * @cpu: The CPU to set an interrupt on.
7e63bc38 866 * @mask: The interrupts to set.
c3affe56
AF
867 *
868 * Invokes the interrupt handler.
869 */
870static inline void cpu_interrupt(CPUState *cpu, int mask)
871{
872 cpu_interrupt_handler(cpu, mask);
873}
874
875#else /* USER_ONLY */
876
877void cpu_interrupt(CPUState *cpu, int mask);
878
879#endif /* USER_ONLY */
880
47507383
TH
881#ifdef NEED_CPU_H
882
93e22326 883#ifdef CONFIG_SOFTMMU
c658b94f
AF
884static inline void cpu_unassigned_access(CPUState *cpu, hwaddr addr,
885 bool is_write, bool is_exec,
886 int opaque, unsigned size)
887{
888 CPUClass *cc = CPU_GET_CLASS(cpu);
889
890 if (cc->do_unassigned_access) {
891 cc->do_unassigned_access(cpu, addr, is_write, is_exec, opaque, size);
892 }
893}
894
93e22326 895static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr,
b35399bb
SS
896 MMUAccessType access_type,
897 int mmu_idx, uintptr_t retaddr)
93e22326
PB
898{
899 CPUClass *cc = CPU_GET_CLASS(cpu);
900
b35399bb 901 cc->do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr);
93e22326 902}
0dff0939
PM
903
904static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr,
905 vaddr addr, unsigned size,
906 MMUAccessType access_type,
907 int mmu_idx, MemTxAttrs attrs,
908 MemTxResult response,
909 uintptr_t retaddr)
910{
911 CPUClass *cc = CPU_GET_CLASS(cpu);
912
ed860129 913 if (!cpu->ignore_memory_transaction_failures && cc->do_transaction_failed) {
0dff0939
PM
914 cc->do_transaction_failed(cpu, physaddr, addr, size, access_type,
915 mmu_idx, attrs, response, retaddr);
916 }
917}
c658b94f
AF
918#endif
919
47507383
TH
920#endif /* NEED_CPU_H */
921
2991b890
PC
922/**
923 * cpu_set_pc:
924 * @cpu: The CPU to set the program counter for.
925 * @addr: Program counter value.
926 *
927 * Sets the program counter for a CPU.
928 */
929static inline void cpu_set_pc(CPUState *cpu, vaddr addr)
930{
931 CPUClass *cc = CPU_GET_CLASS(cpu);
932
933 cc->set_pc(cpu, addr);
934}
935
d8ed887b
AF
936/**
937 * cpu_reset_interrupt:
938 * @cpu: The CPU to clear the interrupt on.
939 * @mask: The interrupt mask to clear.
940 *
941 * Resets interrupts on the vCPU @cpu.
942 */
943void cpu_reset_interrupt(CPUState *cpu, int mask);
944
60a3e17a
AF
945/**
946 * cpu_exit:
947 * @cpu: The CPU to exit.
948 *
949 * Requests the CPU @cpu to exit execution.
950 */
951void cpu_exit(CPUState *cpu);
952
2993683b
IM
953/**
954 * cpu_resume:
955 * @cpu: The CPU to resume.
956 *
957 * Resumes CPU, i.e. puts CPU into runnable state.
958 */
959void cpu_resume(CPUState *cpu);
dd83b06a 960
4c055ab5
GZ
961/**
962 * cpu_remove:
963 * @cpu: The CPU to remove.
964 *
965 * Requests the CPU to be removed.
966 */
967void cpu_remove(CPUState *cpu);
968
2c579042
BR
969 /**
970 * cpu_remove_sync:
971 * @cpu: The CPU to remove.
972 *
973 * Requests the CPU to be removed and waits till it is removed.
974 */
975void cpu_remove_sync(CPUState *cpu);
976
d148d90e
SF
977/**
978 * process_queued_cpu_work() - process all items on CPU work queue
979 * @cpu: The CPU which work queue to process.
980 */
981void process_queued_cpu_work(CPUState *cpu);
982
ab129972
PB
983/**
984 * cpu_exec_start:
985 * @cpu: The CPU for the current thread.
986 *
987 * Record that a CPU has started execution and can be interrupted with
988 * cpu_exit.
989 */
990void cpu_exec_start(CPUState *cpu);
991
992/**
993 * cpu_exec_end:
994 * @cpu: The CPU for the current thread.
995 *
996 * Record that a CPU has stopped execution and exclusive sections
997 * can be executed without interrupting it.
998 */
999void cpu_exec_end(CPUState *cpu);
1000
1001/**
1002 * start_exclusive:
1003 *
1004 * Wait for a concurrent exclusive section to end, and then start
1005 * a section of work that is run while other CPUs are not running
1006 * between cpu_exec_start and cpu_exec_end. CPUs that are running
1007 * cpu_exec are exited immediately. CPUs that call cpu_exec_start
1008 * during the exclusive section go to sleep until this CPU calls
1009 * end_exclusive.
ab129972
PB
1010 */
1011void start_exclusive(void);
1012
1013/**
1014 * end_exclusive:
1015 *
1016 * Concludes an exclusive execution section started by start_exclusive.
ab129972
PB
1017 */
1018void end_exclusive(void);
1019
c643bed9
AF
1020/**
1021 * qemu_init_vcpu:
1022 * @cpu: The vCPU to initialize.
1023 *
1024 * Initializes a vCPU.
1025 */
1026void qemu_init_vcpu(CPUState *cpu);
1027
3825b28f
AF
1028#define SSTEP_ENABLE 0x1 /* Enable simulated HW single stepping */
1029#define SSTEP_NOIRQ 0x2 /* Do not use IRQ while single stepping */
1030#define SSTEP_NOTIMER 0x4 /* Do not Timers while single stepping */
1031
1032/**
1033 * cpu_single_step:
1034 * @cpu: CPU to the flags for.
1035 * @enabled: Flags to enable.
1036 *
1037 * Enables or disables single-stepping for @cpu.
1038 */
1039void cpu_single_step(CPUState *cpu, int enabled);
1040
b3310ab3
AF
1041/* Breakpoint/watchpoint flags */
1042#define BP_MEM_READ 0x01
1043#define BP_MEM_WRITE 0x02
1044#define BP_MEM_ACCESS (BP_MEM_READ | BP_MEM_WRITE)
1045#define BP_STOP_BEFORE_ACCESS 0x04
08225676 1046/* 0x08 currently unused */
b3310ab3
AF
1047#define BP_GDB 0x10
1048#define BP_CPU 0x20
b933066a 1049#define BP_ANY (BP_GDB | BP_CPU)
08225676
PM
1050#define BP_WATCHPOINT_HIT_READ 0x40
1051#define BP_WATCHPOINT_HIT_WRITE 0x80
1052#define BP_WATCHPOINT_HIT (BP_WATCHPOINT_HIT_READ | BP_WATCHPOINT_HIT_WRITE)
b3310ab3
AF
1053
1054int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
1055 CPUBreakpoint **breakpoint);
1056int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags);
1057void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint);
1058void cpu_breakpoint_remove_all(CPUState *cpu, int mask);
1059
b933066a
RH
1060/* Return true if PC matches an installed breakpoint. */
1061static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask)
1062{
1063 CPUBreakpoint *bp;
1064
1065 if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) {
1066 QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
1067 if (bp->pc == pc && (bp->flags & mask)) {
1068 return true;
1069 }
1070 }
1071 }
1072 return false;
1073}
1074
75a34036
AF
1075int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
1076 int flags, CPUWatchpoint **watchpoint);
1077int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
1078 vaddr len, int flags);
1079void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
1080void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
1081
63c91552
PB
1082/**
1083 * cpu_get_address_space:
1084 * @cpu: CPU to get address space from
1085 * @asidx: index identifying which address space to get
1086 *
1087 * Return the requested address space of this CPU. @asidx
1088 * specifies which address space to read.
1089 */
1090AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
1091
a47dddd7
AF
1092void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
1093 GCC_FMT_ATTR(2, 3);
c7e002c5 1094extern Property cpu_common_props[];
39e329e3 1095void cpu_exec_initfn(CPUState *cpu);
ce5b1bbf 1096void cpu_exec_realizefn(CPUState *cpu, Error **errp);
7bbc124e 1097void cpu_exec_unrealizefn(CPUState *cpu);
a47dddd7 1098
c95ac103
TH
1099/**
1100 * target_words_bigendian:
1101 * Returns true if the (default) endianness of the target is big endian,
1102 * false otherwise. Note that in target-specific code, you can use
1103 * TARGET_WORDS_BIGENDIAN directly instead. On the other hand, common
1104 * code should normally never need to know about the endianness of the
1105 * target, so please do *not* use this function unless you know very well
1106 * what you are doing!
1107 */
1108bool target_words_bigendian(void);
1109
47507383
TH
1110#ifdef NEED_CPU_H
1111
1a1562f5
AF
1112#ifdef CONFIG_SOFTMMU
1113extern const struct VMStateDescription vmstate_cpu_common;
1114#else
1115#define vmstate_cpu_common vmstate_dummy
1116#endif
1117
1118#define VMSTATE_CPU() { \
1119 .name = "parent_obj", \
1120 .size = sizeof(CPUState), \
1121 .vmsd = &vmstate_cpu_common, \
1122 .flags = VMS_STRUCT, \
1123 .offset = 0, \
1124}
1125
47507383
TH
1126#endif /* NEED_CPU_H */
1127
a07f953e 1128#define UNASSIGNED_CPU_INDEX -1
7ea7b9ad 1129#define UNASSIGNED_CLUSTER_INDEX -1
a07f953e 1130
dd83b06a 1131#endif
This page took 0.567277 seconds and 4 git commands to generate.