diff options
author | Andreas Färber | 2013-05-27 01:33:50 +0200 |
---|---|---|
committer | Andreas Färber | 2013-06-28 13:25:12 +0200 |
commit | 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (patch) | |
tree | 1f2ad77025073e5d4b13de7a1df63772d7915ced /include | |
parent | cpus: Change qemu_kvm_init_cpu_signals() argument to CPUState (diff) | |
download | qemu-878096eeb278a8ac1ccd6667af73e026f29b4cf5.tar.gz qemu-878096eeb278a8ac1ccd6667af73e026f29b4cf5.tar.xz qemu-878096eeb278a8ac1ccd6667af73e026f29b4cf5.zip |
cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks
Make cpustats monitor command available unconditionally.
Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()
arguments to CPUState.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/exec/cpu-all.h | 10 | ||||
-rw-r--r-- | include/qemu/log.h | 2 | ||||
-rw-r--r-- | include/qom/cpu.h | 42 |
3 files changed, 43 insertions, 11 deletions
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index e1cc62ef5e..35bdf858f2 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -355,16 +355,6 @@ int page_check_range(target_ulong start, target_ulong len, int flags); CPUArchState *cpu_copy(CPUArchState *env); -#define CPU_DUMP_CODE 0x00010000 -#define CPU_DUMP_FPU 0x00020000 /* dump FPU register state, not just integer */ -/* dump info about TCG QEMU's condition code optimization state */ -#define CPU_DUMP_CCOP 0x00040000 - -void cpu_dump_state(CPUArchState *env, FILE *f, fprintf_function cpu_fprintf, - int flags); -void cpu_dump_statistics(CPUArchState *env, FILE *f, fprintf_function cpu_fprintf, - int flags); - void QEMU_NORETURN cpu_abort(CPUArchState *env, const char *fmt, ...) GCC_FMT_ATTR(2, 3); extern CPUArchState *first_cpu; diff --git a/include/qemu/log.h b/include/qemu/log.h index fd76f913eb..a9cf2146c5 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -75,7 +75,7 @@ void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...); static inline void log_cpu_state(CPUArchState *env1, int flags) { if (qemu_log_enabled()) { - cpu_dump_state(env1, qemu_logfile, fprintf, flags); + cpu_dump_state(ENV_GET_CPU(env1), qemu_logfile, fprintf, flags); } } diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 3494356d67..12b509920e 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -48,6 +48,8 @@ typedef struct CPUState CPUState; * instantiatable CPU type. * @reset: Callback to reset the #CPUState to its initial state. * @do_interrupt: Callback for interrupt handling. + * @dump_state: Callback for dumping state. + * @dump_statistics: Callback for dumping statistics. * @get_arch_id: Callback for getting architecture-dependent CPU ID. * @get_paging_enabled: Callback for inquiring whether paging is enabled. * @get_memory_mapping: Callback for obtaining the memory mappings. @@ -64,6 +66,10 @@ typedef struct CPUClass { void (*reset)(CPUState *cpu); void (*do_interrupt)(CPUState *cpu); + void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, + int flags); + void (*dump_statistics)(CPUState *cpu, FILE *f, + fprintf_function cpu_fprintf, int flags); int64_t (*get_arch_id)(CPUState *cpu); bool (*get_paging_enabled)(const CPUState *cpu); void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, @@ -201,6 +207,42 @@ int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, void *opaque); /** + * CPUDumpFlags: + * @CPU_DUMP_CODE: + * @CPU_DUMP_FPU: dump FPU register state, not just integer + * @CPU_DUMP_CCOP: dump info about TCG QEMU's condition code optimization state + */ +enum CPUDumpFlags { + CPU_DUMP_CODE = 0x00010000, + CPU_DUMP_FPU = 0x00020000, + CPU_DUMP_CCOP = 0x00040000, +}; + +/** + * cpu_dump_state: + * @cpu: The CPU whose state is to be dumped. + * @f: File to dump to. + * @cpu_fprintf: Function to dump with. + * @flags: Flags what to dump. + * + * Dumps CPU state. + */ +void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, + int flags); + +/** + * cpu_dump_statistics: + * @cpu: The CPU whose state is to be dumped. + * @f: File to dump to. + * @cpu_fprintf: Function to dump with. + * @flags: Flags what to dump. + * + * Dumps CPU statistics. + */ +void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, + int flags); + +/** * cpu_reset: * @cpu: The CPU whose state is to be reset. */ |