Use $(MAKE) for recursive make
[qemu/ar7.git] / include / qom / cpu.h
blob9dafb4817e0f2e16422f5e86c6a370f0d252eb9b
1 /*
2 * QEMU CPU model
4 * Copyright (c) 2012 SUSE LINUX Products GmbH
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.
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.
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>
20 #ifndef QEMU_CPU_H
21 #define QEMU_CPU_H
23 #include <signal.h>
24 #include <setjmp.h>
25 #include "hw/qdev-core.h"
26 #include "exec/hwaddr.h"
27 #include "qemu/queue.h"
28 #include "qemu/thread.h"
29 #include "qemu/tls.h"
30 #include "qemu/typedefs.h"
32 typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size,
33 void *opaque);
35 /**
36 * vaddr:
37 * Type wide enough to contain any #target_ulong virtual address.
39 typedef uint64_t vaddr;
40 #define VADDR_PRId PRId64
41 #define VADDR_PRIu PRIu64
42 #define VADDR_PRIo PRIo64
43 #define VADDR_PRIx PRIx64
44 #define VADDR_PRIX PRIX64
45 #define VADDR_MAX UINT64_MAX
47 /**
48 * SECTION:cpu
49 * @section_id: QEMU-cpu
50 * @title: CPU Class
51 * @short_description: Base class for all CPUs
54 #define TYPE_CPU "cpu"
56 /* Since this macro is used a lot in hot code paths and in conjunction with
57 * FooCPU *foo_env_get_cpu(), we deviate from usual QOM practice by using
58 * an unchecked cast.
60 #define CPU(obj) ((CPUState *)(obj))
62 #define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU)
63 #define CPU_GET_CLASS(obj) OBJECT_GET_CLASS(CPUClass, (obj), TYPE_CPU)
65 typedef struct CPUState CPUState;
67 typedef void (*CPUUnassignedAccess)(CPUState *cpu, hwaddr addr,
68 bool is_write, bool is_exec, int opaque,
69 unsigned size);
71 struct TranslationBlock;
73 /**
74 * CPUClass:
75 * @class_by_name: Callback to map -cpu command line model name to an
76 * instantiatable CPU type.
77 * @parse_features: Callback to parse command line arguments.
78 * @reset: Callback to reset the #CPUState to its initial state.
79 * @reset_dump_flags: #CPUDumpFlags to use for reset logging.
80 * @has_work: Callback for checking if there is work to do.
81 * @do_interrupt: Callback for interrupt handling.
82 * @do_unassigned_access: Callback for unassigned access handling.
83 * @do_unaligned_access: Callback for unaligned access handling, if
84 * the target defines #ALIGNED_ONLY.
85 * @virtio_is_big_endian: Callback to return %true if a CPU which supports
86 * runtime configurable endianness is currently big-endian. Non-configurable
87 * CPUs can use the default implementation of this method. This method should
88 * not be used by any callers other than the pre-1.0 virtio devices.
89 * @memory_rw_debug: Callback for GDB memory access.
90 * @dump_state: Callback for dumping state.
91 * @dump_statistics: Callback for dumping statistics.
92 * @get_arch_id: Callback for getting architecture-dependent CPU ID.
93 * @get_paging_enabled: Callback for inquiring whether paging is enabled.
94 * @get_memory_mapping: Callback for obtaining the memory mappings.
95 * @set_pc: Callback for setting the Program Counter register.
96 * @synchronize_from_tb: Callback for synchronizing state from a TCG
97 * #TranslationBlock.
98 * @handle_mmu_fault: Callback for handling an MMU fault.
99 * @get_phys_page_debug: Callback for obtaining a physical address.
100 * @gdb_read_register: Callback for letting GDB read a register.
101 * @gdb_write_register: Callback for letting GDB write a register.
102 * @debug_excp_handler: Callback for handling debug exceptions.
103 * @write_elf64_note: Callback for writing a CPU-specific ELF note to a
104 * 64-bit VM coredump.
105 * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
106 * note to a 32-bit VM coredump.
107 * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
108 * 32-bit VM coredump.
109 * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
110 * note to a 32-bit VM coredump.
111 * @vmsd: State description for migration.
112 * @gdb_num_core_regs: Number of core registers accessible to GDB.
113 * @gdb_core_xml_file: File name for core registers GDB XML description.
114 * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
115 * before the insn which triggers a watchpoint rather than after it.
116 * @cpu_exec_enter: Callback for cpu_exec preparation.
117 * @cpu_exec_exit: Callback for cpu_exec cleanup.
118 * @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec.
120 * Represents a CPU family or model.
122 typedef struct CPUClass {
123 /*< private >*/
124 DeviceClass parent_class;
125 /*< public >*/
127 ObjectClass *(*class_by_name)(const char *cpu_model);
128 void (*parse_features)(CPUState *cpu, char *str, Error **errp);
130 void (*reset)(CPUState *cpu);
131 int reset_dump_flags;
132 bool (*has_work)(CPUState *cpu);
133 void (*do_interrupt)(CPUState *cpu);
134 CPUUnassignedAccess do_unassigned_access;
135 void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
136 int is_write, int is_user, uintptr_t retaddr);
137 bool (*virtio_is_big_endian)(CPUState *cpu);
138 int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
139 uint8_t *buf, int len, bool is_write);
140 void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
141 int flags);
142 void (*dump_statistics)(CPUState *cpu, FILE *f,
143 fprintf_function cpu_fprintf, int flags);
144 int64_t (*get_arch_id)(CPUState *cpu);
145 bool (*get_paging_enabled)(const CPUState *cpu);
146 void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
147 Error **errp);
148 void (*set_pc)(CPUState *cpu, vaddr value);
149 void (*synchronize_from_tb)(CPUState *cpu, struct TranslationBlock *tb);
150 int (*handle_mmu_fault)(CPUState *cpu, vaddr address, int rw,
151 int mmu_index);
152 hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
153 int (*gdb_read_register)(CPUState *cpu, uint8_t *buf, int reg);
154 int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
155 void (*debug_excp_handler)(CPUState *cpu);
157 int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
158 int cpuid, void *opaque);
159 int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
160 void *opaque);
161 int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
162 int cpuid, void *opaque);
163 int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
164 void *opaque);
166 const struct VMStateDescription *vmsd;
167 int gdb_num_core_regs;
168 const char *gdb_core_xml_file;
169 bool gdb_stop_before_watchpoint;
171 void (*cpu_exec_enter)(CPUState *cpu);
172 void (*cpu_exec_exit)(CPUState *cpu);
173 bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
174 } CPUClass;
176 #ifdef HOST_WORDS_BIGENDIAN
177 typedef struct icount_decr_u16 {
178 uint16_t high;
179 uint16_t low;
180 } icount_decr_u16;
181 #else
182 typedef struct icount_decr_u16 {
183 uint16_t low;
184 uint16_t high;
185 } icount_decr_u16;
186 #endif
188 typedef struct CPUBreakpoint {
189 vaddr pc;
190 int flags; /* BP_* */
191 QTAILQ_ENTRY(CPUBreakpoint) entry;
192 } CPUBreakpoint;
194 typedef struct CPUWatchpoint {
195 vaddr vaddr;
196 vaddr len;
197 vaddr hitaddr;
198 int flags; /* BP_* */
199 QTAILQ_ENTRY(CPUWatchpoint) entry;
200 } CPUWatchpoint;
202 struct KVMState;
203 struct kvm_run;
205 #define TB_JMP_CACHE_BITS 12
206 #define TB_JMP_CACHE_SIZE (1 << TB_JMP_CACHE_BITS)
209 * CPUState:
210 * @cpu_index: CPU index (informative).
211 * @nr_cores: Number of cores within this CPU package.
212 * @nr_threads: Number of threads within this CPU.
213 * @numa_node: NUMA node this CPU is belonging to.
214 * @host_tid: Host thread ID.
215 * @running: #true if CPU is currently running (usermode).
216 * @created: Indicates whether the CPU thread has been successfully created.
217 * @interrupt_request: Indicates a pending interrupt request.
218 * @halted: Nonzero if the CPU is in suspended state.
219 * @stop: Indicates a pending stop request.
220 * @stopped: Indicates the CPU has been artificially stopped.
221 * @tcg_exit_req: Set to force TCG to stop executing linked TBs for this
222 * CPU and return to its top level loop.
223 * @singlestep_enabled: Flags for single-stepping.
224 * @icount_extra: Instructions until next timer event.
225 * @icount_decr: Number of cycles left, with interrupt flag in high bit.
226 * This allows a single read-compare-cbranch-write sequence to test
227 * for both decrementer underflow and exceptions.
228 * @can_do_io: Nonzero if memory-mapped IO is safe.
229 * @env_ptr: Pointer to subclass-specific CPUArchState field.
230 * @current_tb: Currently executing TB.
231 * @gdb_regs: Additional GDB registers.
232 * @gdb_num_regs: Number of total registers accessible to GDB.
233 * @gdb_num_g_regs: Number of registers in GDB 'g' packets.
234 * @next_cpu: Next CPU sharing TB cache.
235 * @opaque: User data.
236 * @mem_io_pc: Host Program Counter at which the memory was accessed.
237 * @mem_io_vaddr: Target virtual address at which the memory was accessed.
238 * @kvm_fd: vCPU file descriptor for KVM.
240 * State of one CPU core or thread.
242 struct CPUState {
243 /*< private >*/
244 DeviceState parent_obj;
245 /*< public >*/
247 int nr_cores;
248 int nr_threads;
249 int numa_node;
251 struct QemuThread *thread;
252 #ifdef _WIN32
253 HANDLE hThread;
254 #endif
255 int thread_id;
256 uint32_t host_tid;
257 bool running;
258 struct QemuCond *halt_cond;
259 struct qemu_work_item *queued_work_first, *queued_work_last;
260 bool thread_kicked;
261 bool created;
262 bool stop;
263 bool stopped;
264 volatile sig_atomic_t exit_request;
265 uint32_t interrupt_request;
266 int singlestep_enabled;
267 int64_t icount_extra;
268 sigjmp_buf jmp_env;
270 AddressSpace *as;
271 struct AddressSpaceDispatch *memory_dispatch;
272 MemoryListener *tcg_as_listener;
274 void *env_ptr; /* CPUArchState */
275 struct TranslationBlock *current_tb;
276 struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE];
277 struct GDBRegisterState *gdb_regs;
278 int gdb_num_regs;
279 int gdb_num_g_regs;
280 QTAILQ_ENTRY(CPUState) node;
282 /* ice debug support */
283 QTAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints;
285 QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints;
286 CPUWatchpoint *watchpoint_hit;
288 void *opaque;
290 /* In order to avoid passing too many arguments to the MMIO helpers,
291 * we store some rarely used information in the CPU context.
293 uintptr_t mem_io_pc;
294 vaddr mem_io_vaddr;
296 int kvm_fd;
297 bool kvm_vcpu_dirty;
298 struct KVMState *kvm_state;
299 struct kvm_run *kvm_run;
301 /* TODO Move common fields from CPUArchState here. */
302 int cpu_index; /* used by alpha TCG */
303 uint32_t halted; /* used by alpha, cris, ppc TCG */
304 union {
305 uint32_t u32;
306 icount_decr_u16 u16;
307 } icount_decr;
308 uint32_t can_do_io;
309 int32_t exception_index; /* used by m68k TCG */
311 /* Note that this is accessed at the start of every TB via a negative
312 offset from AREG0. Leave this field at the end so as to make the
313 (absolute value) offset as small as possible. This reduces code
314 size, especially for hosts without large memory offsets. */
315 volatile sig_atomic_t tcg_exit_req;
318 QTAILQ_HEAD(CPUTailQ, CPUState);
319 extern struct CPUTailQ cpus;
320 #define CPU_NEXT(cpu) QTAILQ_NEXT(cpu, node)
321 #define CPU_FOREACH(cpu) QTAILQ_FOREACH(cpu, &cpus, node)
322 #define CPU_FOREACH_SAFE(cpu, next_cpu) \
323 QTAILQ_FOREACH_SAFE(cpu, &cpus, node, next_cpu)
324 #define first_cpu QTAILQ_FIRST(&cpus)
326 DECLARE_TLS(CPUState *, current_cpu);
327 #define current_cpu tls_var(current_cpu)
330 * cpu_paging_enabled:
331 * @cpu: The CPU whose state is to be inspected.
333 * Returns: %true if paging is enabled, %false otherwise.
335 bool cpu_paging_enabled(const CPUState *cpu);
338 * cpu_get_memory_mapping:
339 * @cpu: The CPU whose memory mappings are to be obtained.
340 * @list: Where to write the memory mappings to.
341 * @errp: Pointer for reporting an #Error.
343 void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
344 Error **errp);
347 * cpu_write_elf64_note:
348 * @f: pointer to a function that writes memory to a file
349 * @cpu: The CPU whose memory is to be dumped
350 * @cpuid: ID number of the CPU
351 * @opaque: pointer to the CPUState struct
353 int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
354 int cpuid, void *opaque);
357 * cpu_write_elf64_qemunote:
358 * @f: pointer to a function that writes memory to a file
359 * @cpu: The CPU whose memory is to be dumped
360 * @cpuid: ID number of the CPU
361 * @opaque: pointer to the CPUState struct
363 int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
364 void *opaque);
367 * cpu_write_elf32_note:
368 * @f: pointer to a function that writes memory to a file
369 * @cpu: The CPU whose memory is to be dumped
370 * @cpuid: ID number of the CPU
371 * @opaque: pointer to the CPUState struct
373 int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
374 int cpuid, void *opaque);
377 * cpu_write_elf32_qemunote:
378 * @f: pointer to a function that writes memory to a file
379 * @cpu: The CPU whose memory is to be dumped
380 * @cpuid: ID number of the CPU
381 * @opaque: pointer to the CPUState struct
383 int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
384 void *opaque);
387 * CPUDumpFlags:
388 * @CPU_DUMP_CODE:
389 * @CPU_DUMP_FPU: dump FPU register state, not just integer
390 * @CPU_DUMP_CCOP: dump info about TCG QEMU's condition code optimization state
392 enum CPUDumpFlags {
393 CPU_DUMP_CODE = 0x00010000,
394 CPU_DUMP_FPU = 0x00020000,
395 CPU_DUMP_CCOP = 0x00040000,
399 * cpu_dump_state:
400 * @cpu: The CPU whose state is to be dumped.
401 * @f: File to dump to.
402 * @cpu_fprintf: Function to dump with.
403 * @flags: Flags what to dump.
405 * Dumps CPU state.
407 void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
408 int flags);
411 * cpu_dump_statistics:
412 * @cpu: The CPU whose state is to be dumped.
413 * @f: File to dump to.
414 * @cpu_fprintf: Function to dump with.
415 * @flags: Flags what to dump.
417 * Dumps CPU statistics.
419 void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
420 int flags);
422 #ifndef CONFIG_USER_ONLY
424 * cpu_get_phys_page_debug:
425 * @cpu: The CPU to obtain the physical page address for.
426 * @addr: The virtual address.
428 * Obtains the physical page corresponding to a virtual one.
429 * Use it only for debugging because no protection checks are done.
431 * Returns: Corresponding physical page address or -1 if no page found.
433 static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr)
435 CPUClass *cc = CPU_GET_CLASS(cpu);
437 return cc->get_phys_page_debug(cpu, addr);
439 #endif
442 * cpu_reset:
443 * @cpu: The CPU whose state is to be reset.
445 void cpu_reset(CPUState *cpu);
448 * cpu_class_by_name:
449 * @typename: The CPU base type.
450 * @cpu_model: The model string without any parameters.
452 * Looks up a CPU #ObjectClass matching name @cpu_model.
454 * Returns: A #CPUClass or %NULL if not matching class is found.
456 ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model);
459 * cpu_generic_init:
460 * @typename: The CPU base type.
461 * @cpu_model: The model string including optional parameters.
463 * Instantiates a CPU, processes optional parameters and realizes the CPU.
465 * Returns: A #CPUState or %NULL if an error occurred.
467 CPUState *cpu_generic_init(const char *typename, const char *cpu_model);
470 * cpu_has_work:
471 * @cpu: The vCPU to check.
473 * Checks whether the CPU has work to do.
475 * Returns: %true if the CPU has work, %false otherwise.
477 static inline bool cpu_has_work(CPUState *cpu)
479 CPUClass *cc = CPU_GET_CLASS(cpu);
481 g_assert(cc->has_work);
482 return cc->has_work(cpu);
486 * qemu_cpu_is_self:
487 * @cpu: The vCPU to check against.
489 * Checks whether the caller is executing on the vCPU thread.
491 * Returns: %true if called from @cpu's thread, %false otherwise.
493 bool qemu_cpu_is_self(CPUState *cpu);
496 * qemu_cpu_kick:
497 * @cpu: The vCPU to kick.
499 * Kicks @cpu's thread.
501 void qemu_cpu_kick(CPUState *cpu);
504 * cpu_is_stopped:
505 * @cpu: The CPU to check.
507 * Checks whether the CPU is stopped.
509 * Returns: %true if run state is not running or if artificially stopped;
510 * %false otherwise.
512 bool cpu_is_stopped(CPUState *cpu);
515 * run_on_cpu:
516 * @cpu: The vCPU to run on.
517 * @func: The function to be executed.
518 * @data: Data to pass to the function.
520 * Schedules the function @func for execution on the vCPU @cpu.
522 void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data);
525 * async_run_on_cpu:
526 * @cpu: The vCPU to run on.
527 * @func: The function to be executed.
528 * @data: Data to pass to the function.
530 * Schedules the function @func for execution on the vCPU @cpu asynchronously.
532 void async_run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data);
535 * qemu_get_cpu:
536 * @index: The CPUState@cpu_index value of the CPU to obtain.
538 * Gets a CPU matching @index.
540 * Returns: The CPU or %NULL if there is no matching CPU.
542 CPUState *qemu_get_cpu(int index);
545 * cpu_exists:
546 * @id: Guest-exposed CPU ID to lookup.
548 * Search for CPU with specified ID.
550 * Returns: %true - CPU is found, %false - CPU isn't found.
552 bool cpu_exists(int64_t id);
554 #ifndef CONFIG_USER_ONLY
556 typedef void (*CPUInterruptHandler)(CPUState *, int);
558 extern CPUInterruptHandler cpu_interrupt_handler;
561 * cpu_interrupt:
562 * @cpu: The CPU to set an interrupt on.
563 * @mask: The interupts to set.
565 * Invokes the interrupt handler.
567 static inline void cpu_interrupt(CPUState *cpu, int mask)
569 cpu_interrupt_handler(cpu, mask);
572 #else /* USER_ONLY */
574 void cpu_interrupt(CPUState *cpu, int mask);
576 #endif /* USER_ONLY */
578 #ifdef CONFIG_SOFTMMU
579 static inline void cpu_unassigned_access(CPUState *cpu, hwaddr addr,
580 bool is_write, bool is_exec,
581 int opaque, unsigned size)
583 CPUClass *cc = CPU_GET_CLASS(cpu);
585 if (cc->do_unassigned_access) {
586 cc->do_unassigned_access(cpu, addr, is_write, is_exec, opaque, size);
590 static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr,
591 int is_write, int is_user,
592 uintptr_t retaddr)
594 CPUClass *cc = CPU_GET_CLASS(cpu);
596 cc->do_unaligned_access(cpu, addr, is_write, is_user, retaddr);
598 #endif
601 * cpu_reset_interrupt:
602 * @cpu: The CPU to clear the interrupt on.
603 * @mask: The interrupt mask to clear.
605 * Resets interrupts on the vCPU @cpu.
607 void cpu_reset_interrupt(CPUState *cpu, int mask);
610 * cpu_exit:
611 * @cpu: The CPU to exit.
613 * Requests the CPU @cpu to exit execution.
615 void cpu_exit(CPUState *cpu);
618 * cpu_resume:
619 * @cpu: The CPU to resume.
621 * Resumes CPU, i.e. puts CPU into runnable state.
623 void cpu_resume(CPUState *cpu);
626 * qemu_init_vcpu:
627 * @cpu: The vCPU to initialize.
629 * Initializes a vCPU.
631 void qemu_init_vcpu(CPUState *cpu);
633 #define SSTEP_ENABLE 0x1 /* Enable simulated HW single stepping */
634 #define SSTEP_NOIRQ 0x2 /* Do not use IRQ while single stepping */
635 #define SSTEP_NOTIMER 0x4 /* Do not Timers while single stepping */
638 * cpu_single_step:
639 * @cpu: CPU to the flags for.
640 * @enabled: Flags to enable.
642 * Enables or disables single-stepping for @cpu.
644 void cpu_single_step(CPUState *cpu, int enabled);
646 /* Breakpoint/watchpoint flags */
647 #define BP_MEM_READ 0x01
648 #define BP_MEM_WRITE 0x02
649 #define BP_MEM_ACCESS (BP_MEM_READ | BP_MEM_WRITE)
650 #define BP_STOP_BEFORE_ACCESS 0x04
651 /* 0x08 currently unused */
652 #define BP_GDB 0x10
653 #define BP_CPU 0x20
654 #define BP_WATCHPOINT_HIT_READ 0x40
655 #define BP_WATCHPOINT_HIT_WRITE 0x80
656 #define BP_WATCHPOINT_HIT (BP_WATCHPOINT_HIT_READ | BP_WATCHPOINT_HIT_WRITE)
658 int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
659 CPUBreakpoint **breakpoint);
660 int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags);
661 void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint);
662 void cpu_breakpoint_remove_all(CPUState *cpu, int mask);
664 int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
665 int flags, CPUWatchpoint **watchpoint);
666 int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
667 vaddr len, int flags);
668 void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
669 void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
671 void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
672 GCC_FMT_ATTR(2, 3);
674 #ifdef CONFIG_SOFTMMU
675 extern const struct VMStateDescription vmstate_cpu_common;
676 #else
677 #define vmstate_cpu_common vmstate_dummy
678 #endif
680 #define VMSTATE_CPU() { \
681 .name = "parent_obj", \
682 .size = sizeof(CPUState), \
683 .vmsd = &vmstate_cpu_common, \
684 .flags = VMS_STRUCT, \
685 .offset = 0, \
688 #endif