[Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h
From: Paolo BonziniSplit the bits that require it to exec/log.h. Signed-off-by: Paolo Bonzini Signed-off-by: Denis V. Lunev Acked-by: Christian Borntraeger --- bsd-user/main.c | 1 + cpu-exec.c| 1 + exec.c| 1 + hw/acpi/cpu_hotplug.c | 1 + hw/timer/a9gtimer.c | 1 + include/exec/log.h| 60 +++ include/qemu/log.h| 59 -- linux-user/main.c | 1 + qom/cpu.c | 1 + target-alpha/translate.c | 1 + target-arm/translate.c| 1 + target-cris/translate.c | 1 + target-i386/seg_helper.c | 1 + target-i386/smm_helper.c | 1 + target-i386/translate.c | 1 + target-lm32/helper.c | 1 + target-lm32/translate.c | 1 + target-m68k/translate.c | 1 + target-microblaze/helper.c| 1 + target-microblaze/translate.c | 1 + target-mips/helper.c | 1 + target-mips/translate.c | 1 + target-moxie/translate.c | 1 + target-openrisc/translate.c | 1 + target-ppc/mmu-hash32.c | 1 + target-ppc/mmu-hash64.c | 1 + target-ppc/mmu_helper.c | 1 + target-ppc/translate.c| 1 + target-s390x/translate.c | 1 + target-sh4/helper.c | 1 + target-sh4/translate.c| 1 + target-sparc/int32_helper.c | 1 + target-sparc/int64_helper.c | 1 + target-sparc/translate.c | 1 + target-tilegx/translate.c | 1 + target-tricore/translate.c| 1 + target-unicore32/translate.c | 1 + target-xtensa/translate.c | 1 + tcg/tcg.c | 1 + translate-all.c | 1 + 40 files changed, 98 insertions(+), 59 deletions(-) create mode 100644 include/exec/log.h diff --git a/bsd-user/main.c b/bsd-user/main.c index adf2de0..520ce99 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -33,6 +33,7 @@ #include "tcg.h" #include "qemu/timer.h" #include "qemu/envlist.h" +#include "exec/log.h" int singlestep; unsigned long mmap_min_addr; diff --git a/cpu-exec.c b/cpu-exec.c index 7eef083..564a21d 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -27,6 +27,7 @@ #include "exec/address-spaces.h" #include "qemu/rcu.h" #include "exec/tb-hash.h" +#include "exec/log.h" #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) #include "hw/i386/apic.h" #endif diff --git a/exec.c b/exec.c index 8af2570..87636a6 100644 --- a/exec.c +++ b/exec.c @@ -53,6 +53,7 @@ #include "exec/memory-internal.h" #include "exec/ram_addr.h" +#include "exec/log.h" #include "qemu/range.h" #ifndef _WIN32 diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c index f5b9972..16bacfc 100644 --- a/hw/acpi/cpu_hotplug.c +++ b/hw/acpi/cpu_hotplug.c @@ -11,6 +11,7 @@ */ #include "hw/hw.h" #include "hw/acpi/cpu_hotplug.h" +#include "qom/cpu.h" static uint64_t cpu_status_read(void *opaque, hwaddr addr, unsigned int size) { diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index dd4aae8..b38c76a 100644 --- a/hw/timer/a9gtimer.c +++ b/hw/timer/a9gtimer.c @@ -24,6 +24,7 @@ #include "qemu/timer.h" #include "qemu/bitops.h" #include "qemu/log.h" +#include "qom/cpu.h" #ifndef A9_GTIMER_ERR_DEBUG #define A9_GTIMER_ERR_DEBUG 0 diff --git a/include/exec/log.h b/include/exec/log.h new file mode 100644 index 000..ba1c9b5 --- /dev/null +++ b/include/exec/log.h @@ -0,0 +1,60 @@ +#ifndef QEMU_EXEC_LOG_H +#define QEMU_EXEC_LOG_H + +#include "qemu/log.h" +#include "qom/cpu.h" +#include "disas/disas.h" + +/* cpu_dump_state() logging functions: */ +/** + * log_cpu_state: + * @cpu: The CPU whose state is to be logged. + * @flags: Flags what to log. + * + * Logs the output of cpu_dump_state(). + */ +static inline void log_cpu_state(CPUState *cpu, int flags) +{ +if (qemu_log_enabled()) { +cpu_dump_state(cpu, qemu_logfile, fprintf, flags); +} +} + +/** + * log_cpu_state_mask: + * @mask: Mask when to log. + * @cpu: The CPU whose state is to be logged. + * @flags: Flags what to log. + * + * Logs the output of cpu_dump_state() if loglevel includes @mask. + */ +static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags) +{ +if (qemu_loglevel & mask) { +log_cpu_state(cpu, flags); +} +} + +#ifdef NEED_CPU_H +/* disas() and target_disas() to qemu_logfile: */ +static inline void log_target_disas(CPUState *cpu, target_ulong start, +target_ulong len, int flags) +{ +target_disas(qemu_logfile, cpu, start, len, flags); +} + +static inline void log_disas(void *code, unsigned long size) +{ +disas(qemu_logfile, code, size); +} + +#if defined(CONFIG_USER_ONLY) +/* page_dump() output to the log file: */ +static inline void log_page_dump(void) +{ +page_dump(qemu_logfile); +} +#endif +#endif + +#endif diff --git
[Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h
From: Paolo BonziniSplit the bits that require it to exec/log.h. Signed-off-by: Paolo Bonzini Signed-off-by: Denis V. Lunev Reviewed-by: Christian Borntraeger --- bsd-user/main.c | 1 + cpu-exec.c| 1 + exec.c| 1 + hw/acpi/cpu_hotplug.c | 1 + hw/timer/a9gtimer.c | 1 + include/exec/log.h| 60 +++ include/qemu/log.h| 59 -- linux-user/main.c | 1 + qom/cpu.c | 1 + target-alpha/translate.c | 1 + target-arm/translate.c| 1 + target-cris/translate.c | 1 + target-i386/seg_helper.c | 1 + target-i386/smm_helper.c | 1 + target-i386/translate.c | 1 + target-lm32/helper.c | 1 + target-lm32/translate.c | 1 + target-m68k/translate.c | 1 + target-microblaze/helper.c| 1 + target-microblaze/translate.c | 1 + target-mips/helper.c | 1 + target-mips/translate.c | 1 + target-moxie/translate.c | 1 + target-openrisc/translate.c | 1 + target-ppc/mmu-hash32.c | 1 + target-ppc/mmu-hash64.c | 1 + target-ppc/mmu_helper.c | 1 + target-ppc/translate.c| 1 + target-s390x/translate.c | 1 + target-sh4/helper.c | 1 + target-sh4/translate.c| 1 + target-sparc/int32_helper.c | 1 + target-sparc/int64_helper.c | 1 + target-sparc/translate.c | 1 + target-tilegx/translate.c | 1 + target-tricore/translate.c| 1 + target-unicore32/translate.c | 1 + target-xtensa/translate.c | 1 + tcg/tcg.c | 1 + translate-all.c | 1 + 40 files changed, 98 insertions(+), 59 deletions(-) create mode 100644 include/exec/log.h diff --git a/bsd-user/main.c b/bsd-user/main.c index adf2de0..520ce99 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -33,6 +33,7 @@ #include "tcg.h" #include "qemu/timer.h" #include "qemu/envlist.h" +#include "exec/log.h" int singlestep; unsigned long mmap_min_addr; diff --git a/cpu-exec.c b/cpu-exec.c index 7eef083..564a21d 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -27,6 +27,7 @@ #include "exec/address-spaces.h" #include "qemu/rcu.h" #include "exec/tb-hash.h" +#include "exec/log.h" #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) #include "hw/i386/apic.h" #endif diff --git a/exec.c b/exec.c index 8af2570..87636a6 100644 --- a/exec.c +++ b/exec.c @@ -53,6 +53,7 @@ #include "exec/memory-internal.h" #include "exec/ram_addr.h" +#include "exec/log.h" #include "qemu/range.h" #ifndef _WIN32 diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c index f5b9972..16bacfc 100644 --- a/hw/acpi/cpu_hotplug.c +++ b/hw/acpi/cpu_hotplug.c @@ -11,6 +11,7 @@ */ #include "hw/hw.h" #include "hw/acpi/cpu_hotplug.h" +#include "qom/cpu.h" static uint64_t cpu_status_read(void *opaque, hwaddr addr, unsigned int size) { diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c index dd4aae8..b38c76a 100644 --- a/hw/timer/a9gtimer.c +++ b/hw/timer/a9gtimer.c @@ -24,6 +24,7 @@ #include "qemu/timer.h" #include "qemu/bitops.h" #include "qemu/log.h" +#include "qom/cpu.h" #ifndef A9_GTIMER_ERR_DEBUG #define A9_GTIMER_ERR_DEBUG 0 diff --git a/include/exec/log.h b/include/exec/log.h new file mode 100644 index 000..ba1c9b5 --- /dev/null +++ b/include/exec/log.h @@ -0,0 +1,60 @@ +#ifndef QEMU_EXEC_LOG_H +#define QEMU_EXEC_LOG_H + +#include "qemu/log.h" +#include "qom/cpu.h" +#include "disas/disas.h" + +/* cpu_dump_state() logging functions: */ +/** + * log_cpu_state: + * @cpu: The CPU whose state is to be logged. + * @flags: Flags what to log. + * + * Logs the output of cpu_dump_state(). + */ +static inline void log_cpu_state(CPUState *cpu, int flags) +{ +if (qemu_log_enabled()) { +cpu_dump_state(cpu, qemu_logfile, fprintf, flags); +} +} + +/** + * log_cpu_state_mask: + * @mask: Mask when to log. + * @cpu: The CPU whose state is to be logged. + * @flags: Flags what to log. + * + * Logs the output of cpu_dump_state() if loglevel includes @mask. + */ +static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags) +{ +if (qemu_loglevel & mask) { +log_cpu_state(cpu, flags); +} +} + +#ifdef NEED_CPU_H +/* disas() and target_disas() to qemu_logfile: */ +static inline void log_target_disas(CPUState *cpu, target_ulong start, +target_ulong len, int flags) +{ +target_disas(qemu_logfile, cpu, start, len, flags); +} + +static inline void log_disas(void *code, unsigned long size) +{ +disas(qemu_logfile, code, size); +} + +#if defined(CONFIG_USER_ONLY) +/* page_dump() output to the log file: */ +static inline void log_page_dump(void) +{ +page_dump(qemu_logfile); +} +#endif +#endif + +#endif diff