s390x/tcg: Don't ignore content in r0 when not specified via "b" or "x"
[qemu/ar7.git] / include / exec / log.h
blob3c7fa65ead688bf23b1dbc187b86705406f240e0
1 #ifndef QEMU_EXEC_LOG_H
2 #define QEMU_EXEC_LOG_H
4 #include "qemu/log.h"
5 #include "hw/core/cpu.h"
6 #include "disas/disas.h"
8 /* cpu_dump_state() logging functions: */
9 /**
10 * log_cpu_state:
11 * @cpu: The CPU whose state is to be logged.
12 * @flags: Flags what to log.
14 * Logs the output of cpu_dump_state().
16 static inline void log_cpu_state(CPUState *cpu, int flags)
18 QemuLogFile *logfile;
20 if (qemu_log_enabled()) {
21 rcu_read_lock();
22 logfile = qatomic_rcu_read(&qemu_logfile);
23 if (logfile) {
24 cpu_dump_state(cpu, logfile->fd, flags);
26 rcu_read_unlock();
30 /**
31 * log_cpu_state_mask:
32 * @mask: Mask when to log.
33 * @cpu: The CPU whose state is to be logged.
34 * @flags: Flags what to log.
36 * Logs the output of cpu_dump_state() if loglevel includes @mask.
38 static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
40 if (qemu_loglevel & mask) {
41 log_cpu_state(cpu, flags);
45 #ifdef NEED_CPU_H
46 /* disas() and target_disas() to qemu_logfile: */
47 static inline void log_target_disas(CPUState *cpu, target_ulong start,
48 target_ulong len)
50 QemuLogFile *logfile;
51 rcu_read_lock();
52 logfile = qatomic_rcu_read(&qemu_logfile);
53 if (logfile) {
54 target_disas(logfile->fd, cpu, start, len);
56 rcu_read_unlock();
59 static inline void log_disas(const void *code, unsigned long size)
61 QemuLogFile *logfile;
62 rcu_read_lock();
63 logfile = qatomic_rcu_read(&qemu_logfile);
64 if (logfile) {
65 disas(logfile->fd, code, size);
67 rcu_read_unlock();
70 #if defined(CONFIG_USER_ONLY)
71 /* page_dump() output to the log file: */
72 static inline void log_page_dump(const char *operation)
74 FILE *logfile = qemu_log_lock();
75 if (logfile) {
76 qemu_log("page layout changed following %s\n", operation);
77 page_dump(logfile);
79 qemu_log_unlock(logfile);
81 #endif
82 #endif
84 #endif