Error reporting & monitor patches for 2019-04-18
Subsystems (2)
Early pull request because I'll be on vacation when 4.1 opens. Hope that's okay.
The following changes since commit eeba63fc7fface36f438bcbc0d3b02e7dcb59983:
Update version for v4.0.0-rc4 release (2019-04-16 21:53:00 +0100)
are available in the Git repository at:
git://repo.or.cz/qemu/armbru.git tags/pull-error-monitor-2019-04-18
for you to fetch changes up to ede9a8a656c992deecce45f8175985dd81cc6be9:
include: Move fprintf_function to disas/ (2019-04-18 22:18:59 +0200)
----------------------------------------------------------------
Error reporting & monitor patches for 2019-04-18
----------------------------------------------------------------
Christophe Fergeau (2):
qemu-io: Use error_[gs]et_progname()
log: Make glib logging go through QEMU
Markus Armbruster (33):
error: Fix error_report_err(), warn_report_err() hint printing
qemu-img: Use error_vreport() in error_exit() block/ssh: Do not report read/write/flush errors to the user
loader-fit: Wean off error_printf()
mips/boston: Report errors with error_report(), not error_printf()
pci: Report fatal errors with error_report(), not error_printf()
hpet: Report warnings with warn_report(), not error_printf()
vfio: Report warnings with warn_report(), not error_printf() s390x/kvm: Report warnings with warn_report(), not error_printf()
vl: Make -machine $TYPE,help and -accel help print to stdout monitor error: Make printf()-like functions return a value
qemu-print: New qemu_printf(), qemu_vprintf() etc.
blockdev: Make -drive format=help print to stdout
char: Make -chardev help print to stdout
char-pty: Print "char device redirected" message to stdout
monitor: Simplify how -device/device_add print help
include: Include fprintf-fn.h only where needed
trace: Simplify how st_print_trace_file_status() prints
tcg: Simplify how dump_opcount_info() prints
tcg: Simplify how dump_exec_info() prints
tcg: Simplify how dump_drift_info() prints
qsp: Simplify how qsp_report() prints
block/qapi: Clean up how we print to monitor or stdout
memory: Clean up how mtree_info() prints
target: Simplify how the TARGET_cpu_list() print
target: Clean up how the dump_mmu() print
target/i386: Simplify how x86_cpu_dump_local_apic_state() prints qom/cpu: Simplify how CPUClass::dump_statistics() prints
qemu-print: New qemu_fprintf(), qemu_vfprintf() qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
monitor: Clean up how monitor_disas() funnels output to monitor
disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
include: Move fprintf_function to disas/
Vladimir Sementsov-Ogievskiy (1):
util/error: do not free error on error_abort
MAINTAINERS | 2 +
accel/kvm/kvm-all.c | 4 +-
accel/tcg/translate-all.c | 49 ++---
block/qapi.c | 120 ++++++-------
block/ssh.c | 38 ++--
block/trace-events | 3 +
blockdev.c | 9 +-
bsd-user/main.c | 6 +-
chardev/char-pty.c | 5 +-
chardev/char.c | 3 +-
cpus.c | 21 ++-
disas.c | 5 +-
disas/alpha.c | 2 +-
disas/arm-a64.cc | 2 +-
disas/arm.c | 2 +-
disas/cris.c | 2 +-
disas/hppa.c | 2 +-
disas/i386.c | 2 +-
disas/lm32.c | 2 +-
disas/m68k.c | 2 +-
disas/microblaze.c | 2 +-
disas/mips.c | 2 +-
disas/moxie.c | 2 +-
disas/nanomips.cpp | 2 +-
disas/nios2.c | 2 +-
disas/ppc.c | 2 +-
disas/riscv.c | 2 +-
disas/s390.c | 2 +-
disas/sh4.c | 2 +-
disas/sparc.c | 2 +-
disas/tci.c | 2 +-
disas/xtensa.c | 2 +-
exec.c | 42 ++---
hmp.c | 12 +-
hw/core/loader-fit.c | 62 ++++---
hw/mips/boston.c | 6 +-
hw/pci/pci.c | 2 +-
hw/timer/hpet.c | 2 +-
hw/vfio/pci.c | 19 +-
include/block/qapi.h | 9 +-
include/disas/{bfd.h => dis-asm.h} | 5 +-
include/exec/cpu-all.h | 4 +-
include/exec/cpu-common.h | 13 --
include/exec/log.h | 2 +-
include/exec/memory-internal.h | 3 +-
include/exec/memory.h | 3 +-
include/monitor/monitor.h | 8 +-
include/qemu-common.h | 2 -
include/qemu/cutils.h | 2 -
include/qemu/error-report.h | 11 +-
include/qemu/fprintf-fn.h | 14 --
include/qemu/qemu-print.h | 23 +++
include/qemu/qsp.h | 6 +-
include/qom/cpu.h | 24 +--
include/sysemu/cpus.h | 4 +-
linux-user/alpha/cpu_loop.c | 2 +-
linux-user/cpu_loop-common.h | 2 +-
linux-user/cris/cpu_loop.c | 2 +-
linux-user/main.c | 4 +-
linux-user/microblaze/cpu_loop.c | 4 +-
linux-user/s390x/cpu_loop.c | 4 +-
linux-user/sh4/cpu_loop.c | 2 +-
linux-user/sparc/cpu_loop.c | 2 +-
memory.c | 156 ++++++++--------
monitor.c | 89 ++++------
qdev-monitor.c | 36 ++--
qemu-img.c | 14 +-
qemu-io-cmds.c | 2 +-
qemu-io.c | 14 +-
qemu-nbd.c | 2 +-
qom/cpu.c | 11 +-
scsi/qemu-pr-helper.c | 1 +
stubs/error-printf.c | 13 +-
stubs/monitor.c | 5 +
target/alpha/cpu.c | 15 +-
target/alpha/cpu.h | 5 +-
target/alpha/helper.c | 24 +--
target/arm/arm-semi.c | 2 +-
target/arm/cpu.c | 1 -
target/arm/cpu.h | 5 +-
target/arm/helper.c | 15 +-
target/arm/translate-a64.c | 82 ++++-----
target/arm/translate.c | 58 +++---
target/arm/translate.h | 7 +-
target/cris/cpu.c | 14 +-
target/cris/cpu.h | 5 +-
target/cris/helper.c | 2 +-
target/cris/translate.c | 36 ++--
target/hppa/cpu.c | 14 +-
target/hppa/cpu.h | 4 +-
target/hppa/helper.c | 24 +--
target/i386/cpu.c | 29 ++-
target/i386/cpu.h | 8 +-
target/i386/hax-all.c | 4 +-
target/i386/helper.c | 356 ++++++++++++++++++-------------------
target/i386/monitor.c | 3 +-
target/lm32/cpu.c | 14 +-
target/lm32/cpu.h | 5 +-
target/lm32/translate.c | 36 ++--
target/m68k/cpu.h | 8 +-
target/m68k/helper.c | 129 +++++++-------
target/m68k/monitor.c | 2 +-
target/m68k/translate.c | 86 ++++-----
target/microblaze/cpu.h | 3 +-
target/microblaze/helper.c | 2 +-
target/microblaze/translate.c | 39 ++--
target/mips/cpu.h | 2 +-
target/mips/internal.h | 3 +-
target/mips/translate.c | 77 ++++----
target/mips/translate_init.inc.c | 5 +-
target/moxie/cpu.h | 3 +-
target/moxie/helper.c | 2 +-
target/moxie/translate.c | 22 +--
target/nios2/cpu.h | 5 +-
target/nios2/helper.c | 2 +-
target/nios2/mmu.c | 7 +-
target/nios2/monitor.c | 2 +-
target/nios2/translate.c | 24 +--
target/openrisc/cpu.c | 15 +-
target/openrisc/cpu.h | 5 +-
target/openrisc/disas.c | 2 +-
target/openrisc/translate.c | 11 +-
target/ppc/cpu.h | 10 +-
target/ppc/mmu-hash64.c | 7 +-
target/ppc/mmu-hash64.h | 2 +-
target/ppc/mmu_helper.c | 70 ++++----
target/ppc/monitor.c | 2 +-
target/ppc/translate.c | 170 +++++++++---------
target/ppc/translate_init.inc.c | 28 ++-
target/riscv/cpu.c | 54 +++---
target/riscv/cpu.h | 2 +-
target/s390x/cpu.h | 2 +-
target/s390x/cpu_models.c | 21 +--
target/s390x/helper.c | 42 ++---
target/s390x/internal.h | 3 +-
target/s390x/kvm.c | 2 +-
target/sh4/cpu.c | 17 +-
target/sh4/cpu.h | 5 +-
target/sh4/translate.c | 27 +--
target/sparc/cpu.c | 133 +++++++-------
target/sparc/cpu.h | 7 +-
target/sparc/ldst_helper.c | 18 +-
target/sparc/mmu_helper.c | 97 +++++-----
target/sparc/monitor.c | 2 +-
target/tilegx/cpu.c | 14 +-
target/tricore/cpu.h | 5 +-
target/tricore/helper.c | 15 +-
target/tricore/translate.c | 26 +--
target/unicore32/cpu.h | 3 +-
target/unicore32/translate.c | 39 ++--
target/xtensa/cpu.h | 7 +-
target/xtensa/helper.c | 7 +-
target/xtensa/mmu_helper.c | 24 ++-
target/xtensa/monitor.c | 2 +-
target/xtensa/translate.c | 40 +++--
tcg/tcg.c | 50 +++---
tcg/tcg.h | 4 +-
tests/test-util-sockets.c | 1 +
trace/simple.c | 7 +-
trace/simple.h | 2 +-
util/Makefile.objs | 1 +
util/error.c | 9 +-
util/qemu-error.c | 67 ++++++-
util/qemu-print.c | 69 +++++++
util/qsp.c | 21 +--
vl.c | 14 +-
166 files changed, 1651 insertions(+), 1669 deletions(-)
rename include/disas/{bfd.h => dis-asm.h} (99%)
delete mode 100644 include/qemu/fprintf-fn.h
create mode 100644 include/qemu/qemu-print.h
create mode 100644 util/qemu-print.cSignature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 04/36] util/error: do not free error on error_abort
From: Vladimir Sementsov-Ogievskiy <[email protected]>
It would be nice to have Error object not freed away when debugging a coredump.
Message-Id: <[email protected]>
--- util/error.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
util/error.c +4 -1
@@ -34,7 +34,10 @@ static void error_handle_fatal(Error **errp, Error *err)if (errp == &error_abort) {fprintf (stderr,"Unexpected error in %s() at %s:%d:\n" , err->func, err->src, err->line); -error_report_err (err); +error_report ("%s" ,error_get_pretty (err)); +if (err->hint) { +error_printf ("%s" , err->hint->str); + }abort (); }if (errp == &error_fatal) {
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 12/36] s390x/kvm: Report warnings with warn_report(), not error_printf()
In reply to Markus Armbrusterkvm_s390_mem_op() can fail in two ways: when !cap_mem_op, it returns -ENOSYS, and when kvm_vcpu_ioctl() fails, it returns -errno set by ioctl(). Its caller s390_cpu_virt_mem_rw() recovers from both failures.
kvm_s390_mem_op() prints "KVM_S390_MEM_OP failed" with error_printf() in the latter failure mode. Since this is obviously a warning, use warn_report().
Perhaps the reporting should be left to the caller. It could warn on failure other than -ENOSYS.
Message-Id: <[email protected]>
--- target/s390x/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/kvm.c +1 -1
@@ -782,7 +782,7 @@ int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, void *hostbuf, ret =kvm_vcpu_ioctl (CPU (cpu),KVM_S390_MEM_OP , &mem_op);if (ret <0 ) { -error_printf ("KVM_S390_MEM_OP failed: %s\n" ,strerror (-ret)); +warn_report ("KVM_S390_MEM_OP failed: %s" ,strerror (-ret)); }return ret; }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 13/36] vl: Make -machine $TYPE, help and -accel help print to stdout
In reply to Markus ArmbrusterCommand line help help explicitly requested by the user should be printed to stdout, not stderr. We do elsewhere. Adjust -machine $TYPE,help and -accel help to match: use printf() instead of error_printf().
Message-Id: <[email protected]>
--- vl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
vl.c +5 -5
@@ -1556,12 +1556,12 @@ static int machine_help_func(QemuOpts *opts, MachineState *machine)continue ; } -error_printf ("%s.%s=%s" ,MACHINE_GET_CLASS (machine)->name, - prop->name, prop->type); +printf ("%s.%s=%s" ,MACHINE_GET_CLASS (machine)->name, + prop->name, prop->type);if (prop->description) { -error_printf (" (%s)\n" , prop->description); +printf (" (%s)\n" , prop->description); }else { -error_printf ("\n" ); +printf ("\n" ); } }
@@ -3643,7 +3643,7 @@ int main(int argc, char **argv, char **envp) optarg, true); optarg =qemu_opt_get (accel_opts,"accel" );if (!optarg ||is_help_option (optarg)) { -error_printf ("Possible accelerators: kvm, xen, hax, tcg\n" ); +printf ("Possible accelerators: kvm, xen, hax, tcg\n" );exit (0 ); } opts = qemu_opts_create(qemu_find_opts("machine"), NULL,
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 01/36] qemu-io: Use error_[gs]et_progname()
In reply to Markus ArmbrusterFrom: Christophe Fergeau <[email protected]>
qemu-io reimplements itself what error_get_progname()/error_set_progname() already does. This commit switches it to use this API from qemu-error.h
Message-Id: <[email protected]>
--- qemu-io.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
qemu-io.c +6 -8
@@ -34,8 +34,6 @@#define CMD_NOFILE_OK 0x01 -static char *progname; -static BlockBackend *qemuio_blk;static bool quit_qemu_io;
@@ -312,7 +310,7 @@ static char *get_prompt(void)static char prompt[FILENAME_MAX +2 /*"> "*/ +1 /*"\0"*/ ];if (!prompt[0 ]) { -snprintf (prompt,sizeof (prompt),"%s> " , progname); +snprintf (prompt,sizeof (prompt),"%s> " ,error_get_progname ()); }return prompt;
@@ -525,7 +523,7 @@ int main(int argc, char **argv)#endif module_call_init (MODULE_INIT_TRACE ); - progname =g_path_get_basename (argv[0 ]); +error_set_progname (argv[0 ]);qemu_init_exec_dir (argv[0 ]);qcrypto_init (&error_fatal);
@@ -580,10 +578,10 @@ int main(int argc, char **argv)break ;case 'V' :printf ("%s version " QEMU_FULL_VERSION "\n" -QEMU_COPYRIGHT "\n" , progname); +QEMU_COPYRIGHT "\n" ,error_get_progname ());exit (0 );case 'h' : -usage (progname); +usage (error_get_progname ());exit (0 );case 'U' : force_share = true;
@@ -600,13 +598,13 @@ int main(int argc, char **argv) imageOpts = true;break ;default : -usage (progname); +usage (error_get_progname ());exit (1 ); } }if ((argc - optind) >1 ) { -usage (progname); +usage (error_get_progname ());exit (1 ); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 02/36] log: Make glib logging go through QEMU
In reply to Markus ArmbrusterFrom: Christophe Fergeau <[email protected]>
This commit adds a error_init() helper which calls g_log_set_default_handler() so that glib logs (g_log, g_warning, ...) are handled similarly to other QEMU logs. This means they will get a timestamp if timestamps are enabled, and they will go through the HMP monitor if one is configured.
This commit also adds a call to error_init() to the binaries installed by QEMU. Since error_init() also calls error_set_progname(), this means that *-linux-user, *-bsd-user and qemu-pr-helper messages output with error_report, info_report, ... will slightly change: they will be prefixed by the binary name.
glib debug messages are enabled through G_MESSAGES_DEBUG similarly to the glib default log handler.
At the moment, this change will mostly impact SPICE logging if your spice version is >= 0.14.1. With older spice versions, this is not going to work as expected, but will not have any ill effect, so this call is not conditional on the SPICE version.
Message-Id: <[email protected]>
--- bsd-user/main.c | 2 ++ include/qemu/error-report.h | 3 +- linux-user/main.c | 2 ++ qemu-img.c | 2 +- qemu-io.c | 2 +- qemu-nbd.c | 2 +- scsi/qemu-pr-helper.c | 1 + util/qemu-error.c | 55 ++++++++++++++++++++++++++++++++++++- vl.c | 2 +- 9 files changed, 65 insertions(+), 6 deletions(-)
bsd-user/main.c +2 -0
@@ -24,6 +24,7 @@#include "qapi/error.h" #include "qemu.h" #include "qemu/config-file.h" +#include "qemu/error-report.h" #include "qemu/path.h" #include "qemu/help_option.h" #include "cpu.h"
@@ -743,6 +744,7 @@ int main(int argc, char **argv)if (argc <=1 )usage (); +error_init (argv[0 ]);module_call_init (MODULE_INIT_TRACE );qemu_init_cpu_list ();module_call_init (MODULE_INIT_QOM );
include/qemu/error-report.h +2 -1
@@ -34,7 +34,6 @@ void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); -void error_set_progname (const char *argv0); void error_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); void warn_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
@@ -49,6 +48,8 @@ bool error_report_once_cond(bool *printed, const char *fmt, ...) bool warn_report_once_cond(bool *printed, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +void error_init (const char *argv0); +/* * Similar to error_report(), except it prints the message just once. * Return true when it prints, false otherwise.
linux-user/main.c +2 -0
@@ -27,6 +27,7 @@#include "qemu/path.h" #include "qemu/config-file.h" #include "qemu/cutils.h" +#include "qemu/error-report.h" #include "qemu/help_option.h" #include "cpu.h" #include "exec/exec-all.h"
@@ -600,6 +601,7 @@ int main(int argc, char **argv, char **envp)int ret;int execfd; +error_init (argv[0 ]);module_call_init (MODULE_INIT_TRACE );qemu_init_cpu_list ();module_call_init (MODULE_INIT_QOM );
qemu-img.c +1 -1
@@ -4923,8 +4923,8 @@ int main(int argc, char **argv)signal (SIGPIPE ,SIG_IGN );#endif +error_init (argv[0 ]);module_call_init (MODULE_INIT_TRACE ); -error_set_progname (argv[0 ]);qemu_init_exec_dir (argv[0 ]);if (qemu_init_main_loop (&local_error)) {
qemu-io.c +1 -1
@@ -522,8 +522,8 @@ int main(int argc, char **argv)signal (SIGPIPE ,SIG_IGN );#endif +error_init (argv[0 ]);module_call_init (MODULE_INIT_TRACE ); -error_set_progname (argv[0 ]);qemu_init_exec_dir (argv[0 ]);qcrypto_init (&error_fatal);
qemu-nbd.c +1 -1
@@ -690,8 +690,8 @@ int main(int argc, char **argv)signal (SIGPIPE ,SIG_IGN );#endif +error_init (argv[0 ]);module_call_init (MODULE_INIT_TRACE ); -error_set_progname (argv[0 ]);qcrypto_init (&error_fatal);module_call_init (MODULE_INIT_QOM );
scsi/qemu-pr-helper.c +1 -0
@@ -895,6 +895,7 @@ int main(int argc, char **argv)signal (SIGPIPE ,SIG_IGN ); +error_init (argv[0 ]);module_call_init (MODULE_INIT_TRACE );module_call_init (MODULE_INIT_QOM );qemu_add_opts (&qemu_trace_opts);
util/qemu-error.c +54 -1
64 lines not on this page · raw message
vl.c +1 -1
@@ -3022,6 +3022,7 @@ int main(int argc, char **argv, char **envp)char *dir, **dirs;BlockdevOptionsQueue bdo_queue =QSIMPLEQ_HEAD_INITIALIZER (bdo_queue); +error_init (argv[0 ]);module_call_init (MODULE_INIT_TRACE );qemu_init_cpu_list ();
@@ -3030,7 +3031,6 @@ int main(int argc, char **argv, char **envp)qemu_mutex_lock_iothread ();atexit (qemu_run_exit_notifiers); -error_set_progname (argv[0 ]);qemu_init_exec_dir (argv[0 ]);module_call_init (MODULE_INIT_QOM );
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 03/36] error: Fix error_report_err(), warn_report_err() hint printing
In reply to Markus ArmbrusterBefore the from qerror_report() to error_setg(), hints looked like this:
qerror_report(QERR_MACRO, ... arguments ...);
error_printf_unless_qmp(... hint ...);error_printf_unless_qmp() made perfect sense: it printed exactly when qerror_report() did.
After the conversion to error_setg():
error_setg(errp, QERR_MACRO, ... arguments ...);
error_printf_unless_qmp(... hint ...);The "unless QMP part" still made some sense; in QMP context, the caller generally uses the error as QMP response instead of printing it.
However, everything else is wrong. If the caller handles the error, the hint gets printed anyway (unless QMP). If the caller reports the error, the hint gets printed *before* the report (unless QMP) or not at all (if QMP).
Commit 50b7b000c91 fixed this by making hints a member of Error. It kept printing hints with error_printf_unless_qmp():
void error_report_err(Error *err)
{
error_report("%s", error_get_pretty(err));
+ if (err->hint) {
+ error_printf_unless_qmp("%s\n", err->hint->str);
+ }
error_free(err);
}
This is wrong. We should (and now can) print the hint exactly when we print the error.
The mistake has since been copied to warn_report_err() in commit e43ead1d0b9.
Fix both to use error_printf().
Message-Id: <[email protected]>
--- util/error.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
util/error.c +2 -2
@@ -223,7 +223,7 @@ void error_report_err(Error *err) {error_report ("%s" ,error_get_pretty (err));if (err->hint) { -error_printf_unless_qmp ("%s" , err->hint->str); +error_printf ("%s" , err->hint->str); }error_free (err); }
@@ -232,7 +232,7 @@ void warn_report_err(Error *err) {warn_report ("%s" ,error_get_pretty (err));if (err->hint) { -error_printf_unless_qmp ("%s" , err->hint->str); +error_printf ("%s" , err->hint->str); }error_free (err); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 08/36] mips/boston: Report errors with error_report(), not error_printf()
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- hw/mips/boston.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/mips/boston.c +3 -3
@@ -528,21 +528,21 @@ static void boston_mach_init(MachineState *machine) fw_size =load_image_targphys (machine->firmware,0x1fc00000 ,4 * MiB);if (fw_size ==-1 ) { -error_printf ("unable to load firmware image '%s'\n" , +error_report ("unable to load firmware image '%s'" , machine->firmware);exit (1 ); } }else if (machine->kernel_filename) { fit_err =load_fit (&boston_fit_loader, machine->kernel_filename, s);if (fit_err) { -error_printf ("unable to load FIT image\n" ); +error_report ("unable to load FIT image" );exit (1 ); }gen_firmware (memory_region_get_ram_ptr (flash) +0x7c00000 , s->kernel_entry, s->fdt_base, is_64b); }else if (!qtest_enabled ()) { -error_printf ("Please provide either a -kernel or -bios argument\n" ); +error_report ("Please provide either a -kernel or -bios argument" );exit (1 ); } }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 14/36] monitor error: Make printf()-like functions return a value
In reply to Markus Armbrusterprintf() & friends return the number of characters written on success, negative value on error.
monitor_printf(), monitor_vfprintf(), monitor_vprintf(), error_printf(), error_printf_unless_qmp(), error_vprintf(), and error_vprintf_unless_qmp() return void. Some of them carry a TODO comment asking for int instead.
Improve them to return int like printf() does.
This makes our use of monitor_printf() as fprintf_function slightly less dirty: the function cast no longer adds a return value that isn't there. It still changes a parameter's pointer type. That will be addressed in a future commit.
monitor_vfprintf() always returns zero. Improve it to return the proper value.
Message-Id: <[email protected]>
--- include/monitor/monitor.h | 8 ++--- include/qemu/error-report.h | 8 ++--- monitor.c | 61 ++++++++++++++++++++----------------- stubs/error-printf.c | 13 +++++--- util/qemu-error.c | 12 +++++--- 5 files changed, 57 insertions(+), 45 deletions(-)
include/monitor/monitor.h +4 -4
@@ -28,9 +28,9 @@ void monitor_resume(Monitor *mon);int monitor_get_fd (Monitor *mon,const char *fdname,Error **errp);int monitor_fd_param (Monitor *mon,const char *fdname,Error **errp); -void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); -void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +int monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); int monitor_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);void monitor_flush (Monitor *mon);int monitor_set_cpu (int cpu_index);
@@ -48,7 +48,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);void monitor_fdset_dup_fd_remove (int dup_fd);int monitor_fdset_dup_fd_find (int dup_fd); -void monitor_vfprintf(FILE *stream, - const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); +int monitor_vfprintf(FILE *stream, + const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0);#endif /* MONITOR_H */
include/qemu/error-report.h +4 -4
@@ -30,10 +30,10 @@ void loc_set_none(void);void loc_set_cmdline (char **argv,int idx,int cnt);void loc_set_file (const char *fname,int lno); -void error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); -void error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); -void error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); -void error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +int error_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); +int error_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +int error_vprintf_unless_qmp(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); +int error_printf_unless_qmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2); void error_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); void warn_vreport(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
monitor.c +33 -28
122 lines not on this page · raw message
stubs/error-printf.c +8 -5
@@ -2,19 +2,22 @@#include "qemu-common.h" #include "qemu/error-report.h" -void error_vprintf (const char *fmt,va_list ap) +int error_vprintf (const char *fmt,va_list ap) { +int ret; +if (g_test_initialized () && !g_test_subprocess () &&getenv ("QTEST_SILENT_ERRORS" )) {char *msg =g_strdup_vprintf (fmt, ap);g_test_message ("%s" , msg); + ret =strlen (msg);g_free (msg); - }else { -vfprintf (stderr, fmt, ap); +return ret; } +return vfprintf (stderr, fmt, ap); } -void error_vprintf_unless_qmp (const char *fmt,va_list ap) +int error_vprintf_unless_qmp (const char *fmt,va_list ap) { -error_vprintf (fmt, ap); +return error_vprintf (fmt, ap); }
util/qemu-error.c +8 -4
@@ -24,22 +24,26 @@ typedef enum {REPORT_TYPE_INFO , } report_type; -void error_printf (const char *fmt, ...) +int error_printf (const char *fmt, ...) {va_list ap; +int ret;va_start (ap, fmt); -error_vprintf (fmt, ap); + ret =error_vprintf (fmt, ap);va_end (ap); +return ret; } -void error_printf_unless_qmp (const char *fmt, ...) +int error_printf_unless_qmp (const char *fmt, ...) {va_list ap; +int ret;va_start (ap, fmt); -error_vprintf_unless_qmp (fmt, ap); + ret =error_vprintf_unless_qmp (fmt, ap);va_end (ap); +return ret; } static Location std_loc = {
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 18/36] char-pty: Print "char device redirected" message to stdout
In reply to Markus Armbrusterchar_pty_open() prints a "char device redirected to PTY_NAME (label LABEL)" message to the current monitor or else to stderr. This is not an error, so it shouldn't go to stderr. Print it to stdout instead.
Why is it even printed? No other ChardevClass::open() prints anything on success. It's because you need to know PTY_NAME to actually use this char device, e.g. like e.g. "socat STDIO,cfmakeraw FILE:PTY_NAME" to use the monitor's readline interface. You can get PTY_NAME with "info chardev" (a.k.a. query-chardev for QMP), but only if you already have a monitor.
Message-Id: <[email protected]>
--- chardev/char-pty.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
chardev/char-pty.c +3 -2
@@ -28,6 +28,7 @@#include "io/channel-file.h" #include "qemu/sockets.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "chardev/char-io.h"
@@ -211,8 +212,8 @@ static void char_pty_open(Chardev *chr,qemu_set_nonblock (master_fd); chr->filename =g_strdup_printf ("pty:%s" , pty_name); -error_printf ("char device redirected to %s (label %s)\n" , - pty_name, chr->label); +qemu_printf ("char device redirected to %s (label %s)\n" , + pty_name, chr->label); s =PTY_CHARDEV (chr); s->ioc =QIO_CHANNEL (qio_channel_file_new_fd (master_fd));
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 20/36] include: Include fprintf-fn.h only where needed
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- include/qemu-common.h | 2 -- include/qemu/cutils.h | 2 -- include/sysemu/cpus.h | 1 + 3 files changed, 1 insertion(+), 4 deletions(-)
include/qemu-common.h +0 -2
@@ -12,8 +12,6 @@#ifndef QEMU_COMMON_H #define QEMU_COMMON_H -#include "qemu/fprintf-fn.h" -#define TFR (expr) do { if ((expr) != -1) break; } while (errno == EINTR)/* Copyright string for -version arguments, About dialogs, etc */
include/qemu/cutils.h +0 -2
@@ -1,8 +1,6 @@#ifndef QEMU_CUTILS_H #define QEMU_CUTILS_H -#include "qemu/fprintf-fn.h" -/** * pstrcpy: * @buf: buffer to copy string into
include/sysemu/cpus.h +1 -0
@@ -1,6 +1,7 @@#ifndef QEMU_CPUS_H #define QEMU_CPUS_H +#include "qemu/fprintf-fn.h" #include "qemu/timer.h" /* cpus.c */
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 07/36] loader-fit: Wean off error_printf()
In reply to Markus Armbrusterload_fit() reports errors with error_printf() instead of error_report(). Worse, it even reports errors it actually recovers from, in fit_cfg_compatible() and fit_load_fdt(). Messed up in initial commit 51b58561c1d.
Convert the helper functions for load_fit() to Error. Make sure each failure path sets an error.
Fix fit_cfg_compatible() and fit_load_fdt() not to report errors they actually recover from.
Convert load_fit() to error_report().
Message-Id: <[email protected]>
--- hw/core/loader-fit.c | 62 +++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 26 deletions(-)
hw/core/loader-fit.c +36 -26
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qapi/error.h" #include "qemu/units.h" #include "exec/memory.h" #include "hw/loader.h"
@@ -33,7 +34,7 @@#define FIT_LOADER_MAX_PATH (128)static const void *fit_load_image_alloc (const void *itb,const char *name, -int *poff,size_t *psz) +int *poff,size_t *psz,Error **errp) {const void *data;const char *comp;
@@ -46,6 +47,7 @@ static const void *fit_load_image_alloc(const void *itb, const char *name, off =fdt_path_offset (itb, path);if (off <0 ) { +error_setg (errp,"can't find node %s" , path);return NULL ; }if (poff) {
@@ -54,6 +56,7 @@ static const void *fit_load_image_alloc(const void *itb, const char *name, data =fdt_getprop (itb, off,"data" , &sz);if (!data) { +error_setg (errp,"can't get %s/data" , path);return NULL ; }
@@ -73,7 +76,7 @@ static const void *fit_load_image_alloc(const void *itb, const char *name, uncomp_len =gunzip (uncomp_data, uncomp_len, (void *) data, sz);if (uncomp_len <0 ) { -error_printf ("unable to decompress %s image\n" , name); +error_setg (errp,"unable to decompress %s image" , name);g_free (uncomp_data);return NULL ; }
@@ -85,18 +88,19 @@ static const void *fit_load_image_alloc(const void *itb, const char *name,return data; } -error_printf ("unknown compression '%s'\n" , comp); +error_setg (errp,"unknown compression '%s'" , comp);return NULL ; }static int fit_image_addr (const void *itb,int img,const char *name, -hwaddr *addr) +hwaddr *addr,Error **errp) {const void *prop;int len; prop =fdt_getprop (itb, img, name, &len);if (!prop) { +error_setg (errp,"can't find %s address" , name);return -ENOENT ; }
@@ -108,13 +112,14 @@ static int fit_image_addr(const void *itb, int img, const char *name, *addr =fdt64_to_cpu (*(fdt64_t *)prop);return 0 ;default : -error_printf ("invalid %s address length %d\n" , name, len); +error_setg (errp,"invalid %s address length %d" , name, len);return -EINVAL ; } }static int fit_load_kernel (const struct fit_loader *ldr,const void *itb, -int cfg,void *opaque,hwaddr *pend) +int cfg,void *opaque,hwaddr *pend, +Error **errp) {const char *name;const void *data;
@@ -126,26 +131,26 @@ static int fit_load_kernel(const struct fit_loader *ldr, const void *itb, name =fdt_getprop (itb, cfg,"kernel" ,NULL );if (!name) { -error_printf ("no kernel specified by FIT configuration\n" ); +error_setg (errp,"no kernel specified by FIT configuration" );return -EINVAL ; } - load_data = data =fit_load_image_alloc (itb, name, &img_off, &sz); + load_data = data =fit_load_image_alloc (itb, name, &img_off, &sz, errp);if (!data) { -error_printf ("unable to load kernel image from FIT\n" ); +error_prepend (errp,"unable to load kernel image from FIT: " );return -EINVAL ; } - err =fit_image_addr (itb, img_off,"load" , &load_addr); + err =fit_image_addr (itb, img_off,"load" , &load_addr, errp);if (err) { -error_printf ("unable to read kernel load address from FIT\n" ); +error_prepend (errp,"unable to read kernel load address from FIT: " ); ret = err; goto out; } - err =fit_image_addr (itb, img_off,"entry" , &entry_addr); + err =fit_image_addr (itb, img_off,"entry" , &entry_addr, errp);if (err) { -error_printf ("unable to read kernel entry address from FIT\n" ); +error_prepend (errp,"unable to read kernel entry address from FIT: " ); ret = err; goto out; }
@@ -172,7 +177,7 @@ out:static int fit_load_fdt (const struct fit_loader *ldr,const void *itb,int cfg,void *opaque,const void *match_data, -hwaddr kernel_end) +hwaddr kernel_end,Error **errp) {const char *name;const void *data;
@@ -187,16 +192,18 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,return 0 ; } - load_data = data =fit_load_image_alloc (itb, name, &img_off, &sz); + load_data = data =fit_load_image_alloc (itb, name, &img_off, &sz, errp);if (!data) { -error_printf ("unable to load FDT image from FIT\n" ); +error_prepend (errp,"unable to load FDT image from FIT: " );return -EINVAL ; } - err =fit_image_addr (itb, img_off,"load" , &load_addr); + err =fit_image_addr (itb, img_off,"load" , &load_addr, errp);if (err == -ENOENT ) { load_addr =ROUND_UP (kernel_end,64 * KiB) + (10 * MiB); +error_free (*errp); }else if (err) { +error_prepend (errp,"unable to read FDT load address from FIT: " ); ret = err; goto out; }
@@ -229,7 +236,7 @@ static bool fit_cfg_compatible(const void *itb, int cfg, const char *compat)return false; } - fdt =fit_load_image_alloc (itb, fdt_name,NULL ,NULL ); + fdt =fit_load_image_alloc (itb, fdt_name,NULL ,NULL ,NULL );if (!fdt) {return false; }
@@ -252,11 +259,12 @@ out:int load_fit (const struct fit_loader *ldr,const char *filename,void *opaque) { +Error *err =NULL ;const struct fit_loader_match *match;const void *itb, *match_data =NULL ;const char *def_cfg_name;char path[FIT_LOADER_MAX_PATH ]; -int itb_size, configs, cfg_off, off, err; +int itb_size, configs, cfg_off, off;hwaddr kernel_end;int ret;
@@ -267,6 +275,7 @@ int load_fit(const struct fit_loader *ldr, const char *filename, void *opaque) configs =fdt_path_offset (itb,"/configurations" );if (configs <0 ) { +error_report ("can't find node /configurations" ); ret = configs; goto out; }
@@ -301,20 +310,21 @@ int load_fit(const struct fit_loader *ldr, const char *filename, void *opaque) }if (cfg_off <0 ) { -/* couldn't find a configuration to use */ +error_report ("can't find configuration" ); ret = cfg_off; goto out; } - err =fit_load_kernel (ldr, itb, cfg_off, opaque, &kernel_end); -if (err) { - ret = err; + ret =fit_load_kernel (ldr, itb, cfg_off, opaque, &kernel_end, &err); +if (ret) { +error_report_err (err); goto out; } - err =fit_load_fdt (ldr, itb, cfg_off, opaque, match_data, kernel_end); -if (err) { - ret = err; + ret =fit_load_fdt (ldr, itb, cfg_off, opaque, match_data, kernel_end, + &err); +if (ret) { +error_report_err (err); goto out; }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 36/36] include: Move fprintf_function to disas/
In reply to Markus ArmbrusterThe previous commits have eliminated fprintf_function outside disassemblers, simplifying code and cleaning up the ugly type-punning fprintf_function seems to attract. Move fprintf_function to include/disas/dis-asm.h to reduce the temptation to abuse it.
I considered renaming it to fprintf_ftype (reverting that part of commit 6e2d864edf5, v0.14.0) to get us closer to binutils, but I figure the fork is too distant to make this worthwhile.
Message-Id: <[email protected]>
--- include/disas/dis-asm.h | 5 +++-- include/qemu/fprintf-fn.h | 14 -------------- 2 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 include/qemu/fprintf-fn.h
include/disas/dis-asm.h +3 -2
@@ -9,8 +9,6 @@#ifndef DISAS_BFD_H #define DISAS_BFD_H -#include "qemu/fprintf-fn.h" -typedef void *PTR ;typedef uint64_t bfd_vma ;typedef int64_t bfd_signed_vma ;
@@ -243,6 +241,9 @@ typedef struct symbol_cache_entry } udata; } asymbol; +typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) +GCC_FMT_ATTR (2 ,3 ); +enum dis_insn_type { dis_noninsn,/* Not a valid instruction */ dis_nonbranch,/* Not a branch instruction */
include/qemu/fprintf-fn.h deleted +0 -14
@@ -1,14 +0,0 @@ -/* -* Typedef for fprintf-alike function pointers. -* -* This work is licensed under the terms of the GNU GPL, version 2 or later. -* See the COPYING file in the top-level directory. -*/ - -#ifndef QEMU_FPRINTF_FN_H -#define QEMU_FPRINTF_FN_H - -typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) -GCC_FMT_ATTR (2 ,3 ); - -#endif
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 09/36] pci: Report fatal errors with error_report(), not error_printf()
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
@@ -951,7 +951,7 @@ static uint16_t pci_req_id_cache_extract(PCIReqIDCache *cache) result =PCI_BUILD_BDF (bus_n,0 );break ;default : -error_printf ("Invalid PCI requester ID cache type: %d\n" , +error_report ("Invalid PCI requester ID cache type: %d" , cache->type);exit (1 );break ;
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 15/36] qemu-print: New qemu_printf(), qemu_vprintf() etc.
In reply to Markus ArmbrusterWe commonly want to print to the current monitor if we have one, else to stdout/stderr. For stderr, have error_printf(). For stdout, all we have is monitor_vfprintf(), which is rather unwieldy. We often print to stderr just because error_printf() is easier.
New qemu_printf() and qemu_vprintf() do exactly what's needed. The next commits will put them to use.
Message-Id: <[email protected]>
--- MAINTAINERS | 2 ++ include/qemu/qemu-print.h | 19 ++++++++++++++++++ stubs/monitor.c | 5 +++++ tests/test-util-sockets.c | 1 + util/Makefile.objs | 1 + util/qemu-print.c | 42 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+) create mode 100644 include/qemu/qemu-print.h create mode 100644 util/qemu-print.c
MAINTAINERS +2 -0
@@ -1895,6 +1895,8 @@ F: hmp.[ch] F: hmp-commands*.hx F: include/monitor/hmp-target.h F: tests/test-hmp.c +F: include/qemu/qemu-print.h +F: util/qemu-print.c Network device backends M: Jason Wang <[email protected]>
include/qemu/qemu-print.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Print to stream or current monitor +* +* Copyright (C) 2019 Red Hat Inc. +* +* Authors: +* Markus Armbruster <[email protected]>, +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#ifndef QEMU_PRINT_H +#define QEMU_PRINT_H + +int qemu_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); +int qemu_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); + +#endif
stubs/monitor.c +5 -0
@@ -6,6 +6,11 @@ __threadMonitor *cur_mon; +int monitor_vprintf (Monitor *mon,const char *fmt,va_list ap) +{ +abort (); +} +int monitor_get_fd (Monitor *mon,const char *name,Error **errp) {error_setg (errp,"only QEMU supports file descriptor passing" );
tests/test-util-sockets.c +1 -0
@@ -70,6 +70,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)* otherwise we get duplicate syms at link time. */ __threadMonitor *cur_mon; +int monitor_vprintf (Monitor *mon,const char *fmt,va_list ap) {abort (); }void monitor_init (Chardev *chr,int flags) {}
util/Makefile.objs +1 -0
@@ -23,6 +23,7 @@ util-obj-y += bitmap.o bitops.o hbitmap.o util-obj-y += fifo8.o util-obj-y += cacheinfo.o util-obj-y += error.o qemu-error.o +util-obj-y += qemu-print.o util-obj-y += id.o util-obj-y += iov.o qemu-config.o qemu-sockets.o uri.o notify.o util-obj-y += qemu-option.o qemu-progress.o
util/qemu-print.c new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 21/36] trace: Simplify how st_print_trace_file_status() prints
In reply to Markus Armbrusterst_print_trace_file_status() takes an fprintf()-like callback and a FILE * to pass to it.
Its only caller hmp_trace_file() passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
Drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- monitor.c | 2 +- trace/simple.c | 7 ++++--- trace/simple.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-)
monitor.c +1 -1
@@ -1056,7 +1056,7 @@ static void hmp_trace_file(Monitor *mon, const QDict *qdict)const char *arg =qdict_get_try_str (qdict,"arg" );if (!op) { -st_print_trace_file_status ((FILE *)mon, &monitor_fprintf); +st_print_trace_file_status (); }else if (!strcmp (op,"on" )) {st_set_trace_file_enabled (true); }else if (!strcmp (op,"off" )) {
trace/simple.c +4 -3
@@ -16,6 +16,7 @@#include "trace/control.h" #include "trace/simple.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" /** Trace file header event ID, picked to avoid conflict with real event IDs */ #define HEADER_EVENT_ID (~(uint64_t)0)
@@ -363,10 +364,10 @@ void st_set_trace_file(const char *file)st_set_trace_file_enabled (true); } -void st_print_trace_file_status (FILE *stream,int (*stream_printf)(FILE *stream,const char *fmt, ...)) +void st_print_trace_file_status (void ) { -stream_printf (stream,"Trace file \"%s\" %s.\n" , - trace_file_name, trace_fp ?"on" :"off" ); +qemu_printf ("Trace file \"%s\" %s.\n" , + trace_file_name, trace_fp ?"on" :"off" ); }void st_flush_trace_buffer (void )
trace/simple.h +1 -1
@@ -11,7 +11,7 @@#ifndef TRACE_SIMPLE_H #define TRACE_SIMPLE_H -void st_print_trace_file_status (FILE *stream,fprintf_function stream_printf); +void st_print_trace_file_status (void );void st_set_trace_file_enabled (bool enable);void st_set_trace_file (const char *file);bool st_init (void );
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 22/36] tcg: Simplify how dump_opcount_info() prints
In reply to Markus Armbrusterdump_opcount_info() takes an fprintf()-like callback and a FILE * to pass to it.
Its only caller hmp_info_opcount() passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
Drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- accel/tcg/translate-all.c | 4 ++-- include/exec/cpu-all.h | 2 +- monitor.c | 2 +- tcg/tcg.c | 9 +++++---- tcg/tcg.h | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-)
accel/tcg/translate-all.c +2 -2
@@ -2333,9 +2333,9 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf) tcg_dump_info(f, cpu_fprintf); } -void dump_opcount_info (FILE *f,fprintf_function cpu_fprintf) +void dump_opcount_info (void ) { -tcg_dump_op_count (f, cpu_fprintf); +tcg_dump_op_count (); }#else /* CONFIG_USER_ONLY */
include/exec/cpu-all.h +1 -1
@@ -363,7 +363,7 @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr) }void dump_exec_info (FILE *f,fprintf_function cpu_fprintf); -void dump_opcount_info (FILE *f,fprintf_function cpu_fprintf); +void dump_opcount_info (void );#endif /* !CONFIG_USER_ONLY */ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
monitor.c +1 -1
@@ -1324,7 +1324,7 @@ static void hmp_info_jit(Monitor *mon, const QDict *qdict)static void hmp_info_opcount (Monitor *mon,const QDict *qdict) { -dump_opcount_info ((FILE *)mon, monitor_fprintf); +dump_opcount_info (); }#endif
tcg/tcg.c +5 -4
@@ -33,6 +33,7 @@#include "qemu/error-report.h" #include "qemu/cutils.h" #include "qemu/host-utils.h" +#include "qemu/qemu-print.h" #include "qemu/timer.h" /* Note: the long term plan is to reduce the dependencies on the QEMU
@@ -3768,14 +3769,14 @@ static void tcg_profile_snapshot_table(TCGProfile *prof)tcg_profile_snapshot (prof, false, true); } -void tcg_dump_op_count (FILE *f,fprintf_function cpu_fprintf) +void tcg_dump_op_count (void ) {TCGProfile prof = {};int i;tcg_profile_snapshot_table (&prof);for (i =0 ; i <NB_OPS ; i++) { -cpu_fprintf (f,"%s %" PRId64"\n" , tcg_op_defs[i].name, +qemu_printf ("%s %" PRId64"\n" , tcg_op_defs[i].name, prof.table_op_count[i]); } }
@@ -3795,9 +3796,9 @@ int64_t tcg_cpu_exec_time(void) return ret; }#else -void tcg_dump_op_count (FILE *f,fprintf_function cpu_fprintf) +void tcg_dump_op_count (void ) { -cpu_fprintf (f,"[TCG profiler not compiled]\n" ); +qemu_printf ("[TCG profiler not compiled]\n" ); }int64_t tcg_cpu_exec_time (void )
tcg/tcg.h +1 -1
@@ -1018,7 +1018,7 @@ int tcg_check_temp_count(void);int64_t tcg_cpu_exec_time (void );void tcg_dump_info (FILE *f,fprintf_function cpu_fprintf); -void tcg_dump_op_count (FILE *f,fprintf_function cpu_fprintf); +void tcg_dump_op_count (void );#define TCG_CT_ALIAS 0x80#define TCG_CT_IALIAS 0x40
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 11/36] vfio: Report warnings with warn_report(), not error_printf()
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- hw/vfio/pci.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
hw/vfio/pci.c +13 -6
@@ -947,8 +947,10 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)if (vdev->pdev.romfile || !vdev->pdev.rom_bar) {/* Since pci handles romfile, just print a message and return */ if (vfio_blacklist_opt_rom (vdev) && vdev->pdev.romfile) { -error_printf ("Warning : Device at %s is known to cause system instability issues during option rom execution. Proceeding anyway since user specified romfile\n" , - vdev->vbasedev.name); +warn_report ("Device at %s is known to cause system instability" +" issues during option rom execution" , + vdev->vbasedev.name); +error_printf ("Proceeding anyway since user specified romfile\n" ); }return ; }
@@ -973,11 +975,16 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)if (vfio_blacklist_opt_rom (vdev)) {if (dev->opts &&qemu_opt_get (dev->opts,"rombar" )) { -error_printf ("Warning : Device at %s is known to cause system instability issues during option rom execution. Proceeding anyway since user specified non zero value for rombar\n" , - vdev->vbasedev.name); +warn_report ("Device at %s is known to cause system instability" +" issues during option rom execution" , + vdev->vbasedev.name); +error_printf ("Proceeding anyway since user specified" +" non zero value for rombar\n" ); }else { -error_printf ("Warning : Rom loading for device at %s has been disabled due to system instability issues. Specify rombar=1 or romfile to force\n" , - vdev->vbasedev.name); +warn_report ("Rom loading for device at %s has been disabled" +" due to system instability issues" , + vdev->vbasedev.name); +error_printf ("Specify rombar=1 or romfile to force\n" );return ; } }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 32/36] qemu-print: New qemu_fprintf(), qemu_vfprintf()
In reply to Markus ArmbrusterCode that doesn't want to know about current monitor vs. stdout vs. stderr takes an fprintf_function callback and a FILE * argument to pass to it. Actual arguments are either fprintf() and stdout or stderr, or monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
New qemu_fprintf() and qemu_vprintf() address this need without type
punning: they are like fprintf() and vfprintf(), except they print to the current monitor when passed a null FILE *. The next commits will put them to use.
Message-Id: <[email protected]>
--- include/qemu/qemu-print.h | 4 ++++ util/qemu-print.c | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
include/qemu/qemu-print.h +4 -0
@@ -16,4 +16,8 @@ int qemu_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0); int qemu_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2); +int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) + GCC_FMT_ATTR(2, 0); +int qemu_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +#endif
util/qemu-print.c +27 -0
@@ -40,3 +40,30 @@ int qemu_printf(const char *fmt, ...)va_end (ap);return ret; } + +/* +* Print like vfprintf() +* Print to @stream if non-null, else to current monitor. +*/ +int qemu_vfprintf (FILE *stream,const char *fmt,va_list ap) +{ +if (!stream) { +return monitor_vprintf (cur_mon, fmt, ap); + } +return vfprintf (stream, fmt, ap); +} + +/* +* Print like fprintf(). +* Print to @stream if non-null, else to current monitor. +*/ +int qemu_fprintf (FILE *stream,const char *fmt, ...) +{ +va_list ap; +int ret; + +va_start (ap, fmt); + ret =qemu_vfprintf (stream, fmt, ap); +va_end (ap); +return ret; +}
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 10/36] hpet: Report warnings with warn_report(), not error_printf()
In reply to Markus ArmbrusterMessage-Id: <[email protected]>
--- hw/timer/hpet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/timer/hpet.c +1 -1
@@ -744,7 +744,7 @@ static void hpet_realize(DeviceState *dev, Error **errp)HPETTimer *timer;if (!s->intcap) { -error_printf ("Hpet's intcap not initialized.\n" ); +warn_report ("Hpet's intcap not initialized" ); }if (hpet_cfg.count ==UINT8_MAX ) {/* first instance */
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 19/36] monitor: Simplify how -device/device_add print help
In reply to Markus ArmbrusterCommit a95db58f210 added monitor_vfprintf() as an error_printf() generalized from stderr to arbitrary streams, then used it wrapped in helper out_printf() to print -device/device_add help to stdout. Use qemu_printf() instead, and delete monitor_vfprintf() and out_printf().
Message-Id: <[email protected]>
--- include/monitor/monitor.h | 3 --- monitor.c | 16 ++++------------ qdev-monitor.c | 36 ++++++++++++++---------------------- 3 files changed, 18 insertions(+), 37 deletions(-)
include/monitor/monitor.h +0 -3
@@ -48,7 +48,4 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);void monitor_fdset_dup_fd_remove (int dup_fd);int monitor_fdset_dup_fd_find (int dup_fd); -int monitor_vfprintf(FILE *stream, - const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); -#endif /* MONITOR_H */
monitor.c +4 -12
@@ -4541,23 +4541,15 @@ static void monitor_readline_flush(void *opaque)monitor_flush (opaque); } -/* -* Print to current monitor if we have one, else to stream. -*/ -int monitor_vfprintf (FILE *stream,const char *fmt,va_list ap) -{ -if (cur_mon && !monitor_cur_is_qmp ()) { -return monitor_vprintf (cur_mon, fmt, ap); - } -return vfprintf (stream, fmt, ap); -} -/* * Print to current monitor if we have one, else to stderr. */ int error_vprintf (const char *fmt,va_list ap) { -return monitor_vfprintf (stderr, fmt, ap); +if (cur_mon && !monitor_cur_is_qmp ()) { +return monitor_vprintf (cur_mon, fmt, ap); + } +return vfprintf (stderr, fmt, ap); }int error_vprintf_unless_qmp (const char *fmt,va_list ap)
qdev-monitor.c +14 -22
@@ -31,6 +31,7 @@#include "qemu/error-report.h" #include "qemu/help_option.h" #include "qemu/option.h" +#include "qemu/qemu-print.h" #include "sysemu/block-backend.h" #include "migration/misc.h"
@@ -104,31 +105,22 @@ static bool qdev_class_has_alias(DeviceClass *dc)return (qdev_class_get_alias (dc) !=NULL ); } -static void out_printf (const char *fmt, ...) -{ -va_list ap; - -va_start (ap, fmt); -monitor_vfprintf (stdout, fmt, ap); -va_end (ap); -} -static void qdev_print_devinfo (DeviceClass *dc) { -out_printf ("name \"%s\"" ,object_class_get_name (OBJECT_CLASS (dc))); +qemu_printf ("name \"%s\"" ,object_class_get_name (OBJECT_CLASS (dc)));if (dc->bus_type) { -out_printf (", bus %s" , dc->bus_type); +qemu_printf (", bus %s" , dc->bus_type); }if (qdev_class_has_alias (dc)) { -out_printf (", alias \"%s\"" ,qdev_class_get_alias (dc)); +qemu_printf (", alias \"%s\"" ,qdev_class_get_alias (dc)); }if (dc->desc) { -out_printf (", desc \"%s\"" , dc->desc); +qemu_printf (", desc \"%s\"" , dc->desc); }if (!dc->user_creatable) { -out_printf (", no-user" ); +qemu_printf (", no-user" ); } -out_printf ("\n" ); +qemu_printf ("\n" ); }static void qdev_print_devinfos (bool show_no_user)
@@ -164,7 +156,7 @@ static void qdev_print_devinfos(bool show_no_user)continue ; }if (!cat_printed) { -out_printf ("%s%s devices:\n" , i ?"\n" :"" , cat_name[i]); +qemu_printf ("%s%s devices:\n" , i ?"\n" :"" , cat_name[i]); cat_printed = true; }qdev_print_devinfo (dc);
@@ -286,20 +278,20 @@ int qdev_device_help(QemuOpts *opts) }if (prop_list) { -out_printf ("%s options:\n" , driver); +qemu_printf ("%s options:\n" , driver); }else { -out_printf ("There are no options for %s.\n" , driver); +qemu_printf ("There are no options for %s.\n" , driver); }for (prop = prop_list; prop; prop = prop->next) {int len; -out_printf (" %s=<%s>%n" , prop->value->name, prop->value->type, &len); +qemu_printf (" %s=<%s>%n" , prop->value->name, prop->value->type, &len);if (prop->value->has_description) {if (len <24 ) { -out_printf ("%*s" ,24 - len,"" ); +qemu_printf ("%*s" ,24 - len,"" ); } -out_printf (" - %s\n" , prop->value->description); +qemu_printf (" - %s\n" , prop->value->description); }else { -out_printf ("\n" ); +qemu_printf ("\n" ); } }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 30/36] target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
In reply to Markus Armbrusterx86_cpu_dump_local_apic_state() takes an fprintf()-like callback and a FILE * to pass to it, and so do its helper functions.
Its only caller hmp_info_local_apic() passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
Drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- target/i386/cpu.h | 3 +- target/i386/helper.c | 79 ++++++++++++++++++++----------------------- target/i386/monitor.c | 3 +- 3 files changed, 39 insertions(+), 46 deletions(-)
target/i386/cpu.h +1 -2
@@ -1924,8 +1924,7 @@ void enable_compat_apic_id_mode(void);#define APIC_DEFAULT_ADDRESS 0xfee00000#define APIC_SPACE_SIZE 0x100000 -void x86_cpu_dump_local_apic_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags); +void x86_cpu_dump_local_apic_state (CPUState *cs,int flags);/* cpu.c */ bool cpu_is_bsp (X86CPU *cpu);
target/i386/helper.c +37 -42
184 lines not on this page · raw message
target/i386/monitor.c +1 -2
@@ -664,8 +664,7 @@ void hmp_info_local_apic(Monitor *mon, const QDict *qdict)monitor_printf (mon,"No CPU available\n" );return ; } -x86_cpu_dump_local_apic_state (cs, (FILE *)mon, monitor_fprintf, -CPU_DUMP_FPU ); +x86_cpu_dump_local_apic_state (cs,CPU_DUMP_FPU ); }void hmp_info_io_apic (Monitor *mon,const QDict *qdict)
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 34/36] monitor: Clean up how monitor_disas() funnels output to monitor
In reply to Markus ArmbrusterINIT_DISASSEMBLE_INFO() takes an fprintf()-like callback and a FILE * to pass to it. monitor_disas() passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
Pass qemu_fprintf() and NULL instead.
monitor_fprintf() is now unused; delete it.
Message-Id: <[email protected]> [Commit message typo corrected]
--- disas.c | 3 ++- include/monitor/monitor.h | 1 - monitor.c | 11 ----------- 3 files changed, 2 insertions(+), 13 deletions(-)
disas.c +2 -1
@@ -3,6 +3,7 @@#include "qemu-common.h" #include "disas/bfd.h" #include "elf.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "disas/disas.h"
@@ -609,7 +610,7 @@ void monitor_disas(Monitor *mon, CPUState *cpu,int count, i;CPUDebug s; -INIT_DISASSEMBLE_INFO (s.info, (FILE *)mon, monitor_fprintf); +INIT_DISASSEMBLE_INFO (s.info,NULL , qemu_fprintf); s.cpu = cpu; s.info.read_memory_func
include/monitor/monitor.h +0 -1
@@ -31,7 +31,6 @@ int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp); int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); int monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -int monitor_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);void monitor_flush (Monitor *mon);int monitor_set_cpu (int cpu_index);int monitor_get_cpu_index (void );
monitor.c +0 -11
@@ -480,17 +480,6 @@ int monitor_printf(Monitor *mon, const char *fmt, ...)return ret; } -int monitor_fprintf (FILE *stream,const char *fmt, ...) -{ -int ret; - -va_list ap; -va_start (ap, fmt); - ret =monitor_vprintf ((Monitor *)stream, fmt, ap); -va_end (ap); -return ret; -} -static void qmp_send_response (Monitor *mon,const QDict *rsp) {const QObject *data =QOBJECT (rsp);
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 23/36] tcg: Simplify how dump_exec_info() prints
In reply to Markus Armbrusterdump_exec_info() takes an fprintf()-like callback and a FILE * to pass to it.
Its only caller hmp_info_jit() passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
Drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- accel/tcg/translate-all.c | 45 ++++++++++++++++++++------------------- include/exec/cpu-all.h | 2 +- monitor.c | 2 +- tcg/tcg.c | 41 ++++++++++++++++++----------------- tcg/tcg.h | 2 +- 5 files changed, 47 insertions(+), 45 deletions(-)
accel/tcg/translate-all.c +23 -22
@@ -50,6 +50,7 @@#include "translate-all.h" #include "qemu/bitmap.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "qemu/timer.h" #include "qemu/main-loop.h" #include "exec/log.h"
@@ -2214,8 +2215,7 @@ void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr)tb_jmp_cache_clear_page (cpu, addr); } -static void print_qht_statistics (FILE *f,fprintf_function cpu_fprintf, -struct qht_stats hst) +static void print_qht_statistics (struct qht_stats hst) {uint32_t hgram_opts;size_t hgram_bins;
@@ -2224,7 +2224,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,if (!hst.head_buckets) {return ; } -cpu_fprintf (f,"TB hash buckets %zu/%zu (%0.2f%% head buckets used)\n" , +qemu_printf ("TB hash buckets %zu/%zu (%0.2f%% head buckets used)\n" , hst.used_head_buckets, hst.head_buckets, (double )hst.used_head_buckets / hst.head_buckets *100 );
@@ -2234,7 +2234,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf, hgram_opts |=QDIST_PR_NODECIMAL ; } hgram =qdist_pr (&hst.occupancy,10 , hgram_opts); -cpu_fprintf (f,"TB hash occupancy %0.2f%% avg chain occ. Histogram: %s\n" , +qemu_printf ("TB hash occupancy %0.2f%% avg chain occ. Histogram: %s\n" ,qdist_avg (&hst.occupancy) *100 , hgram);g_free (hgram);
@@ -2247,7 +2247,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf, hgram_opts |=QDIST_PR_NODECIMAL |QDIST_PR_NOBINRANGE ; } hgram =qdist_pr (&hst.chain, hgram_bins, hgram_opts); -cpu_fprintf (f,"TB hash avg chain %0.3f buckets. Histogram: %s\n" , +qemu_printf ("TB hash avg chain %0.3f buckets. Histogram: %s\n" ,qdist_avg (&hst.chain), hgram);g_free (hgram); }
@@ -2285,7 +2285,7 @@ static gboolean tb_tree_stats_iter(gpointer key, gpointer value, gpointer data)return false; } -void dump_exec_info (FILE *f,fprintf_function cpu_fprintf) +void dump_exec_info (void ) {struct tb_tree_stats tst = {};struct qht_stats hst;
@@ -2294,43 +2294,44 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)tcg_tb_foreach (tb_tree_stats_iter, &tst); nb_tbs = tst.nb_tbs;/* XXX: avoid using doubles ? */ -cpu_fprintf (f,"Translation buffer state:\n" ); +qemu_printf ("Translation buffer state:\n" );/* * Report total code size including the padding and TB structs; * otherwise users might think "-tb-size" is not honoured. * For avg host size we use the precise numbers from tb_tree_stats though. */ -cpu_fprintf (f,"gen code size %zu/%zu\n" , +qemu_printf ("gen code size %zu/%zu\n" ,tcg_code_size (),tcg_code_capacity ()); -cpu_fprintf (f,"TB count %zu\n" , nb_tbs); -cpu_fprintf (f,"TB avg target size %zu max=%zu bytes\n" , +qemu_printf ("TB count %zu\n" , nb_tbs); +qemu_printf ("TB avg target size %zu max=%zu bytes\n" , nb_tbs ? tst.target_size / nb_tbs :0 , tst.max_target_size); -cpu_fprintf (f,"TB avg host size %zu bytes (expansion ratio: %0.1f)\n" , +qemu_printf ("TB avg host size %zu bytes (expansion ratio: %0.1f)\n" , nb_tbs ? tst.host_size / nb_tbs :0 , tst.target_size ? (double )tst.host_size / tst.target_size :0 ); -cpu_fprintf (f,"cross page TB count %zu (%zu%%)\n" , tst.cross_page, - nb_tbs ? (tst.cross_page *100 ) / nb_tbs :0 ); -cpu_fprintf (f,"direct jump count %zu (%zu%%) (2 jumps=%zu %zu%%)\n" , +qemu_printf ("cross page TB count %zu (%zu%%)\n" , tst.cross_page, + nb_tbs ? (tst.cross_page *100 ) / nb_tbs :0 ); +qemu_printf ("direct jump count %zu (%zu%%) (2 jumps=%zu %zu%%)\n" , tst.direct_jmp_count, nb_tbs ? (tst.direct_jmp_count *100 ) / nb_tbs :0 , tst.direct_jmp2_count, nb_tbs ? (tst.direct_jmp2_count *100 ) / nb_tbs :0 );qht_statistics_init (&tb_ctx.htable, &hst); -print_qht_statistics (f, cpu_fprintf, hst); +print_qht_statistics (hst);qht_statistics_destroy (&hst); -cpu_fprintf (f,"\nStatistics:\n" ); -cpu_fprintf (f,"TB flush count %u\n" , +qemu_printf ("\nStatistics:\n" ); +qemu_printf ("TB flush count %u\n" ,atomic_read (&tb_ctx.tb_flush_count)); -cpu_fprintf (f,"TB invalidate count %zu\n" ,tcg_tb_phys_invalidate_count ()); +qemu_printf ("TB invalidate count %zu\n" , +tcg_tb_phys_invalidate_count ());tlb_flush_counts (&flush_full, &flush_part, &flush_elide); -cpu_fprintf (f,"TLB full flushes %zu\n" , flush_full); -cpu_fprintf (f,"TLB partial flushes %zu\n" , flush_part); -cpu_fprintf (f,"TLB elided flushes %zu\n" , flush_elide); -tcg_dump_info (f, cpu_fprintf); +qemu_printf ("TLB full flushes %zu\n" , flush_full); +qemu_printf ("TLB partial flushes %zu\n" , flush_part); +qemu_printf ("TLB elided flushes %zu\n" , flush_elide); +tcg_dump_info (); }void dump_opcount_info (void )
include/exec/cpu-all.h +1 -1
@@ -362,7 +362,7 @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr) return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK); } -void dump_exec_info (FILE *f,fprintf_function cpu_fprintf); +void dump_exec_info (void );void dump_opcount_info (void );#endif /* !CONFIG_USER_ONLY */
monitor.c +1 -1
@@ -1318,7 +1318,7 @@ static void hmp_info_jit(Monitor *mon, const QDict *qdict)return ; } -dump_exec_info ((FILE *)mon, monitor_fprintf); +dump_exec_info ();dump_drift_info ((FILE *)mon, monitor_fprintf); }
tcg/tcg.c +21 -20
80 lines not on this page · raw message
tcg/tcg.h +1 -1
@@ -1017,7 +1017,7 @@ int tcg_check_temp_count(void);#endif int64_t tcg_cpu_exec_time (void ); -void tcg_dump_info (FILE *f,fprintf_function cpu_fprintf); +void tcg_dump_info (void );void tcg_dump_op_count (void );#define TCG_CT_ALIAS 0x80
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 26/36] block/qapi: Clean up how we print to monitor or stdout
In reply to Markus Armbrusterbdrv_snapshot_dump(), bdrv_image_info_specific_dump(), bdrv_image_info_dump() and their helpers take an fprintf()-like callback and a FILE * to pass to it.
hmp.c passes monitor_printf() cast to fprintf_function and the current monitor cast to FILE *.
qemu-img.c and qemu-io-cmds.c pass fprintf and stdout.
The type-punning is technically undefined behaviour, but works in practice. Clean up: drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- block/qapi.c | 120 ++++++++++++++++++++----------------------- hmp.c | 12 ++--- include/block/qapi.h | 10 ++-- qemu-img.c | 6 +-- qemu-io-cmds.c | 2 +- 5 files changed, 67 insertions(+), 83 deletions(-)
block/qapi.c +55 -65
@@ -36,6 +36,7 @@#include "qapi/qmp/qlist.h" #include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" +#include "qemu/qemu-print.h" #include "sysemu/block-backend.h" #include "qemu/cutils.h"
@@ -660,8 +661,7 @@ static char *get_human_readable_size(char *buf, int buf_size, int64_t size)return buf; } -void bdrv_snapshot_dump (fprintf_function func_fprintf,void *f, -QEMUSnapshotInfo *sn) +void bdrv_snapshot_dump (QEMUSnapshotInfo *sn) {char buf1[128 ], date_buf[128 ], clock_buf[128 ];struct tm tm;
@@ -669,9 +669,8 @@ void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,int64_t secs;if (!sn) { -func_fprintf (f, -"%-10s%-20s%7s%20s%15s" , -"ID" ,"TAG" ,"VM SIZE" ,"DATE" ,"VM CLOCK" ); +qemu_printf ("%-10s%-20s%7s%20s%15s" , +"ID" ,"TAG" ,"VM SIZE" ,"DATE" ,"VM CLOCK" ); }else { ti = sn->date_sec;localtime_r (&ti, &tm);
@@ -684,50 +683,46 @@ void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f, (int )((secs /60 ) %60 ), (int )(secs %60 ), (int)((sn->vm_clock_nsec / 1000000) % 1000)); -func_fprintf (f, -"%-10s%-20s%7s%20s%15s" , - sn->id_str, sn->name, -get_human_readable_size (buf1,sizeof (buf1), - sn->vm_state_size), - date_buf, - clock_buf); +qemu_printf ("%-10s%-20s%7s%20s%15s" , + sn->id_str, sn->name, +get_human_readable_size (buf1,sizeof (buf1), + sn->vm_state_size), + date_buf, + clock_buf); } } -static void dump_qdict (fprintf_function func_fprintf,void *f,int indentation, -QDict *dict); -static void dump_qlist (fprintf_function func_fprintf,void *f,int indentation, -QList *list); +static void dump_qdict (int indentation,QDict *dict); +static void dump_qlist (int indentation,QList *list); -static void dump_qobject (fprintf_function func_fprintf,void *f, -int comp_indent,QObject *obj) +static void dump_qobject (int comp_indent,QObject *obj) {switch (qobject_type (obj)) {case QTYPE_QNUM : {QNum *value =qobject_to (QNum, obj);char *tmp =qnum_to_string (value); -func_fprintf (f,"%s" , tmp); +qemu_printf ("%s" , tmp);g_free (tmp);break ; }case QTYPE_QSTRING : {QString *value =qobject_to (QString, obj); -func_fprintf (f,"%s" ,qstring_get_str (value)); +qemu_printf ("%s" ,qstring_get_str (value));break ; }case QTYPE_QDICT : {QDict *value =qobject_to (QDict, obj); -dump_qdict (func_fprintf, f, comp_indent, value); +dump_qdict (comp_indent, value);break ; }case QTYPE_QLIST : {QList *value =qobject_to (QList, obj); -dump_qlist (func_fprintf, f, comp_indent, value); +dump_qlist (comp_indent, value);break ; }case QTYPE_QBOOL : {QBool *value =qobject_to (QBool, obj); -func_fprintf (f,"%s" ,qbool_get_bool (value) ?"true" :"false" ); +qemu_printf ("%s" ,qbool_get_bool (value) ?"true" :"false" );break ; }default :
@@ -735,8 +730,7 @@ static void dump_qobject(fprintf_function func_fprintf, void *f, } } -static void dump_qlist (fprintf_function func_fprintf,void *f,int indentation, -QList *list) +static void dump_qlist (int indentation,QList *list) {const QListEntry *entry;int i =0 ;
@@ -744,17 +738,16 @@ static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,for (entry =qlist_first (list); entry; entry =qlist_next (entry), i++) {QType type =qobject_type (entry->value);bool composite = (type ==QTYPE_QDICT || type ==QTYPE_QLIST ); -func_fprintf (f,"%*s[%i]:%c" , indentation *4 ,"" , i, - composite ?'\n' :' ' ); -dump_qobject (func_fprintf, f, indentation +1 , entry->value); +qemu_printf ("%*s[%i]:%c" , indentation *4 ,"" , i, + composite ?'\n' :' ' ); +dump_qobject (indentation +1 , entry->value);if (!composite) { -func_fprintf (f,"\n" ); +qemu_printf ("\n" ); } } } -static void dump_qdict (fprintf_function func_fprintf,void *f,int indentation, -QDict *dict) +static void dump_qdict (int indentation,QDict *dict) {const QDictEntry *entry;
@@ -769,18 +762,17 @@ static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation, key[i] = entry->key[i] =='-' ?' ' : entry->key[i]; } key[i] =0 ; -func_fprintf (f,"%*s%s:%c" , indentation *4 ,"" , key, - composite ?'\n' :' ' ); -dump_qobject (func_fprintf, f, indentation +1 , entry->value); +qemu_printf ("%*s%s:%c" , indentation *4 ,"" , key, + composite ?'\n' :' ' ); +dump_qobject (indentation +1 , entry->value);if (!composite) { -func_fprintf (f,"\n" ); +qemu_printf ("\n" ); }g_free (key); } } -void bdrv_image_info_specific_dump (fprintf_function func_fprintf,void *f, -ImageInfoSpecific *info_spec) +void bdrv_image_info_specific_dump (ImageInfoSpecific *info_spec) {QObject *obj, *data;Visitor *v =qobject_output_visitor_new (&obj);
@@ -788,13 +780,12 @@ void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,visit_type_ImageInfoSpecific (v,NULL , &info_spec, &error_abort);visit_complete (v, &obj); data =qdict_get (qobject_to (QDict, obj),"data" ); -dump_qobject (func_fprintf, f,1 , data); +dump_qobject (1 , data);qobject_unref (obj);visit_free (v); } -void bdrv_image_info_dump (fprintf_function func_fprintf,void *f, -ImageInfo *info) +void bdrv_image_info_dump (ImageInfo *info) {char size_buf[128 ], dsize_buf[128 ];if (!info->has_actual_size) {
@@ -804,49 +795,48 @@ void bdrv_image_info_dump(fprintf_function func_fprintf, void *f, info->actual_size); }get_human_readable_size (size_buf,sizeof (size_buf), info->virtual_size); -func_fprintf (f, -"image: %s\n" -"file format: %s\n" -"virtual size: %s (%" PRId64" bytes)\n" -"disk size: %s\n" , - info->filename, info->format, size_buf, - info->virtual_size, - dsize_buf); +qemu_printf ("image: %s\n" +"file format: %s\n" +"virtual size: %s (%" PRId64" bytes)\n" +"disk size: %s\n" , + info->filename, info->format, size_buf, + info->virtual_size, + dsize_buf);if (info->has_encrypted && info->encrypted) { -func_fprintf (f,"encrypted: yes\n" ); +qemu_printf ("encrypted: yes\n" ); }if (info->has_cluster_size) { -func_fprintf (f,"cluster_size: %" PRId64"\n" , - info->cluster_size); +qemu_printf ("cluster_size: %" PRId64"\n" , + info->cluster_size); }if (info->has_dirty_flag && info->dirty_flag) { -func_fprintf (f,"cleanly shut down: no\n" ); +qemu_printf ("cleanly shut down: no\n" ); }if (info->has_backing_filename) { -func_fprintf (f,"backing file: %s" , info->backing_filename); +qemu_printf ("backing file: %s" , info->backing_filename);if (!info->has_full_backing_filename) { -func_fprintf (f," (cannot determine actual path)" ); +qemu_printf (" (cannot determine actual path)" ); }else if (strcmp (info->backing_filename, info->full_backing_filename) !=0 ) { -func_fprintf (f," (actual path: %s)" , info->full_backing_filename); +qemu_printf (" (actual path: %s)" , info->full_backing_filename); } -func_fprintf (f,"\n" ); +qemu_printf ("\n" );if (info->has_backing_filename_format) { -func_fprintf (f,"backing file format: %s\n" , - info->backing_filename_format); +qemu_printf ("backing file format: %s\n" , + info->backing_filename_format); } }if (info->has_snapshots) {SnapshotInfoList *elem; -func_fprintf (f,"Snapshot list:\n" ); -bdrv_snapshot_dump (func_fprintf, f,NULL ); -func_fprintf (f,"\n" ); +qemu_printf ("Snapshot list:\n" ); +bdrv_snapshot_dump (NULL ); +qemu_printf ("\n" );/* Ideally bdrv_snapshot_dump() would operate on SnapshotInfoList but * we convert to the block layer's native QEMUSnapshotInfo for now.
@@ -862,13 +852,13 @@ void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,pstrcpy (sn.id_str,sizeof (sn.id_str), elem->value->id);pstrcpy (sn.name,sizeof (sn.name), elem->value->name); -bdrv_snapshot_dump (func_fprintf, f, &sn); -func_fprintf (f,"\n" ); +bdrv_snapshot_dump (&sn); +qemu_printf ("\n" ); } }if (info->has_format_specific) { -func_fprintf (f,"Format specific information:\n" ); -bdrv_image_info_specific_dump (func_fprintf, f, info->format_specific); +qemu_printf ("Format specific information:\n" ); +bdrv_image_info_specific_dump (info->format_specific); } }
hmp.c +5 -7
@@ -580,8 +580,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,monitor_printf (mon,"\nImages:\n" ); image_info = inserted->image;while (1 ) { -bdrv_image_info_dump ((fprintf_function )monitor_printf, - mon, image_info); +bdrv_image_info_dump (image_info);if (image_info->has_backing_image) { image_info = image_info->backing_image; }else {
@@ -1586,7 +1585,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)monitor_printf (mon,"List of snapshots present on all disks:\n" );if (total >0 ) { -bdrv_snapshot_dump ((fprintf_function )monitor_printf, mon,NULL ); +bdrv_snapshot_dump (NULL );monitor_printf (mon,"\n" );for (i =0 ; i < total; i++) { sn = &sn_tab[global_snapshots[i]];
@@ -1594,7 +1593,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)* overwrite it. */ pstrcpy (sn->id_str,sizeof (sn->id_str),"--" ); -bdrv_snapshot_dump ((fprintf_function )monitor_printf, mon, sn); +bdrv_snapshot_dump (sn);monitor_printf (mon,"\n" ); } }else {
@@ -1608,11 +1607,10 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)monitor_printf (mon,"\nList of partial (non-loadable) snapshots on '%s':\n" , image_entry->imagename); -bdrv_snapshot_dump ((fprintf_function )monitor_printf, mon,NULL ); +bdrv_snapshot_dump (NULL );monitor_printf (mon,"\n" ); QTAILQ_FOREACH(snapshot_entry, &image_entry->snapshots, next) { -bdrv_snapshot_dump ((fprintf_function )monitor_printf, mon, - &snapshot_entry->sn); +bdrv_snapshot_dump (&snapshot_entry->sn);monitor_printf (mon,"\n" ); } }
include/block/qapi.h +3 -7
@@ -27,7 +27,6 @@#include "block/block.h" #include "block/snapshot.h" -#include "qemu/fprintf-fn.h" BlockDeviceInfo *bdrv_block_device_info (BlockBackend *blk,BlockDriverState *bs,Error **errp);
@@ -38,10 +37,7 @@ void bdrv_query_image_info(BlockDriverState *bs, ImageInfo **p_info, Error **errp); -void bdrv_snapshot_dump (fprintf_function func_fprintf,void *f, -QEMUSnapshotInfo *sn); -void bdrv_image_info_specific_dump (fprintf_function func_fprintf,void *f, -ImageInfoSpecific *info_spec); -void bdrv_image_info_dump (fprintf_function func_fprintf,void *f, -ImageInfo *info); +void bdrv_snapshot_dump (QEMUSnapshotInfo *sn); +void bdrv_image_info_specific_dump (ImageInfoSpecific *info_spec); +void bdrv_image_info_dump (ImageInfo *info);#endif
qemu-img.c +3 -3
@@ -2483,11 +2483,11 @@ static void dump_snapshots(BlockDriverState *bs)if (nb_sns <=0 )return ;printf ("Snapshot list:\n" ); -bdrv_snapshot_dump (fprintf, stdout,NULL ); +bdrv_snapshot_dump (NULL );printf ("\n" );for (i =0 ; i < nb_sns; i++) { sn = &sn_tab[i]; -bdrv_snapshot_dump (fprintf, stdout, sn); +bdrv_snapshot_dump (sn);printf ("\n" ); }g_free (sn_tab);
@@ -2536,7 +2536,7 @@ static void dump_human_image_info_list(ImageInfoList *list) } delim = true; -bdrv_image_info_dump (fprintf, stdout, elem->value); +bdrv_image_info_dump (elem->value); } }
qemu-io-cmds.c +1 -1
@@ -1699,7 +1699,7 @@ static int info_f(BlockBackend *blk, int argc, char **argv) }if (spec_info) {printf ("Format specific information:\n" ); -bdrv_image_info_specific_dump (fprintf, stdout, spec_info); +bdrv_image_info_specific_dump (spec_info);qapi_free_ImageInfoSpecific (spec_info); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 27/36] memory: Clean up how mtree_info() prints
In reply to Markus Armbrustermtree_info() takes an fprintf()-like callback and a FILE * to pass to it, and so do its helper functions. Passing around callback and argument is rather tiresome.
Its only caller hmp_info_mtree() passes monitor_printf() cast to fprintf_function and the current monitor cast to FILE *.
The type-punning is technically undefined behaviour, but works in practice. Clean up: drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- exec.c | 40 ++++----- include/exec/memory-internal.h | 3 +- include/exec/memory.h | 3 +- memory.c | 156 ++++++++++++++++----------------- monitor.c | 3 +- 5 files changed, 98 insertions(+), 107 deletions(-)
exec.c +20 -20
@@ -35,6 +35,7 @@#include "qemu/timer.h" #include "qemu/config-file.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #if defined(CONFIG_USER_ONLY )#include "qemu.h" #else /* !CONFIG_USER_ONLY */
@@ -4117,42 +4118,41 @@ void page_size_init(void)#if !defined(CONFIG_USER_ONLY ) -static void mtree_print_phys_entries (fprintf_function mon,void *f, -int start,int end,int skip,int ptr) +static void mtree_print_phys_entries (int start,int end,int skip,int ptr) {if (start == end -1 ) { -mon (f,"\t%3d " , start); +qemu_printf ("\t%3d " , start); }else { -mon (f,"\t%3d..%-3d " , start, end -1 ); +qemu_printf ("\t%3d..%-3d " , start, end -1 ); } -mon (f," skip=%d " , skip); +qemu_printf (" skip=%d " , skip);if (ptr ==PHYS_MAP_NODE_NIL ) { -mon (f," ptr=NIL" ); +qemu_printf (" ptr=NIL" ); }else if (!skip) { -mon (f," ptr=#%d" , ptr); +qemu_printf (" ptr=#%d" , ptr); }else { -mon (f," ptr=[%d]" , ptr); +qemu_printf (" ptr=[%d]" , ptr); } -mon (f,"\n" ); +qemu_printf ("\n" ); }#define MR_SIZE (size) (int128_nz(size) ? (hwaddr)int128_get64( \ int128_sub((size), int128_one())) : 0) -void mtree_print_dispatch (fprintf_function mon,void *f, -AddressSpaceDispatch *d,MemoryRegion *root) +void mtree_print_dispatch (AddressSpaceDispatch *d,MemoryRegion *root) {int i; -mon (f," Dispatch\n" ); -mon (f," Physical sections\n" ); +qemu_printf (" Dispatch\n" ); +qemu_printf (" Physical sections\n" );for (i =0 ; i < d->map.sections_nb; ++i) {MemoryRegionSection *s = d->map.sections + i;const char *names[] = {" [unassigned]" ," [not dirty]" ," [ROM]" ," [watch]" }; - mon(f, " #%d @" TARGET_FMT_plx ".." TARGET_FMT_plx " %s%s%s%s%s", + qemu_printf(" #%d @" TARGET_FMT_plx ".." TARGET_FMT_plx + " %s%s%s%s%s", i, s->offset_within_address_space, s->offset_within_address_space + MR_SIZE(s->mr->size),
@@ -4163,20 +4163,20 @@ void mtree_print_dispatch(fprintf_function mon, void *f, s->mr->is_iommu ? " [iommu]" : "");if (s->mr->alias) { -mon (f," alias=%s" , s->mr->alias->name ? +qemu_printf (" alias=%s" , s->mr->alias->name ? s->mr->alias->name :"noname" ); } -mon (f,"\n" ); +qemu_printf ("\n" ); } -mon (f," Nodes (%d bits per level, %d levels) ptr=[%d] skip=%d\n" , +qemu_printf (" Nodes (%d bits per level, %d levels) ptr=[%d] skip=%d\n" ,P_L2_BITS ,P_L2_LEVELS , d->phys_map.ptr, d->phys_map.skip);for (i =0 ; i < d->map.nodes_nb; ++i) {int j, jprev;PhysPageEntry prev;Node *n = d->map.nodes + i; -mon (f," [%d]\n" , i); +qemu_printf (" [%d]\n" , i);for (j =0 , jprev =0 , prev = *n[0 ]; j <ARRAY_SIZE (*n); ++j) {PhysPageEntry *pe = *n + j;
@@ -4185,14 +4185,14 @@ void mtree_print_dispatch(fprintf_function mon, void *f,continue ; } -mtree_print_phys_entries (mon, f, jprev, j, prev.skip, prev.ptr); +mtree_print_phys_entries (jprev, j, prev.skip, prev.ptr); jprev = j; prev = *pe; }if (jprev !=ARRAY_SIZE (*n)) { -mtree_print_phys_entries (mon, f, jprev, j, prev.skip, prev.ptr); +mtree_print_phys_entries (jprev, j, prev.skip, prev.ptr); } } }
include/exec/memory-internal.h +1 -2
@@ -45,8 +45,7 @@ AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv);void address_space_dispatch_compact (AddressSpaceDispatch *d);void address_space_dispatch_free (AddressSpaceDispatch *d); -void mtree_print_dispatch (fprintf_function mon,void *f, -struct AddressSpaceDispatch *d, +void mtree_print_dispatch (struct AddressSpaceDispatch *d,MemoryRegion *root);struct page_collection ;
include/exec/memory.h +1 -2
@@ -1720,8 +1720,7 @@ void memory_global_dirty_log_start(void);*/ void memory_global_dirty_log_stop (void ); -void mtree_info (fprintf_function mon_printf,void *f,bool flatview, -bool dispatch_tree,bool owner); +void mtree_info (bool flatview,bool dispatch_tree,bool owner);/** * memory_region_dispatch_read: perform a read directly to the specified
memory.c +75 -81
293 lines not on this page · raw message
monitor.c +1 -2
@@ -1907,8 +1907,7 @@ static void hmp_info_mtree(Monitor *mon, const QDict *qdict)bool dispatch_tree =qdict_get_try_bool (qdict,"dispatch_tree" , false);bool owner =qdict_get_try_bool (qdict,"owner" , false); -mtree_info ((fprintf_function )monitor_printf, mon, flatview, dispatch_tree, - owner); +mtree_info (flatview, dispatch_tree, owner); }static void hmp_info_numa (Monitor *mon,const QDict *qdict)
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 05/36] qemu-img: Use error_vreport() in error_exit()
In reply to Markus Armbrustererror_exit() uses low-level error_printf() to report errors. Modernize it to use error_vreport().
Message-Id: <[email protected]>
--- qemu-img.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
qemu-img.c +2 -4
@@ -85,13 +85,11 @@ static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit(const char *fmt, ...) {va_list ap; -error_printf ("qemu-img: " ); -va_start (ap, fmt); -error_vprintf (fmt, ap); +error_vreport (fmt, ap);va_end (ap); -error_printf ("\nTry 'qemu-img --help' for more information\n" ); +error_printf ("Try 'qemu-img --help' for more information\n" );exit (EXIT_FAILURE ); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 17/36] char: Make -chardev help print to stdout
In reply to Markus ArmbrusterCommand line help explicitly requested by the user should be printed to stdout, not stderr. We do elsewhere. Adjust -chardev to match:
use qemu_printf() instead of error_printf(). Plain printf() would be wrong because we need to print to the current monitor for "chardev-add help".
Message-Id: <[email protected]>
--- chardev/char.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
chardev/char.c +2 -1
@@ -28,6 +28,7 @@#include "sysemu/sysemu.h" #include "qemu/config-file.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "chardev/char.h" #include "qapi/error.h" #include "qapi/qapi-commands-char.h"
@@ -651,7 +652,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,chardev_name_foreach (help_string_append, str); -error_printf ("Available chardev backend types: %s\n" , str->str); +qemu_printf ("Available chardev backend types: %s\n" , str->str);g_string_free (str, true);return NULL ; }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 24/36] tcg: Simplify how dump_drift_info() prints
In reply to Markus Armbrusterdump_drift_info() takes an fprintf()-like callback and a FILE * to pass to it.
Its only caller hmp_info_jit() passes monitor_fprintf() and a Monitor
* cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
Drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- cpus.c | 15 +++++++++------ include/sysemu/cpus.h | 2 +- monitor.c | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-)
cpus.c +9 -6
@@ -31,6 +31,7 @@#include "qapi/qapi-events-run-state.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "sysemu/sysemu.h" #include "sysemu/block-backend.h" #include "exec/gdbstub.h"
@@ -2454,19 +2455,21 @@ void qmp_inject_nmi(Error **errp)nmi_monitor_handle (monitor_get_cpu_index (), errp); } -void dump_drift_info (FILE *f,fprintf_function cpu_fprintf) +void dump_drift_info (void ) {if (!use_icount) {return ; } -cpu_fprintf (f,"Host - Guest clock %" PRIi64" ms\n" , +qemu_printf ("Host - Guest clock %" PRIi64" ms\n" , (cpu_get_clock () -cpu_get_icount ())/SCALE_MS );if (icount_align_option) { -cpu_fprintf (f,"Max guest delay %" PRIi64" ms\n" , -max_delay/SCALE_MS ); -cpu_fprintf (f,"Max guest advance %" PRIi64" ms\n" , max_advance/SCALE_MS ); +qemu_printf ("Max guest delay %" PRIi64" ms\n" , + -max_delay /SCALE_MS ); +qemu_printf ("Max guest advance %" PRIi64" ms\n" , + max_advance /SCALE_MS ); }else { -cpu_fprintf (f,"Max guest delay NA\n" ); -cpu_fprintf (f,"Max guest advance NA\n" ); +qemu_printf ("Max guest delay NA\n" ); +qemu_printf ("Max guest advance NA\n" ); } }
include/sysemu/cpus.h +1 -1
@@ -19,7 +19,7 @@ extern int icount_align_option;/* drift information for info jit command */ extern int64_t max_delay;extern int64_t max_advance; -void dump_drift_info (FILE *f,fprintf_function cpu_fprintf); +void dump_drift_info (void );/* Unblock cpu */ void qemu_cpu_kick_self (void );
monitor.c +1 -1
@@ -1319,7 +1319,7 @@ static void hmp_info_jit(Monitor *mon, const QDict *qdict) }dump_exec_info (); -dump_drift_info ((FILE *)mon, monitor_fprintf); +dump_drift_info (); }static void hmp_info_opcount (Monitor *mon,const QDict *qdict)
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 25/36] qsp: Simplify how qsp_report() prints
In reply to Markus Armbrusterqsp_report() takes an fprintf()-like callback and a FILE * to pass to it.
Its only caller hmp_sync_profile() passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
Drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- include/block/qapi.h | 1 + include/qemu/qsp.h | 6 ++---- monitor.c | 2 +- util/qsp.c | 21 +++++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-)
include/block/qapi.h +1 -0
@@ -27,6 +27,7 @@#include "block/block.h" #include "block/snapshot.h" +#include "qemu/fprintf-fn.h" BlockDeviceInfo *bdrv_block_device_info (BlockBackend *blk,BlockDriverState *bs,Error **errp);
include/qemu/qsp.h +2 -4
@@ -11,15 +11,13 @@#ifndef QEMU_QSP_H #define QEMU_QSP_H -#include "qemu/fprintf-fn.h" -enum QSPSortBy {QSP_SORT_BY_TOTAL_WAIT_TIME ,QSP_SORT_BY_AVG_WAIT_TIME , }; -void qsp_report (FILE *f,fprintf_function cpu_fprintf,size_t max, -enum QSPSortBy sort_by,bool callsite_coalesce); +void qsp_report (size_t max,enum QSPSortBy sort_by, +bool callsite_coalesce);bool qsp_is_enabled (void );void qsp_enable (void );
monitor.c +1 -1
@@ -1336,7 +1336,7 @@ static void hmp_info_sync_profile(Monitor *mon, const QDict *qdict)enum QSPSortBy sort_by; sort_by = mean ?QSP_SORT_BY_AVG_WAIT_TIME :QSP_SORT_BY_TOTAL_WAIT_TIME ; -qsp_report ((FILE *)mon, monitor_fprintf, max, sort_by, coalesce); +qsp_report (max, sort_by, coalesce); }static void hmp_info_history (Monitor *mon,const QDict *qdict)
util/qsp.c +11 -10
@@ -56,7 +56,9 @@* Critical-Section Execution to Improve the Performance of Multithreaded * Applications", USENIX ATC'12. */ +#include "qemu/osdep.h" +#include "qemu/qemu-print.h" #include "qemu/thread.h" #include "qemu/timer.h" #include "qemu/qht.h"
@@ -678,8 +680,7 @@ static gboolean qsp_tree_report(gpointer key, gpointer value, gpointer udata)return FALSE; } -static void -pr_report (const QSPReport *rep,FILE *f,fprintf_function pr) +static void pr_report (const QSPReport *rep) {char *dashes;size_t max_len =0 ;
@@ -702,15 +703,15 @@ pr_report(const QSPReport *rep, FILE *f, fprintf_function pr)/* white space to leave to the right of "Call site" */ callsite_rspace = callsite_len -strlen ("Call site" ); -pr (f,"Type Object Call site%*s Wait Time (s) " -" Count Average (us)\n" , callsite_rspace,"" ); +qemu_printf ("Type Object Call site%*s Wait Time (s) " +" Count Average (us)\n" , callsite_rspace,"" );/* build a horizontal rule with dashes */ n_dashes =79 + callsite_rspace; dashes =g_malloc (n_dashes +1 );memset (dashes,'-' , n_dashes); dashes[n_dashes] ='\0' ; -pr (f,"%s\n" , dashes); +qemu_printf ("%s\n" , dashes);for (i =0 ; i < rep->n_entries; i++) {const QSPReportEntry *e = &rep->entries[i];
@@ -726,11 +727,11 @@ pr_report(const QSPReport *rep, FILE *f, fprintf_function pr) e->callsite_at, callsite_len - (int )strlen (e->callsite_at),"" , e->time_s, e->n_acqs, e->ns_avg * 1e-3); -pr (f,"%s" , s->str); +qemu_printf ("%s" , s->str);g_string_free (s, TRUE); } -pr (f,"%s\n" , dashes); +qemu_printf ("%s\n" , dashes);g_free (dashes); }
@@ -746,8 +747,8 @@ static void report_destroy(QSPReport *rep)g_free (rep->entries); } -void qsp_report (FILE *f,fprintf_function cpu_fprintf,size_t max, -enum QSPSortBy sort_by,bool callsite_coalesce) +void qsp_report (size_t max,enum QSPSortBy sort_by, +bool callsite_coalesce) {GTree *tree =g_tree_new_full (qsp_tree_cmp, &sort_by, g_free,NULL );QSPReport rep;
@@ -762,7 +763,7 @@ void qsp_report(FILE *f, fprintf_function cpu_fprintf, size_t max,g_tree_foreach (tree, qsp_tree_report, &rep);g_tree_destroy (tree); -pr_report (&rep, f, cpu_fprintf); +pr_report (&rep);report_destroy (&rep); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 16/36] blockdev: Make -drive format=help print to stdout
In reply to Markus ArmbrusterCommand line help explicitly requested by the user should be printed to stdout, not stderr. We do elsewhere. Adjust -drive to match: use qemu_printf() instead of error_printf(). Plain printf() would be wrong because we need to print to the current monitor for "drive_add ... format=help".
Message-Id: <[email protected]>
--- blockdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
blockdev.c +5 -4
@@ -40,6 +40,7 @@#include "monitor/monitor.h" #include "qemu/error-report.h" #include "qemu/option.h" +#include "qemu/qemu-print.h" #include "qemu/config-file.h" #include "qapi/qapi-commands-block.h" #include "qapi/qapi-commands-transaction.h"
@@ -301,7 +302,7 @@ DriveInfo *drive_get_next(BlockInterfaceType type)static void bdrv_format_print (void *opaque,const char *name) { -error_printf (" %s" , name); +qemu_printf (" %s" , name); } typedef struct {
@@ -530,11 +531,11 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,if ((buf =qemu_opt_get (opts,"format" )) !=NULL ) {if (is_help_option (buf)) { -error_printf ("Supported formats:" ); +qemu_printf ("Supported formats:" );bdrv_iterate_format (bdrv_format_print,NULL , false); -error_printf ("\nSupported formats (read-only):" ); +qemu_printf ("\nSupported formats (read-only):" );bdrv_iterate_format (bdrv_format_print,NULL , true); -error_printf ("\n" ); +qemu_printf ("\n" ); goto early_err; }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 28/36] target: Simplify how the TARGET_cpu_list() print
In reply to Markus ArmbrusterThe various TARGET_cpu_list() take an fprintf()-like callback and a FILE * to pass to it. Their callers (vl.c's main() via list_cpus(), bsd-user/main.c's main(), linux-user/main.c's main()) all pass fprintf() and stdout. Thus, the flexibility provided by the (rather tiresome) indirection isn't actually used.
Drop the callback, and call qemu_printf() instead.
Calling printf() would also work, but would make the code unsuitable for monitor context without making it simpler.
Message-Id: <[email protected]>
--- bsd-user/main.c | 2 +- cpus.c | 4 +-- include/exec/cpu-common.h | 13 --------- include/sysemu/cpus.h | 3 +- linux-user/main.c | 2 +- target/alpha/cpu.c | 15 ++++------ target/alpha/cpu.h | 2 +- target/arm/cpu.c | 1 - target/arm/cpu.h | 2 +- target/arm/helper.c | 15 ++++------ target/cris/cpu.c | 14 ++++----- target/cris/cpu.h | 2 +- target/hppa/cpu.c | 14 ++++----- target/hppa/cpu.h | 2 +- target/i386/cpu.c | 29 ++++++++----------- target/i386/cpu.h | 2 +- target/lm32/cpu.c | 14 ++++----- target/lm32/cpu.h | 2 +- target/m68k/cpu.h | 2 +- target/m68k/helper.c | 14 +++------ target/mips/cpu.h | 2 +- target/mips/translate.c | 1 + target/mips/translate_init.inc.c | 5 ++-- target/openrisc/cpu.c | 15 ++++------ target/openrisc/cpu.h | 2 +- target/ppc/cpu.h | 2 +- target/ppc/translate_init.inc.c | 26 +++++++---------- target/riscv/cpu.c | 17 +++-------- target/riscv/cpu.h | 2 +- target/s390x/cpu.h | 2 +- target/s390x/cpu_models.c | 21 ++++++-------- target/sh4/cpu.c | 17 +++-------- target/sh4/cpu.h | 2 +- target/sparc/cpu.c | 49 +++++++++++++++----------------- target/sparc/cpu.h | 2 +- target/tricore/cpu.h | 2 +- target/tricore/helper.c | 15 ++++------ target/xtensa/cpu.h | 2 +- target/xtensa/helper.c | 7 +++-- vl.c | 2 +- 40 files changed, 129 insertions(+), 218 deletions(-)
bsd-user/main.c +1 -1
@@ -819,7 +819,7 @@ int main(int argc, char **argv)if (is_help_option (cpu_model)) {/* XXX: implement xxx_cpu_list for targets that still miss it */ #if defined(cpu_list) -cpu_list (stdout, &fprintf); +cpu_list ();#endif exit (1 ); }
cpus.c +2 -2
@@ -2181,11 +2181,11 @@ int vm_stop_force_state(RunState state) } } -void list_cpus (FILE *f,fprintf_function cpu_fprintf,const char *optarg) +void list_cpus (const char *optarg) {/* XXX: implement xxx_cpu_list for targets that still miss it */ #if defined(cpu_list) -cpu_list (f, cpu_fprintf); +cpu_list ();#endif }
include/exec/cpu-common.h +0 -13
@@ -9,19 +9,6 @@#include "qemu/bswap.h" #include "qemu/queue.h" -#include "qemu/fprintf-fn.h" - -/** -* CPUListState: -* @cpu_fprintf: Print function. -* @file: File to print to using @cpu_fprint. -* -* State commonly used for iterating over CPU models. -*/ -typedef struct CPUListState { -fprintf_function cpu_fprintf; -FILE *file; -}CPUListState ;/* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */ void qemu_init_cpu_list (void );
include/sysemu/cpus.h +1 -2
@@ -1,7 +1,6 @@#ifndef QEMU_CPUS_H #define QEMU_CPUS_H -#include "qemu/fprintf-fn.h" #include "qemu/timer.h" /* cpus.c */
@@ -39,7 +38,7 @@ extern int smp_cores;extern int smp_threads;#endif -void list_cpus (FILE *f,fprintf_function cpu_fprintf,const char *optarg); +void list_cpus (const char *optarg);void qemu_tcg_configure (QemuOpts *opts,Error **errp);
linux-user/main.c +1 -1
@@ -317,7 +317,7 @@ static void handle_arg_cpu(const char *arg)if (cpu_model ==NULL ||is_help_option (cpu_model)) {/* XXX: implement xxx_cpu_list for targets that still miss it */ #if defined(cpu_list) -cpu_list (stdout, &fprintf); +cpu_list ();#endif exit (EXIT_FAILURE ); }
target/alpha/cpu.c +5 -10
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "qemu-common.h" #include "exec/exec-all.h"
@@ -74,23 +75,17 @@ static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)static void alpha_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data; -CPUListState *s = user_data; - (*s->cpu_fprintf)(s->file," %s\n" , -object_class_get_name (oc)); +qemu_printf (" %s\n" ,object_class_get_name (oc)); } -void alpha_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void alpha_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list_sorted (TYPE_ALPHA_CPU , false); - (*cpu_fprintf)(f,"Available CPUs:\n" ); -g_slist_foreach (list, alpha_cpu_list_entry, &s); +qemu_printf ("Available CPUs:\n" ); +g_slist_foreach (list, alpha_cpu_list_entry,NULL );g_slist_free (list); }
target/alpha/cpu.h +1 -1
@@ -470,7 +470,7 @@ void alpha_translate_init(void);#define ALPHA_CPU_TYPE_NAME (model) model ALPHA_CPU_TYPE_SUFFIX#define CPU_RESOLVING_TYPE TYPE_ALPHA_CPU -void alpha_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void alpha_cpu_list (void );/* you can call this signal handler from your SIGBUS and SIGSEGV signal handlers to inform the virtual CPU of exceptions. non zero is returned if the signal was handled by the virtual CPU. */
target/arm/cpu.c +0 -1
@@ -20,7 +20,6 @@#include "qemu/osdep.h" #include "target/arm/idau.h" -#include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "cpu.h"
target/arm/cpu.h +1 -1
@@ -1936,7 +1936,7 @@ static inline bool access_secure_reg(CPUARMState *env) (arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)), \ (_val)) -void arm_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void arm_cpu_list (void );uint32_t arm_phys_excp_target_el (CPUState *cs,uint32_t excp_idx,uint32_t cur_el,bool secure);
target/arm/helper.c +5 -10
@@ -10,6 +10,7 @@#include "sysemu/sysemu.h" #include "qemu/bitops.h" #include "qemu/crc32c.h" +#include "qemu/qemu-print.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "arm_ldst.h"
@@ -6724,29 +6725,23 @@ static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b)static void arm_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data; -CPUListState *s = user_data;const char *typename;char *name; typename =object_class_get_name (oc); name =g_strndup (typename,strlen (typename) -strlen ("-" TYPE_ARM_CPU )); - (*s->cpu_fprintf)(s->file," %s\n" , - name); +qemu_printf (" %s\n" , name);g_free (name); } -void arm_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void arm_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list (TYPE_ARM_CPU , false); list =g_slist_sort (list, arm_cpu_list_compare); - (*cpu_fprintf)(f,"Available CPUs:\n" ); -g_slist_foreach (list, arm_cpu_list_entry, &s); +qemu_printf ("Available CPUs:\n" ); +g_slist_foreach (list, arm_cpu_list_entry,NULL );g_slist_free (list); }
target/cris/cpu.c +5 -9
@@ -23,6 +23,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "qemu-common.h" #include "mmu.h"
@@ -103,27 +104,22 @@ static gint cris_cpu_list_compare(gconstpointer a, gconstpointer b)static void cris_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data; -CPUListState *s = user_data;const char *typename =object_class_get_name (oc);char *name; name =g_strndup (typename,strlen (typename) -strlen (CRIS_CPU_TYPE_SUFFIX )); - (*s->cpu_fprintf)(s->file," %s\n" , name); +qemu_printf (" %s\n" , name);g_free (name); } -void cris_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void cris_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list (TYPE_CRIS_CPU , false); list =g_slist_sort (list, cris_cpu_list_compare); - (*cpu_fprintf)(f,"Available CPUs:\n" ); -g_slist_foreach (list, cris_cpu_list_entry, &s); +qemu_printf ("Available CPUs:\n" ); +g_slist_foreach (list, cris_cpu_list_entry,NULL );g_slist_free (list); }
target/cris/cpu.h +1 -1
@@ -308,6 +308,6 @@ static inline void cpu_get_tb_cpu_state(CPUCRISState *env, target_ulong *pc, }#define cpu_list cris_cpu_list -void cris_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void cris_cpu_list (void );#endif
target/hppa/cpu.c +5 -9
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "qemu-common.h" #include "exec/exec-all.h"
@@ -113,22 +114,17 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)static void hppa_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data; -CPUListState *s = user_data; - (*s->cpu_fprintf)(s->file," %s\n" ,object_class_get_name (oc)); +qemu_printf (" %s\n" ,object_class_get_name (oc)); } -void hppa_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void hppa_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list_sorted (TYPE_HPPA_CPU , false); - (*cpu_fprintf)(f,"Available CPUs:\n" ); -g_slist_foreach (list, hppa_cpu_list_entry, &s); +qemu_printf ("Available CPUs:\n" ); +g_slist_foreach (list, hppa_cpu_list_entry,NULL );g_slist_free (list); }
target/hppa/cpu.h +1 -1
@@ -272,7 +272,7 @@ void hppa_translate_init(void);#define CPU_RESOLVING_TYPE TYPE_HPPA_CPU -void hppa_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void hppa_cpu_list (void );static inline target_ulong hppa_form_gva_psw (target_ureg psw,uint64_t spc,target_ureg off)
target/i386/cpu.c +12 -17
@@ -21,6 +21,7 @@#include "qemu/units.h" #include "qemu/cutils.h" #include "qemu/bitops.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "exec/exec-all.h"
@@ -3671,7 +3672,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,/* Print all cpuid feature names in featureset */ -static void listflags (FILE *f,fprintf_function print,GList *features) +static void listflags (GList *features) {size_t len =0 ;GList *tmp;
@@ -3679,13 +3680,13 @@ static void listflags(FILE *f, fprintf_function print, GList *features)for (tmp = features; tmp; tmp = tmp->next) {const char *name = tmp->data;if ((len +strlen (name) +1 ) >=75 ) { -"\n" ); +qemu_printf ("\n" ); len =0 ; } -"%s%s" , len ==0 ?" " :" " , name); +qemu_printf ("%s%s" , len ==0 ?" " :" " , name); len +=strlen (name) +1 ; } -"\n" ); +qemu_printf ("\n" ); }/* Sort alphabetically by type name, respecting X86CPUClass::ordering. */
@@ -3721,32 +3722,26 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data) {ObjectClass *oc = data;X86CPUClass *cc =X86_CPU_CLASS (oc); -CPUListState *s = user_data;char *name =x86_cpu_class_get_model_name (cc);const char *desc = cc->model_description;if (!desc && cc->cpu_def) { desc = cc->cpu_def->model_id; } - (*s->cpu_fprintf)(s->file,"x86 %-20s %-48s\n" , - name, desc); +qemu_printf ("x86 %-20s %-48s\n" , name, desc);g_free (name); }/* list available CPU models and flags */ -void x86_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void x86_cpu_list (void ) {int i, j; -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list;GList *names =NULL ; - (*cpu_fprintf)(f,"Available CPUs:\n" ); +qemu_printf ("Available CPUs:\n" ); list =get_sorted_cpu_model_list (); -g_slist_foreach (list, x86_cpu_list_entry, &s); +g_slist_foreach (list, x86_cpu_list_entry,NULL );g_slist_free (list); names =NULL ;
@@ -3761,9 +3756,9 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf) names =g_list_sort (names, (GCompareFunc )strcmp); - (*cpu_fprintf)(f,"\nRecognized CPUID flags:\n" ); -listflags (f, cpu_fprintf, names); - (*cpu_fprintf)(f,"\n" ); +qemu_printf ("\nRecognized CPUID flags:\n" ); +listflags (names); +qemu_printf ("\n" );g_list_free (names); }
target/i386/cpu.h +1 -1
@@ -1532,7 +1532,7 @@ int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);void x86_cpu_exec_enter (CPUState *cpu);void x86_cpu_exec_exit (CPUState *cpu); -void x86_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void x86_cpu_list (void );int cpu_x86_support_mca_broadcast (CPUX86State *env);int cpu_get_pic_interrupt (CPUX86State *s);
target/lm32/cpu.c +5 -9
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "qemu-common.h"
@@ -34,27 +35,22 @@ static void lm32_cpu_set_pc(CPUState *cs, vaddr value)static void lm32_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data; -CPUListState *s = user_data;const char *typename =object_class_get_name (oc);char *name; name =g_strndup (typename,strlen (typename) -strlen (LM32_CPU_TYPE_SUFFIX )); - (*s->cpu_fprintf)(s->file," %s\n" , name); +qemu_printf (" %s\n" , name);g_free (name); } -void lm32_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void lm32_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list_sorted (TYPE_LM32_CPU , false); - (*cpu_fprintf)(f,"Available CPUs:\n" ); -g_slist_foreach (list, lm32_cpu_list_entry, &s); +qemu_printf ("Available CPUs:\n" ); +g_slist_foreach (list, lm32_cpu_list_entry,NULL );g_slist_free (list); }
target/lm32/cpu.h +1 -1
@@ -243,7 +243,7 @@ static inline lm32_wp_t lm32_wp_type(uint32_t dc, int idx)is returned if the signal was handled by the virtual CPU. */ int cpu_lm32_signal_handler (int host_signum,void *pinfo,void *puc); -void lm32_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void lm32_cpu_list (void );void lm32_translate_init (void );void cpu_lm32_set_phys_msb_ignore (CPULM32State *env,int value); void QEMU_NORETURN raise_exception(CPULM32State *env, int index);
target/m68k/cpu.h +1 -1
@@ -499,7 +499,7 @@ static inline int m68k_feature(CPUM68KState *env, int feature)return (env->features & (1u << feature)) !=0 ; } -void m68k_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void m68k_cpu_list (void );void register_m68k_insns (CPUM68KState *env);
target/m68k/helper.c +4 -10
@@ -22,9 +22,9 @@#include "cpu.h" #include "exec/exec-all.h" #include "exec/gdbstub.h" -#include "exec/helper-proto.h" #include "fpu/softfloat.h" +#include "qemu/qemu-print.h" #define SIGNBIT (1u << 31)
@@ -49,28 +49,22 @@ static gint m68k_cpu_list_compare(gconstpointer a, gconstpointer b)static void m68k_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *c = data; -CPUListState *s = user_data;const char *typename;char *name; typename =object_class_get_name (c); name =g_strndup (typename,strlen (typename) -strlen ("-" TYPE_M68K_CPU )); - (*s->cpu_fprintf)(s->file,"%s\n" , - name); +qemu_printf ("%s\n" , name);g_free (name); } -void m68k_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void m68k_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list (TYPE_M68K_CPU , false); list =g_slist_sort (list, m68k_cpu_list_compare); -g_slist_foreach (list, m68k_cpu_list_entry, &s); +g_slist_foreach (list, m68k_cpu_list_entry,NULL );g_slist_free (list); }
target/mips/cpu.h +1 -1
@@ -1065,7 +1065,7 @@ static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env)#define ENV_OFFSET offsetof(MIPSCPU, env) -void mips_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void mips_cpu_list (void );#define cpu_signal_handler cpu_mips_signal_handler#define cpu_list mips_cpu_list
target/mips/translate.c +1 -0
@@ -38,6 +38,7 @@#include "trace-tcg.h" #include "exec/translator.h" #include "exec/log.h" +#include "qemu/qemu-print.h" #define MIPS_DEBUG_DISAS 0
target/mips/translate_init.inc.c +2 -3
@@ -835,13 +835,12 @@ const mips_def_t mips_defs[] = };const int mips_defs_number =ARRAY_SIZE (mips_defs); -void mips_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void mips_cpu_list (void ) {int i;for (i =0 ; i <ARRAY_SIZE (mips_defs); i++) { - (*cpu_fprintf)(f,"MIPS '%s'\n" , - mips_defs[i].name); +qemu_printf ("MIPS '%s'\n" , mips_defs[i].name); } }
target/openrisc/cpu.c +5 -10
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "qemu-common.h"
@@ -180,30 +181,24 @@ static gint openrisc_cpu_list_compare(gconstpointer a, gconstpointer b)static void openrisc_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data; -CPUListState *s = user_data;const char *typename;char *name; typename =object_class_get_name (oc); name =g_strndup (typename,strlen (typename) -strlen ("-" TYPE_OPENRISC_CPU )); - (*s->cpu_fprintf)(s->file," %s\n" , - name); +qemu_printf (" %s\n" , name);g_free (name); } -void cpu_openrisc_list (FILE *f,fprintf_function cpu_fprintf) +void cpu_openrisc_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list (TYPE_OPENRISC_CPU , false); list =g_slist_sort (list, openrisc_cpu_list_compare); - (*cpu_fprintf)(f,"Available CPUs:\n" ); -g_slist_foreach (list, openrisc_cpu_list_entry, &s); +qemu_printf ("Available CPUs:\n" ); +g_slist_foreach (list, openrisc_cpu_list_entry,NULL );g_slist_free (list); }
target/openrisc/cpu.h +1 -1
@@ -336,7 +336,7 @@ static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)#define ENV_OFFSET offsetof(OpenRISCCPU, env) -void cpu_openrisc_list (FILE *f,fprintf_function cpu_fprintf); +void cpu_openrisc_list (void );void openrisc_cpu_do_interrupt (CPUState *cpu);bool openrisc_cpu_exec_interrupt (CPUState *cpu,int int_req); void openrisc_cpu_dump_state(CPUState *cpu, FILE *f,
target/ppc/cpu.h +1 -1
@@ -1308,7 +1308,7 @@ void ppc_store_ptcr(CPUPPCState *env, target_ulong value);#endif /* !defined(CONFIG_USER_ONLY) */ void ppc_store_msr (CPUPPCState *env,target_ulong value); -void ppc_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void ppc_cpu_list (void );/* Time-base and decrementer management */ #ifndef NO_CPU_IO_DEFS
target/ppc/translate_init.inc.c +10 -16
@@ -28,6 +28,7 @@#include "mmu-hash32.h" #include "mmu-hash64.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "qapi/error.h" #include "qapi/qmp/qnull.h" #include "qapi/visitor.h"
@@ -10215,7 +10216,6 @@ static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b)static void ppc_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data; -CPUListState *s = user_data;PowerPCCPUClass *pcc =POWERPC_CPU_CLASS (oc);DeviceClass *family =DEVICE_CLASS (ppc_cpu_get_family_class (pcc));const char *typename =object_class_get_name (oc);
@@ -10228,8 +10228,7 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data) name =g_strndup (typename,strlen (typename) -strlen (POWERPC_CPU_TYPE_SUFFIX )); - (*s->cpu_fprintf)(s->file,"PowerPC %-16s PVR %08x\n" , - name, pcc->pvr); +qemu_printf ("PowerPC %-16s PVR %08x\n" , name, pcc->pvr);for (i =0 ; ppc_cpu_aliases[i].alias !=NULL ; i++) {PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];ObjectClass *alias_oc =ppc_cpu_class_by_name (alias->model);
@@ -10242,33 +10241,28 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)* avoid printing the wrong alias here and use "preferred" instead */ if (strcmp (alias->alias, family->desc) ==0 ) { - (*s->cpu_fprintf)(s->file, -"PowerPC %-16s (alias for preferred %s CPU)\n" , - alias->alias, family->desc); +qemu_printf ("PowerPC %-16s (alias for preferred %s CPU)\n" , + alias->alias, family->desc); }else { - (*s->cpu_fprintf)(s->file,"PowerPC %-16s (alias for %s)\n" , - alias->alias, name); +qemu_printf ("PowerPC %-16s (alias for %s)\n" , + alias->alias, name); } }g_free (name); } -void ppc_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void ppc_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list (TYPE_POWERPC_CPU , false); list =g_slist_sort (list, ppc_cpu_list_compare); -g_slist_foreach (list, ppc_cpu_list_entry, &s); +g_slist_foreach (list, ppc_cpu_list_entry,NULL );g_slist_free (list);#ifdef CONFIG_KVM -cpu_fprintf (f,"\n" ); -cpu_fprintf (f,"PowerPC %-16s\n" ,"host" ); +qemu_printf ("\n" ); +qemu_printf ("PowerPC %-16s\n" ,"host" );#endif }
target/riscv/cpu.c +4 -13
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" +#include "qemu/qemu-print.h" #include "qemu/log.h" #include "cpu.h" #include "exec/exec-all.h"
@@ -383,11 +384,6 @@ char *riscv_isa_string(RISCVCPU *cpu)return isa_str; } -typedef struct RISCVCPUListState { -fprintf_function cpu_fprintf; -FILE *file; -}RISCVCPUListState ; -static gint riscv_cpu_list_compare (gconstpointer a,gconstpointer b) {ObjectClass *class_a = (ObjectClass *)a;
@@ -401,24 +397,19 @@ static gint riscv_cpu_list_compare(gconstpointer a, gconstpointer b)static void riscv_cpu_list_entry (gpointer data,gpointer user_data) { -RISCVCPUListState *s = user_data;const char *typename =object_class_get_name (OBJECT_CLASS (data));int len =strlen (typename) -strlen (RISCV_CPU_TYPE_SUFFIX ); - (*s->cpu_fprintf)(s->file,"%.*s\n" , len, typename); +qemu_printf ("%.*s\n" , len, typename); } -void riscv_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void riscv_cpu_list (void ) { -RISCVCPUListState s = { - .cpu_fprintf = cpu_fprintf, - .file = f, - };GSList *list; list =object_class_get_list (TYPE_RISCV_CPU , false); list =g_slist_sort (list, riscv_cpu_list_compare); -g_slist_foreach (list, riscv_cpu_list_entry, &s); +g_slist_foreach (list, riscv_cpu_list_entry,NULL );g_slist_free (list); }
target/riscv/cpu.h +1 -1
@@ -264,7 +264,7 @@ void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,int riscv_cpu_handle_mmu_fault (CPUState *cpu,vaddr address,int size,int rw,int mmu_idx);char *riscv_isa_string (RISCVCPU *cpu); -void riscv_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void riscv_cpu_list (void );#define cpu_signal_handler riscv_cpu_signal_handler#define cpu_list riscv_cpu_list
target/s390x/cpu.h +1 -1
@@ -753,7 +753,7 @@ static inline uint8_t s390_cpu_get_state(S390CPU *cpu)/* cpu_models.c */ -void s390_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void s390_cpu_list (void );#define cpu_list s390_cpu_listvoid s390_set_qemu_cpu_model (uint16_t type,uint8_t gen,uint8_t ec_ga,const S390FeatInit feat_init);
target/s390x/cpu_models.c +8 -13
@@ -18,6 +18,7 @@#include "qapi/error.h" #include "qapi/visitor.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "qapi/qmp/qerror.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qmp/qdict.h"
@@ -308,7 +309,6 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga,static void s390_print_cpu_model_list_entry (gpointer data,gpointer user_data) { -CPUListState *s = user_data;const S390CPUClass *scc =S390_CPU_CLASS ((ObjectClass *)data);char *name =g_strdup (object_class_get_name ((ObjectClass *)data));const char *details ="" ;
@@ -321,8 +321,7 @@ static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_data)/* strip off the -s390x-cpu */ g_strrstr (name,"-" TYPE_S390_CPU )[0 ] =0 ; - (*s->cpu_fprintf)(s->file,"s390 %-15s %-35s %s\n" , name, scc->desc, - details); +qemu_printf ("s390 %-15s %-35s %s\n" , name, scc->desc, details);g_free (name); }
@@ -360,33 +359,29 @@ static gint s390_cpu_list_compare(gconstpointer a, gconstpointer b)return cc_a->is_static ?-1 :1 ; } -void s390_cpu_list (FILE *f,fprintf_function print) +void s390_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = print, - };S390FeatGroup group;S390Feat feat;GSList *list; list =object_class_get_list (TYPE_S390_CPU , false); list =g_slist_sort (list, s390_cpu_list_compare); -g_slist_foreach (list, s390_print_cpu_model_list_entry, &s); +g_slist_foreach (list, s390_print_cpu_model_list_entry,NULL );g_slist_free (list); - (*print)(f,"\nRecognized feature flags:\n" ); +qemu_printf ("\nRecognized feature flags:\n" );for (feat =0 ; feat <S390_FEAT_MAX ; feat++) {const S390FeatDef *def =s390_feat_def (feat); - (*print)(f,"%-20s %-50s\n" , def->name, def->desc); +qemu_printf ("%-20s %-50s\n" , def->name, def->desc); } - (*print)(f,"\nRecognized feature groups:\n" ); +qemu_printf ("\nRecognized feature groups:\n" );for (group =0 ; group <S390_FEAT_GROUP_MAX ; group++) {const S390FeatGroupDef *def =s390_feat_group_def (group); - (*print)(f,"%-20s %-50s\n" , def->name, def->desc); +qemu_printf ("%-20s %-50s\n" , def->name, def->desc); } }
target/sh4/cpu.c +4 -13
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "qemu-common.h" #include "migration/vmstate.h"
@@ -79,30 +80,20 @@ static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) info->print_insn = print_insn_sh; } -typedef struct SuperHCPUListState { -fprintf_function cpu_fprintf; -FILE *file; -}SuperHCPUListState ; -static void superh_cpu_list_entry (gpointer data,gpointer user_data) { -SuperHCPUListState *s = user_data;const char *typename =object_class_get_name (OBJECT_CLASS (data));int len =strlen (typename) -strlen (SUPERH_CPU_TYPE_SUFFIX ); - (*s->cpu_fprintf)(s->file,"%.*s\n" , len, typename); +qemu_printf ("%.*s\n" , len, typename); } -void sh4_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void sh4_cpu_list (void ) { -SuperHCPUListState s = { - .cpu_fprintf = cpu_fprintf, - .file = f, - };GSList *list; list =object_class_get_list_sorted (TYPE_SUPERH_CPU , false); -g_slist_foreach (list, superh_cpu_list_entry, &s); +g_slist_foreach (list, superh_cpu_list_entry,NULL );g_slist_free (list); }
target/sh4/cpu.h +1 -1
@@ -247,7 +247,7 @@ int cpu_sh4_signal_handler(int host_signum, void *pinfo,int superh_cpu_handle_mmu_fault (CPUState *cpu,vaddr address,int size,int rw,int mmu_idx); -void sh4_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void sh4_cpu_list (void );#if !defined(CONFIG_USER_ONLY )void cpu_sh4_invalidate_tlb (CPUSH4State *s); uint32_t cpu_sh4_read_mmaped_itlb_addr(CPUSH4State *s,
target/sparc/cpu.c +23 -26
77 lines not on this page · raw message
target/sparc/cpu.h +1 -1
@@ -578,7 +578,7 @@ void cpu_raise_exception_ra(CPUSPARCState *, int, uintptr_t) QEMU_NORETURN;#ifndef NO_CPU_IO_DEFS /* cpu_init.c */ void cpu_sparc_set_id (CPUSPARCState *env,unsigned int cpu); -void sparc_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void sparc_cpu_list (void );/* mmu_helper.c */ int sparc_cpu_handle_mmu_fault (CPUState *cpu,vaddr address,int size,int rw,int mmu_idx);
target/tricore/cpu.h +1 -1
@@ -375,7 +375,7 @@ void fpu_set_state(CPUTriCoreState *env);#define MMU_USER_IDX 2 -void tricore_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void tricore_cpu_list (void );#define cpu_signal_handler cpu_tricore_signal_handler#define cpu_list tricore_cpu_list
target/tricore/helper.c +5 -10
@@ -20,6 +20,7 @@#include "cpu.h" #include "exec/exec-all.h" #include "fpu/softfloat.h" +#include "qemu/qemu-print.h" enum {TLBRET_DIRTY =-4 ,
@@ -82,28 +83,22 @@ int cpu_tricore_handle_mmu_fault(CPUState *cs, target_ulong address,static void tricore_cpu_list_entry (gpointer data,gpointer user_data) {ObjectClass *oc = data; -CPUListState *s = user_data;const char *typename;char *name; typename =object_class_get_name (oc); name =g_strndup (typename,strlen (typename) -strlen ("-" TYPE_TRICORE_CPU )); - (*s->cpu_fprintf)(s->file," %s\n" , - name); +qemu_printf (" %s\n" , name);g_free (name); } -void tricore_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void tricore_cpu_list (void ) { -CPUListState s = { - .file = f, - .cpu_fprintf = cpu_fprintf, - };GSList *list; list =object_class_get_list_sorted (TYPE_TRICORE_CPU , false); - (*cpu_fprintf)(f,"Available CPUs:\n" ); -g_slist_foreach (list, tricore_cpu_list_entry, &s); +qemu_printf ("Available CPUs:\n" ); +g_slist_foreach (list, tricore_cpu_list_entry,NULL );g_slist_free (list); }
target/xtensa/cpu.h +1 -1
@@ -600,7 +600,7 @@ void xtensa_irq_init(CPUXtensaState *env);qemu_irq *xtensa_get_extints (CPUXtensaState *env);qemu_irq xtensa_get_runstall (CPUXtensaState *env);int cpu_xtensa_signal_handler (int host_signum,void *pinfo,void *puc); -void xtensa_cpu_list (FILE *f,fprintf_function cpu_fprintf); +void xtensa_cpu_list (void );void xtensa_sync_window_from_phys (CPUXtensaState *env);void xtensa_sync_phys_from_window (CPUXtensaState *env);void xtensa_rotate_window (CPUXtensaState *env,uint32_t delta);
target/xtensa/helper.c +4 -3
@@ -31,6 +31,7 @@#include "exec/gdbstub.h" #include "exec/helper-proto.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "qemu/host-utils.h" static struct XtensaConfigList *xtensa_cores;
@@ -228,12 +229,12 @@ void xtensa_breakpoint_handler(CPUState *cs) } } -void xtensa_cpu_list (FILE *f,fprintf_function cpu_fprintf) +void xtensa_cpu_list (void ) {XtensaConfigList *core = xtensa_cores; -cpu_fprintf (f,"Available CPUs:\n" ); +qemu_printf ("Available CPUs:\n" );for (; core; core = core->next) { -cpu_fprintf (f," %s\n" , core->config->name); +qemu_printf (" %s\n" , core->config->name); } }
vl.c +1 -1
@@ -4051,7 +4051,7 @@ int main(int argc, char **argv, char **envp) }if (cpu_model &&is_help_option (cpu_model)) { -list_cpus (stdout, &fprintf, cpu_model); +list_cpus (cpu_model);exit (0 ); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 35/36] disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
In reply to Markus ArmbrusterCommit dc99065b5f9 (v0.1.0) added dis-asm.h from binutils.
Commit 43d4145a986 (v0.1.5) inlined bfd.h into dis-asm.h to remove the dependency on binutils.
Commit 76cad71136b (v1.4.0) moved dis-asm.h to include/disas/bfd.h. The new name is confusing when you try to match against (pre GPLv3+) binutils. Rename it back. Keep it in the same directory, of course.
Message-Id: <[email protected]>
---
disas.c | 2 +-
disas/alpha.c | 2 +-
disas/arm-a64.cc | 2 +-
disas/arm.c | 2 +-
disas/cris.c | 2 +-
disas/hppa.c | 2 +-
disas/i386.c | 2 +-
disas/lm32.c | 2 +-
disas/m68k.c | 2 +-
disas/microblaze.c | 2 +-
disas/mips.c | 2 +-
disas/moxie.c | 2 +-
disas/nanomips.cpp | 2 +-
disas/nios2.c | 2 +-
disas/ppc.c | 2 +-
disas/riscv.c | 2 +-
disas/s390.c | 2 +-
disas/sh4.c | 2 +-
disas/sparc.c | 2 +-
disas/tci.c | 2 +-
disas/xtensa.c | 2 +-
include/disas/{bfd.h => dis-asm.h} | 0
include/qom/cpu.h | 2 +-
target/openrisc/disas.c | 2 +-
target/ppc/translate_init.inc.c | 2 +-
25 files changed, 24 insertions(+), 24 deletions(-)
rename include/disas/{bfd.h => dis-asm.h} (100%)disas.c +1 -1
@@ -1,7 +1,7 @@/* General "disassemble this chunk" code. Used for debugging. */ #include "qemu/osdep.h" #include "qemu-common.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "elf.h" #include "qemu/qemu-print.h"
disas/alpha.c +1 -1
@@ -20,7 +20,7 @@ along with this file; see the file COPYING. If not, see <http://www.gnu.org/licenses/>. */#include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" /* MAX is redefined below, so remove any previous definition. */ #undef MAX
disas/arm-a64.cc +1 -1
@@ -19,7 +19,7 @@ extern "C" { #include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" } #include "vixl/a64/disasm-a64.h"
disas/arm.c +1 -1
@@ -23,7 +23,7 @@for things we don't care about. */ #include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #define ARM_EXT_V1 0#define ARM_EXT_V2 0
disas/cris.c +1 -1
@@ -20,7 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "target/cris/opcode-cris.h" #define CONST_STRNEQ (STR1 ,STR2 ) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
disas/hppa.c +1 -1
@@ -19,7 +19,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. */#include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" /* HP PA-RISC SOM object file format: definitions internal to BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
disas/i386.c +1 -1
@@ -32,7 +32,7 @@the Intel manual for details. */ #include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "qemu/cutils.h" /* include/opcode/i386.h r1.78 */
disas/lm32.c +1 -1
@@ -19,7 +19,7 @@*/ #include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" typedef enum { LM32_OP_SRUI = 0, LM32_OP_NORI, LM32_OP_MULI, LM32_OP_SH, LM32_OP_LB,
disas/m68k.c +1 -1
@@ -4,7 +4,7 @@#include "qemu/osdep.h" #include <math.h> -#include "disas/bfd.h" +#include "disas/dis-asm.h" /* **** floatformat.h from sourceware.org CVS 2005-08-14. */ /* IEEE floating point support declarations, for GDB, the GNU Debugger.
disas/microblaze.c +1 -1
@@ -577,7 +577,7 @@ static const char pvr_register_prefix[] = "rpvr";#endif /* MICROBLAZE_OPC */ -#include "disas/bfd.h" +#include "disas/dis-asm.h" #define get_field_rd (instr) get_field(instr, RD_MASK, RD_LOW)#define get_field_r1 (instr) get_field(instr, RA_MASK, RA_LOW)
disas/mips.c +1 -1
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */#include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" /* mips.h. Mips opcode list for GDB, the GNU debugger. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
disas/moxie.c +1 -1
@@ -18,7 +18,7 @@#define STATIC_TABLE #define DEFINE_TABLE -#include "disas/bfd.h" +#include "disas/dis-asm.h" static void *stream;
disas/nanomips.cpp +1 -1
@@ -29,7 +29,7 @@ extern "C" { #include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" } #include <cstring>
disas/nios2.c +1 -1
@@ -36,7 +36,7 @@/*#include "bfd.h"*/ #include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" /****************************************************************************
disas/ppc.c +1 -1
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with this file; see the file COPYING. If not, see <http://www.gnu.org/licenses/>. */#include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #define BFD_DEFAULT_TARGET_SIZE 64/* ppc.h -- Header file for PowerPC opcode table
disas/riscv.c +1 -1
@@ -18,7 +18,7 @@*/ #include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" /* types */
disas/s390.c +1 -1
@@ -22,7 +22,7 @@#include "qemu/osdep.h" #include "qemu-common.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" /* include/opcode/s390.h revision 1.9 */ /* s390.h -- Header file for S390 opcode table
disas/sh4.c +1 -1
@@ -16,7 +16,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>. */#include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #define DEFINE_TABLE
disas/sparc.c +1 -1
@@ -27,7 +27,7 @@ see <http://www.gnu.org/licenses/>. */#include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" /* The SPARC opcode table (and other related data) is defined in the opcodes library in sparc-opc.c. If you change anything here, make
disas/tci.c +1 -1
@@ -19,7 +19,7 @@#include "qemu/osdep.h" #include "qemu-common.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "tcg/tcg.h" /* Disassemble TCI bytecode. */
disas/xtensa.c +1 -1
@@ -26,7 +26,7 @@*/ #include "qemu/osdep.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "hw/xtensa/xtensa-isa.h" int print_insn_xtensa (bfd_vma memaddr,struct disassemble_info *info)
include/disas/dis-asm.h renamed from include/disas/bfd.h +0 -0
include/qom/cpu.h +1 -1
@@ -21,7 +21,7 @@#define QEMU_CPU_H #include "hw/qdev-core.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "exec/hwaddr.h" #include "exec/memattrs.h" #include "qapi/qapi-types-run-state.h"
target/openrisc/disas.c +1 -1
@@ -19,7 +19,7 @@#include "qemu/osdep.h" #include "qemu-common.h" -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "qemu/bitops.h" #include "cpu.h"
target/ppc/translate_init.inc.c +1 -1
@@ -18,7 +18,7 @@* License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "disas/bfd.h" +#include "disas/dis-asm.h" #include "exec/gdbstub.h" #include "kvm_ppc.h" #include "sysemu/arch_init.h"
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 31/36] qom/cpu: Simplify how CPUClass::dump_statistics() prints
In reply to Markus ArmbrusterCPUClass method dump_statistics() takes an fprintf()-like callback and a FILE * to pass to it.
Its only caller hmp_info_cpustats() (via cpu_dump_statistics()) passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf(). The type-punning is ugly.
Drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- include/qom/cpu.h | 11 ++++------- monitor.c | 2 +- qom/cpu.c | 5 ++--- target/ppc/cpu.h | 3 +-- target/ppc/translate.c | 9 ++++----- 5 files changed, 12 insertions(+), 18 deletions(-)
include/qom/cpu.h +4 -7
@@ -184,8 +184,7 @@ typedef struct CPUClass {void (*dump_state)(CPUState *cpu,FILE *f,fprintf_function cpu_fprintf,int flags); GuestPanicInformation* (*get_crash_info)(CPUState *cpu); -void (*dump_statistics)(CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void (*dump_statistics)(CPUState *cpu,int flags);int64_t (*get_arch_id)(CPUState *cpu);bool (*get_paging_enabled)(const CPUState *cpu); void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
@@ -576,14 +575,12 @@ void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,/** * 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. +* Dump CPU statistics to the current monitor if we have one, else to +* stdout. */ -void cpu_dump_statistics (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void cpu_dump_statistics (CPUState *cpu,int flags);#ifndef CONFIG_USER_ONLY /**
monitor.c +1 -1
@@ -1364,7 +1364,7 @@ static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)monitor_printf (mon,"No CPU available\n" );return ; } -cpu_dump_statistics (cs, (FILE *)mon, &monitor_fprintf,0 ); +cpu_dump_statistics (cs,0 ); }static void hmp_info_trace_events (Monitor *mon,const QDict *qdict)
qom/cpu.c +2 -3
@@ -230,13 +230,12 @@ void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf, } } -void cpu_dump_statistics (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags) +void cpu_dump_statistics (CPUState *cpu,int flags) {CPUClass *cc =CPU_GET_CLASS (cpu);if (cc->dump_statistics) { - cc->dump_statistics (cpu, f, cpu_fprintf, flags); + cc->dump_statistics (cpu, flags); } }
target/ppc/cpu.h +1 -2
@@ -1270,8 +1270,7 @@ void ppc_cpu_do_interrupt(CPUState *cpu);bool ppc_cpu_exec_interrupt (CPUState *cpu,int int_req);void ppc_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf,int flags); -void ppc_cpu_dump_statistics (CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void ppc_cpu_dump_statistics (CPUState *cpu,int flags);hwaddr ppc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int ppc_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int ppc_cpu_gdb_read_register_apple (CPUState *cpu,uint8_t *buf,int reg);
target/ppc/translate.c +4 -5
@@ -7593,8 +7593,7 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,#undef RFPL } -void ppc_cpu_dump_statistics (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags) +void ppc_cpu_dump_statistics (CPUState *cs,int flags) {#if defined(DO_PPC_STATISTICS )PowerPCCPU *cpu =POWERPC_CPU (cs);
@@ -7614,7 +7613,7 @@ void ppc_cpu_dump_statistics(CPUState *cs, FILE*f, handler = t3[op3];if (handler->count ==0 )continue ; - cpu_fprintf(f, "%02x %02x %02x (%02x %04d) %16s: " + qemu_printf("%02x %02x %02x (%02x %04d) %16s: " "%016" PRIx64 " %" PRId64 "\n", op1, op2, op3, op1, (op3 << 5) | op2, handler->oname,
@@ -7623,7 +7622,7 @@ void ppc_cpu_dump_statistics(CPUState *cs, FILE*f, }else {if (handler->count ==0 )continue ; -cpu_fprintf (f,"%02x %02x (%02x %04d) %16s: " +qemu_printf ("%02x %02x (%02x %04d) %16s: " "%016" PRIx64" %" PRId64"\n" , op1, op2, op1, op2, handler->oname, handler->count, handler->count);
@@ -7632,7 +7631,7 @@ void ppc_cpu_dump_statistics(CPUState *cs, FILE*f, }else {if (handler->count ==0 )continue ; -cpu_fprintf (f,"%02x (%02x ) %16s: %016" PRIx64 +qemu_printf ("%02x (%02x ) %16s: %016" PRIx64" %" PRId64"\n" , op1, op1, handler->oname, handler->count, handler->count);
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 06/36] block/ssh: Do not report read/write/flush errors to the user
In reply to Markus ArmbrusterCallbacks ssh_co_readv(), ssh_co_writev(), ssh_co_flush() report errors to the user with error_printf(). They shouldn't, it's their caller's job. Replace by a suitable trace point. While there, drop the unreachable !s->sftp case.
Perhaps we should convert this part of the block driver interface to Error, so block drivers can pass more detail to their callers. Not today.
Message-Id: <[email protected]>
--- block/ssh.c | 38 +++++++++++++------------------------- block/trace-events | 3 +++ 2 files changed, 16 insertions(+), 25 deletions(-)
block/ssh.c +13 -25
@@ -159,31 +159,19 @@ sftp_error_setg(Error **errp, BDRVSSHState *s, const char *fs, ...)g_free (msg); } -static void GCC_FMT_ATTR(2, 3) -sftp_error_report(BDRVSSHState *s, const char *fs, ...) +static void sftp_error_trace (BDRVSSHState *s,const char *op) { -va_list args; +char *ssh_err; +int ssh_err_code; +unsigned long sftp_err_code; -va_start (args, fs); -error_vprintf (fs, args); +/* This is not an errno. See <libssh2.h>. */ + ssh_err_code =libssh2_session_last_error (s->session, + &ssh_err,NULL ,0 ); +/* See <libssh2_sftp.h>. */ + sftp_err_code =libssh2_sftp_last_error ((s)->sftp); -if ((s)->sftp) { -char *ssh_err; -int ssh_err_code; -unsigned long sftp_err_code; - -/* This is not an errno. See <libssh2.h>. */ - ssh_err_code =libssh2_session_last_error (s->session, - &ssh_err,NULL ,0 ); -/* See <libssh2_sftp.h>. */ - sftp_err_code =libssh2_sftp_last_error ((s)->sftp); - -error_printf (": %s (libssh2 error code: %d, sftp error code: %lu)" , - ssh_err, ssh_err_code, sftp_err_code); - } - -va_end (args); -error_printf ("\n" ); +trace_sftp_error (op, ssh_err, ssh_err_code, sftp_err_code); }static int parse_uri (const char *filename,QDict *options,Error **errp)
@@ -1035,7 +1023,7 @@ static coroutine_fn int ssh_read(BDRVSSHState *s, BlockDriverState *bs, goto again; }if (r <0 ) { -sftp_error_report (s,"read failed" ); +sftp_error_trace (s,"read" ); s->offset =-1 ;return -EIO ; }
@@ -1105,7 +1093,7 @@ static int ssh_write(BDRVSSHState *s, BlockDriverState *bs, goto again; }if (r <0 ) { -sftp_error_report (s,"write failed" ); +sftp_error_trace (s,"write" ); s->offset =-1 ;return -EIO ; }
@@ -1188,7 +1176,7 @@ static coroutine_fn int ssh_flush(BDRVSSHState *s, BlockDriverState *bs)return 0 ; }if (r <0 ) { -sftp_error_report (s,"fsync failed" ); +sftp_error_trace (s,"fsync" );return -EIO ; }
block/trace-events +3 -0
@@ -208,3 +208,6 @@ sheepdog_co_rw_vector_new(uint64_t oid) "new oid 0x%" PRIx64 sheepdog_snapshot_create_info(const char *sn_name, const char *id, const char *name, int64_t size, int is_snapshot) "sn_info: name %s id_str %s s: name %s vm_state_size %" PRId64 " " "is_snapshot %d" sheepdog_snapshot_create(const char *sn_name, const char *id) "%s %s" sheepdog_snapshot_create_inode(const char *name, uint32_t snap, uint32_t vdi) "s->inode: name %s snap_id 0x%" PRIx32 " vdi 0x%" PRIx32 + +# ssh.c +sftp_error(const char *op, const char *ssh_err, int ssh_err_code, unsigned long sftp_err_code) "%s failed: %s (libssh2 error code: %d, sftp error code: %lu)"
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 29/36] target: Clean up how the dump_mmu() print
In reply to Markus ArmbrusterThe various dump_mmu() take an fprintf()-like callback and a FILE * to pass to it, and so do their helper functions. Passing around callback and argument is rather tiresome.
Most dump_mmu() are called only by the target's hmp_info_tlb(). These all pass monitor_printf() cast to fprintf_function and the current monitor cast to FILE *.
SPARC's dump_mmu() gets also called from target/sparc/ldst_helper.c a few times #ifdef DEBUG_MMU. These calls pass fprintf() and stdout.
The type-punning is technically undefined behaviour, but works in practice. Clean up: drop the callback, and call qemu_printf() instead.
Message-Id: <[email protected]>
--- target/m68k/cpu.h | 3 +- target/m68k/helper.c | 115 ++++++++++++++++++------------------- target/m68k/monitor.c | 2 +- target/nios2/cpu.h | 2 +- target/nios2/mmu.c | 7 ++- target/nios2/monitor.c | 2 +- target/ppc/cpu.h | 2 +- target/ppc/mmu-hash64.c | 7 ++- target/ppc/mmu-hash64.h | 2 +- target/ppc/mmu_helper.c | 70 +++++++++++----------- target/ppc/monitor.c | 2 +- target/sparc/cpu.h | 2 +- target/sparc/ldst_helper.c | 18 +++--- target/sparc/mmu_helper.c | 97 +++++++++++++++---------------- target/sparc/monitor.c | 2 +- target/xtensa/cpu.h | 2 +- target/xtensa/mmu_helper.c | 24 ++++---- target/xtensa/monitor.c | 2 +- 18 files changed, 178 insertions(+), 183 deletions(-)
target/m68k/cpu.h +2 -1
@@ -573,5 +573,6 @@ static inline void cpu_get_tb_cpu_state(CPUM68KState *env, target_ulong *pc, } } -void dump_mmu (FILE *f,fprintf_function cpu_fprintf,CPUM68KState *env); +void dump_mmu (CPUM68KState *env); +#endif
target/m68k/helper.c +56 -59
219 lines not on this page · raw message
target/m68k/monitor.c +1 -1
@@ -19,7 +19,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)return ; } -dump_mmu ((FILE *)mon, (fprintf_function )monitor_printf, env1); +dump_mmu (env1); }static const MonitorDef monitor_defs[] = {
target/nios2/cpu.h +1 -1
@@ -212,7 +212,7 @@ static inline Nios2CPU *nios2_env_get_cpu(CPUNios2State *env)void nios2_tcg_init (void );void nios2_cpu_do_interrupt (CPUState *cs);int cpu_nios2_signal_handler (int host_signum,void *pinfo,void *puc); -void dump_mmu (FILE *f,fprintf_function cpu_fprintf,CPUNios2State *env); +void dump_mmu (CPUNios2State *env);void nios2_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf,int flags);hwaddr nios2_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);
target/nios2/mmu.c +4 -3
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/qemu-print.h" #include "cpu.h" #include "exec/exec-all.h" #include "mmu.h"
@@ -264,18 +265,18 @@ void mmu_init(CPUNios2State *env) mmu->tlb =g_new0 (Nios2TLBEntry, cpu->tlb_num_entries); } -void dump_mmu (FILE *f,fprintf_function cpu_fprintf,CPUNios2State *env) +void dump_mmu (CPUNios2State *env) {Nios2CPU *cpu =nios2_env_get_cpu (env);int i; -cpu_fprintf (f,"MMU: ways %d, entries %d, pid bits %d\n" , +qemu_printf ("MMU: ways %d, entries %d, pid bits %d\n" , cpu->tlb_num_ways, cpu->tlb_num_entries, cpu->pid_num_bits);for (i =0 ; i < cpu->tlb_num_entries; i++) {Nios2TLBEntry *entry = &env->mmu.tlb[i]; - cpu_fprintf(f, "TLB[%d] = %08X %08X %c VPN %05X " + qemu_printf("TLB[%d] = %08X %08X %c VPN %05X " "PID %02X %c PFN %05X %c%c%c%c\n", i, entry->tag, entry->data, (entry->tag & (1 << 10)) ? 'V' : '-',
target/nios2/monitor.c +1 -1
@@ -31,5 +31,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) {CPUArchState *env1 =mon_get_cpu_env (); -dump_mmu ((FILE *)mon, (fprintf_function )monitor_printf, env1); +dump_mmu (env1); }
target/ppc/cpu.h +1 -1
@@ -2629,7 +2629,7 @@ static inline ppc_avr_t *cpu_avr_ptr(CPUPPCState *env, int i) return (ppc_avr_t *)((uintptr_t)env + avr_full_offset(i)); } -void dump_mmu (FILE *f,fprintf_function cpu_fprintf,CPUPPCState *env); +void dump_mmu (CPUPPCState *env);void ppc_maybe_bswap_register (CPUPPCState *env,uint8_t *mem_buf,int len);#endif /* PPC_CPU_H */
target/ppc/mmu-hash64.c +4 -3
@@ -22,6 +22,7 @@#include "exec/exec-all.h" #include "exec/helper-proto.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "sysemu/hw_accel.h" #include "kvm_ppc.h" #include "mmu-hash64.h"
@@ -71,7 +72,7 @@ static ppc_slb_t *slb_lookup(PowerPCCPU *cpu, target_ulong eaddr)return NULL ; } -void dump_slb (FILE *f,fprintf_function cpu_fprintf,PowerPCCPU *cpu) +void dump_slb (PowerPCCPU *cpu) {CPUPPCState *env = &cpu->env;int i;
@@ -79,14 +80,14 @@ void dump_slb(FILE *f, fprintf_function cpu_fprintf, PowerPCCPU *cpu)cpu_synchronize_state (CPU (cpu)); -cpu_fprintf (f,"SLB\tESID\t\t\tVSID\n" ); +qemu_printf ("SLB\tESID\t\t\tVSID\n" );for (i =0 ; i < cpu->hash64_opts->slb_size; i++) { slbe = env->slb[i].esid; slbv = env->slb[i].vsid;if (slbe ==0 && slbv ==0 ) {continue ; } -cpu_fprintf (f,"%d\t0x%016" PRIx64"\t0x%016" PRIx64"\n" , +qemu_printf ("%d\t0x%016" PRIx64"\t0x%016" PRIx64"\n" , i, slbe, slbv); } }
target/ppc/mmu-hash64.h +1 -1
@@ -4,7 +4,7 @@#ifndef CONFIG_USER_ONLY #ifdef TARGET_PPC64 -void dump_slb (FILE *f,fprintf_function cpu_fprintf,PowerPCCPU *cpu); +void dump_slb (PowerPCCPU *cpu);int ppc_store_slb (PowerPCCPU *cpu,target_ulong slot,target_ulong esid,target_ulong vsid);hwaddr ppc_hash64_get_phys_page_debug (PowerPCCPU *cpu,target_ulong addr);
target/ppc/mmu_helper.c +33 -37
203 lines not on this page · raw message
target/ppc/monitor.c +1 -1
@@ -66,7 +66,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)monitor_printf (mon,"No CPU available\n" );return ; } -dump_mmu ((FILE *)mon, (fprintf_function )monitor_printf, env1); +dump_mmu (env1); }const MonitorDef monitor_defs[] = {
target/sparc/cpu.h +1 -1
@@ -583,7 +583,7 @@ void sparc_cpu_list(void);int sparc_cpu_handle_mmu_fault (CPUState *cpu,vaddr address,int size,int rw,int mmu_idx);target_ulong mmu_probe (CPUSPARCState *env,target_ulong address,int mmulev); -void dump_mmu (FILE *f,fprintf_function cpu_fprintf,CPUSPARCState *env); +void dump_mmu (CPUSPARCState *env);#if !defined(TARGET_SPARC64 ) && !defined(CONFIG_USER_ONLY ) int sparc_cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
target/sparc/ldst_helper.c +9 -9
@@ -198,7 +198,7 @@ static void demap_tlb(SparcTLBEntry *tlb, target_ulong demap_addr,replace_tlb_entry (&tlb[i],0 ,0 , env1);#ifdef DEBUG_MMU DPRINTF_MMU ("%s demap invalidated entry [%02u]\n" , strmmu, i); -dump_mmu (stdout, fprintf, env1); +dump_mmu (env1);#endif } }
@@ -260,7 +260,7 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,replace_tlb_entry (&tlb[i], tlb_tag, tlb_tte, env1);#ifdef DEBUG_MMU DPRINTF_MMU ("%s lru replaced invalid entry [%i]\n" , strmmu, i); -dump_mmu (stdout, fprintf, env1); +dump_mmu (env1);#endif return ; }
@@ -279,7 +279,7 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,#ifdef DEBUG_MMU DPRINTF_MMU ("%s lru replaced unlocked %s entry [%i]\n" , strmmu, (replace_used ?"used" :"unused" ), i); -dump_mmu (stdout, fprintf, env1); +dump_mmu (env1);#endif return ; }
@@ -886,7 +886,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val,break ; }#ifdef DEBUG_MMU -dump_mmu (stdout, fprintf, env); +dump_mmu (env);#endif }break ;
@@ -941,7 +941,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val, reg, oldreg, env->mmuregs[reg]); }#ifdef DEBUG_MMU -dump_mmu (stdout, fprintf, env); +dump_mmu (env);#endif }break ;
@@ -1634,7 +1634,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, PRIx64 "\n", reg, oldreg, env->immuregs[reg]); }#ifdef DEBUG_MMU -dump_mmu (stdout, fprintf, env); +dump_mmu (env);#endif return ; }
@@ -1658,7 +1658,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, }#ifdef DEBUG_MMU DPRINTF_MMU ("immu data access replaced entry [%i]\n" , i); -dump_mmu (stdout, fprintf, env); +dump_mmu (env);#endif return ; }
@@ -1718,7 +1718,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]); }#ifdef DEBUG_MMU -dump_mmu (stdout, fprintf, env); +dump_mmu (env);#endif return ; }
@@ -1740,7 +1740,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val, }#ifdef DEBUG_MMU DPRINTF_MMU ("dmmu data access replaced entry [%i]\n" , i); -dump_mmu (stdout, fprintf, env); +dump_mmu (env);#endif return ; }
target/sparc/mmu_helper.c +49 -48
156 lines not on this page · raw message
target/sparc/monitor.c +1 -1
@@ -36,7 +36,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)monitor_printf (mon,"No CPU available\n" );return ; } -dump_mmu ((FILE *)mon, (fprintf_function )monitor_printf, env1); +dump_mmu (env1); }#ifndef TARGET_SPARC64
target/xtensa/cpu.h +1 -1
@@ -673,7 +673,7 @@ int xtensa_get_physical_addr(CPUXtensaState *env, bool update_tlb, uint32_t vaddr, int is_write, int mmu_idx, uint32_t *paddr, uint32_t *page_size, unsigned *access);void reset_mmu (CPUXtensaState *env); -void dump_mmu (FILE *f,fprintf_function cpu_fprintf,CPUXtensaState *env); +void dump_mmu (CPUXtensaState *env);static inline MemoryRegion *xtensa_get_er_region (CPUXtensaState *env) {
target/xtensa/mmu_helper.c +11 -13
@@ -27,6 +27,7 @@#include "qemu/osdep.h" #include "qemu/main-loop.h" +#include "qemu/qemu-print.h" #include "qemu/units.h" #include "cpu.h" #include "exec/helper-proto.h"
@@ -740,8 +741,7 @@ int xtensa_get_physical_addr(CPUXtensaState *env, bool update_tlb, } } -static void dump_tlb (FILE *f,fprintf_function cpu_fprintf, -CPUXtensaState *env,bool dtlb) +static void dump_tlb (CPUXtensaState *env,bool dtlb) {unsigned wi, ei; const xtensa_tlb *conf =
@@ -780,13 +780,11 @@ static void dump_tlb(FILE *f, fprintf_function cpu_fprintf,if (print_header) { print_header = false; -cpu_fprintf (f,"Way %u (%d %s)\n" , wi, sz, sz_text); -cpu_fprintf (f, -"\tVaddr Paddr ASID Attr RWX Cache\n" +qemu_printf ("Way %u (%d %s)\n" , wi, sz, sz_text); +qemu_printf ("\tVaddr Paddr ASID Attr RWX Cache\n" "\t---------- ---------- ---- ---- --- -------\n" ); } - cpu_fprintf(f, - "\t0x%08x 0x%08x 0x%02x 0x%02x %c%c%c %-7s\n", + qemu_printf("\t0x%08x 0x%08x 0x%02x 0x%02x %c%c%c %-7s\n", entry->vaddr, entry->paddr, entry->asid,
@@ -801,18 +799,18 @@ static void dump_tlb(FILE *f, fprintf_function cpu_fprintf, } } -void dump_mmu (FILE *f,fprintf_function cpu_fprintf,CPUXtensaState *env) +void dump_mmu (CPUXtensaState *env) {if (xtensa_option_bits_enabled (env->config,XTENSA_OPTION_BIT (XTENSA_OPTION_REGION_PROTECTION ) |XTENSA_OPTION_BIT (XTENSA_OPTION_REGION_TRANSLATION ) |XTENSA_OPTION_BIT (XTENSA_OPTION_MMU ))) { -cpu_fprintf (f,"ITLB:\n" ); -dump_tlb (f, cpu_fprintf, env, false); -cpu_fprintf (f,"\nDTLB:\n" ); -dump_tlb (f, cpu_fprintf, env, true); +qemu_printf ("ITLB:\n" ); +dump_tlb (env, false); +qemu_printf ("\nDTLB:\n" ); +dump_tlb (env, true); }else { -cpu_fprintf (f,"No TLB for this CPU core\n" ); +qemu_printf ("No TLB for this CPU core\n" ); } }
target/xtensa/monitor.c +1 -1
@@ -35,5 +35,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)monitor_printf (mon,"No CPU available\n" );return ; } -dump_mmu ((FILE *)mon, (fprintf_function )monitor_printf, env1); +dump_mmu (env1); }
Signature · 1 line
2.17.2
[Qemu-devel] [PULL for-4.1 33/36] qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
In reply to Markus ArmbrusterCPUClass method dump_statistics() takes an fprintf()-like callback and a FILE * to pass to it. Most callers pass fprintf() and stderr. log_cpu_state() passes fprintf() and qemu_log_file. hmp_info_registers() passes monitor_fprintf() and the current monitor cast to FILE *. monitor_fprintf() casts it right back, and is otherwise identical to monitor_printf().
The callback gets passed around a lot, which is tiresome. The type-punning around monitor_fprintf() is ugly.
Drop the callback, and call qemu_fprintf() instead. Also gets rid of the type-punning, since qemu_fprintf() takes NULL instead of the current monitor cast to FILE *.
Message-Id: <[email protected]>
--- accel/kvm/kvm-all.c | 4 +- bsd-user/main.c | 2 +- cpus.c | 2 +- exec.c | 2 +- include/exec/log.h | 2 +- include/qom/cpu.h | 11 +- linux-user/alpha/cpu_loop.c | 2 +- linux-user/cpu_loop-common.h | 2 +- linux-user/cris/cpu_loop.c | 2 +- linux-user/microblaze/cpu_loop.c | 4 +- linux-user/s390x/cpu_loop.c | 4 +- linux-user/sh4/cpu_loop.c | 2 +- linux-user/sparc/cpu_loop.c | 2 +- monitor.c | 4 +- qom/cpu.c | 6 +- target/alpha/cpu.h | 3 +- target/alpha/helper.c | 24 +-- target/arm/arm-semi.c | 2 +- target/arm/cpu.h | 3 +- target/arm/translate-a64.c | 82 ++++----- target/arm/translate.c | 58 +++---- target/arm/translate.h | 7 +- target/cris/cpu.h | 3 +- target/cris/helper.c | 2 +- target/cris/translate.c | 36 ++-- target/hppa/cpu.h | 2 +- target/hppa/helper.c | 24 +-- target/i386/cpu.h | 3 +- target/i386/hax-all.c | 4 +- target/i386/helper.c | 277 +++++++++++++++---------------- target/lm32/cpu.h | 3 +- target/lm32/translate.c | 36 ++-- target/m68k/cpu.h | 3 +- target/m68k/translate.c | 86 +++++----- target/microblaze/cpu.h | 3 +- target/microblaze/helper.c | 2 +- target/microblaze/translate.c | 39 ++--- target/mips/internal.h | 3 +- target/mips/translate.c | 76 ++++----- target/moxie/cpu.h | 3 +- target/moxie/helper.c | 2 +- target/moxie/translate.c | 22 +-- target/nios2/cpu.h | 3 +- target/nios2/helper.c | 2 +- target/nios2/translate.c | 24 +-- target/openrisc/cpu.h | 3 +- target/openrisc/translate.c | 11 +- target/ppc/cpu.h | 3 +- target/ppc/translate.c | 161 +++++++++--------- target/riscv/cpu.c | 37 ++--- target/s390x/helper.c | 42 ++--- target/s390x/internal.h | 3 +- target/sh4/cpu.h | 3 +- target/sh4/translate.c | 27 +-- target/sparc/cpu.c | 84 +++++----- target/sparc/cpu.h | 3 +- target/tilegx/cpu.c | 14 +- target/tricore/cpu.h | 3 +- target/tricore/translate.c | 26 +-- target/unicore32/cpu.h | 3 +- target/unicore32/translate.c | 39 +++-- target/xtensa/cpu.h | 3 +- target/xtensa/translate.c | 40 ++--- 63 files changed, 682 insertions(+), 711 deletions(-)
accel/kvm/kvm-all.c +2 -2
@@ -1798,7 +1798,7 @@ static int kvm_handle_internal_error(CPUState *cpu, struct kvm_run *run)if (run->internal.suberror ==KVM_INTERNAL_ERROR_EMULATION ) {fprintf (stderr,"emulation failure\n" );if (!kvm_arch_stop_on_emulation_error (cpu)) { -cpu_dump_state (cpu, stderr, fprintf,CPU_DUMP_CODE ); +cpu_dump_state (cpu, stderr,CPU_DUMP_CODE );return EXCP_INTERRUPT ; } }
@@ -2089,7 +2089,7 @@ int kvm_cpu_exec(CPUState *cpu)qemu_mutex_lock_iothread ();if (ret <0 ) { -cpu_dump_state (cpu, stderr, fprintf,CPU_DUMP_CODE ); +cpu_dump_state (cpu, stderr,CPU_DUMP_CODE );vm_stop (RUN_STATE_INTERNAL_ERROR ); }
bsd-user/main.c +1 -1
@@ -640,7 +640,7 @@ void cpu_loop(CPUSPARCState *env) badtrap:#endif printf ("Unhandled trap: 0x%x\n" , trapnr); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (1 ); }process_pending_signals (env);
cpus.c +1 -1
@@ -1010,7 +1010,7 @@ void hw_error(const char *fmt, ...)fprintf (stderr,"\n" );CPU_FOREACH (cpu) {fprintf (stderr,"CPU #%d:\n" , cpu->cpu_index); -cpu_dump_state (cpu, stderr, fprintf,CPU_DUMP_FPU ); +cpu_dump_state (cpu, stderr,CPU_DUMP_FPU ); }va_end (ap);abort ();
exec.c +1 -1
@@ -1256,7 +1256,7 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...)fprintf (stderr,"qemu: fatal: " );vfprintf (stderr, fmt, ap);fprintf (stderr,"\n" ); -cpu_dump_state (cpu, stderr, fprintf,CPU_DUMP_FPU |CPU_DUMP_CCOP ); +cpu_dump_state (cpu, stderr,CPU_DUMP_FPU |CPU_DUMP_CCOP );if (qemu_log_separate ()) {qemu_log_lock ();qemu_log ("qemu: fatal: " );
include/exec/log.h +1 -1
@@ -16,7 +16,7 @@static inline void log_cpu_state (CPUState *cpu,int flags) {if (qemu_log_enabled ()) { -cpu_dump_state (cpu, qemu_logfile, fprintf, flags); +cpu_dump_state (cpu, qemu_logfile, flags); } }
include/qom/cpu.h +3 -8
@@ -26,7 +26,6 @@#include "exec/memattrs.h" #include "qapi/qapi-types-run-state.h" #include "qemu/bitmap.h" -#include "qemu/fprintf-fn.h" #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/thread.h"
@@ -181,8 +180,7 @@ typedef struct CPUClass {bool (*virtio_is_big_endian)(CPUState *cpu);int (*memory_rw_debug)(CPUState *cpu,vaddr addr,uint8_t *buf,int len,bool is_write); -void (*dump_state)(CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void (*dump_state)(CPUState *cpu,FILE *,int flags); GuestPanicInformation* (*get_crash_info)(CPUState *cpu);void (*dump_statistics)(CPUState *cpu,int flags);int64_t (*get_arch_id)(CPUState *cpu);
@@ -563,14 +561,11 @@ enum CPUDumpFlags {/** * 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. +* @f: If non-null, dump to this stream, else to current print sink. * * Dumps CPU state. */ -void cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void cpu_dump_state (CPUState *cpu,FILE *f,int flags);/** * cpu_dump_statistics:
linux-user/alpha/cpu_loop.c +1 -1
@@ -193,7 +193,7 @@ void cpu_loop(CPUAlphaState *env)break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (EXIT_FAILURE ); }process_pending_signals (env);
linux-user/cpu_loop-common.h +1 -1
@@ -26,7 +26,7 @@ do { \ CPUState *cs = ENV_GET_CPU(env); \ fprintf(stderr, fmt , ## __VA_ARGS__); \ - cpu_dump_state(cs, stderr, fprintf, 0); \ + cpu_dump_state(cs, stderr, 0); \ if (qemu_log_separate()) { \ qemu_log(fmt, ## __VA_ARGS__); \ log_cpu_state(cs, 0); \
linux-user/cris/cpu_loop.c +1 -1
@@ -74,7 +74,7 @@ void cpu_loop(CPUCRISState *env)break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (EXIT_FAILURE ); }process_pending_signals (env);
linux-user/microblaze/cpu_loop.c +2 -2
@@ -107,7 +107,7 @@ void cpu_loop(CPUMBState *env)default :fprintf (stderr,"Unhandled hw-exception: 0x%" PRIx64"\n" , env->sregs[SR_ESR ] &ESR_EC_MASK ); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (EXIT_FAILURE );break ; }
@@ -123,7 +123,7 @@ void cpu_loop(CPUMBState *env)break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (EXIT_FAILURE ); }process_pending_signals (env);
linux-user/s390x/cpu_loop.c +2 -2
@@ -124,7 +124,7 @@ void cpu_loop(CPUS390XState *env)default :fprintf (stderr,"Unhandled program exception: %#x\n" , n); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (EXIT_FAILURE ); }break ;
@@ -144,7 +144,7 @@ void cpu_loop(CPUS390XState *env)break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (EXIT_FAILURE ); }process_pending_signals (env);
linux-user/sh4/cpu_loop.c +1 -1
@@ -76,7 +76,7 @@ void cpu_loop(CPUSH4State *env)break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (EXIT_FAILURE ); }process_pending_signals (env);
linux-user/sparc/cpu_loop.c +1 -1
@@ -278,7 +278,7 @@ void cpu_loop (CPUSPARCState *env)break ;default :fprintf (stderr,"Unhandled trap: 0x%x\n" , trapnr); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );exit (EXIT_FAILURE ); }process_pending_signals (env);
monitor.c +2 -2
@@ -1296,7 +1296,7 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)if (all_cpus) {CPU_FOREACH (cs) {monitor_printf (mon,"\nCPU#%d\n" , cs->cpu_index); -cpu_dump_state (cs, (FILE *)mon, monitor_fprintf,CPU_DUMP_FPU ); +cpu_dump_state (cs,NULL ,CPU_DUMP_FPU ); } }else { cs =mon_get_cpu ();
@@ -1306,7 +1306,7 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)return ; } -cpu_dump_state (cs, (FILE *)mon, monitor_fprintf,CPU_DUMP_FPU ); +cpu_dump_state (cs,NULL ,CPU_DUMP_FPU ); } }
qom/cpu.c +3 -3
@@ -28,6 +28,7 @@#include "exec/log.h" #include "exec/cpu-common.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/qdev-properties.h"
@@ -219,14 +220,13 @@ GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)return res; } -void cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags) +void cpu_dump_state (CPUState *cpu,FILE *f,int flags) {CPUClass *cc =CPU_GET_CLASS (cpu);if (cc->dump_state) {cpu_synchronize_state (cpu); - cc->dump_state (cpu, f, cpu_fprintf, flags); + cc->dump_state (cpu, f, flags); } }
target/alpha/cpu.h +1 -2
@@ -311,8 +311,7 @@ extern const struct VMStateDescription vmstate_alpha_cpu;void alpha_cpu_do_interrupt (CPUState *cpu);bool alpha_cpu_exec_interrupt (CPUState *cpu,int int_req); -void alpha_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags); +void alpha_cpu_dump_state (CPUState *cs,FILE *f,int flags);hwaddr alpha_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int alpha_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int alpha_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/alpha/helper.c +12 -12
@@ -23,6 +23,7 @@#include "exec/exec-all.h" #include "fpu/softfloat.h" #include "exec/helper-proto.h" +#include "qemu/qemu-print.h" #define CONVERT_BIT (X ,SRC ,DST ) \
@@ -426,8 +427,7 @@ bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)return false; } -void alpha_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags) +void alpha_cpu_dump_state (CPUState *cs,FILE *f,int flags) {static const char *linux_reg_names[] = {"v0 " ,"t0 " ,"t1 " ,"t2 " ,"t3 " ,"t4 " ,"t5 " ,"t6 " ,
@@ -439,24 +439,24 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,CPUAlphaState *env = &cpu->env;int i; -cpu_fprintf (f," PC " TARGET_FMT_lx" PS %02x\n" , - env->pc,extract32 (env->flags,ENV_FLAG_PS_SHIFT ,8 )); +qemu_fprintf (f," PC " TARGET_FMT_lx" PS %02x\n" , + env->pc,extract32 (env->flags,ENV_FLAG_PS_SHIFT ,8 ));for (i =0 ; i <31 ; i++) { -cpu_fprintf (f,"IR%02d %s " TARGET_FMT_lx"%c" , i, - linux_reg_names[i],cpu_alpha_load_gr (env, i), - (i %3 ) ==2 ?'\n' :' ' ); +qemu_fprintf (f,"IR%02d %s " TARGET_FMT_lx"%c" , i, + linux_reg_names[i],cpu_alpha_load_gr (env, i), + (i %3 ) ==2 ?'\n' :' ' ); } -cpu_fprintf (f,"lock_a " TARGET_FMT_lx" lock_v " TARGET_FMT_lx"\n" , - env->lock_addr, env->lock_value); +qemu_fprintf (f,"lock_a " TARGET_FMT_lx" lock_v " TARGET_FMT_lx"\n" , + env->lock_addr, env->lock_value);if (flags &CPU_DUMP_FPU ) {for (i =0 ; i <31 ; i++) { -cpu_fprintf (f,"FIR%02d %016" PRIx64"%c" , i, env->fir[i], - (i %3 ) ==2 ?'\n' :' ' ); +qemu_fprintf (f,"FIR%02d %016" PRIx64"%c" , i, env->fir[i], + (i %3 ) ==2 ?'\n' :' ' ); } } -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); }/* This should only be called from translate, via gen_excp.
target/arm/arm-semi.c +1 -1
@@ -650,7 +650,7 @@ target_ulong do_arm_semihosting(CPUARMState *env)/* fall through -- invalid for A32/T32 */ default :fprintf (stderr,"qemu: Unsupported SemiHosting SWI 0x%02x\n" , nr); -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );abort (); } }
target/arm/cpu.h +1 -2
@@ -935,8 +935,7 @@ void arm_cpu_do_interrupt(CPUState *cpu);void arm_v7m_cpu_do_interrupt (CPUState *cpu);bool arm_cpu_exec_interrupt (CPUState *cpu,int int_req); -void arm_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags); +void arm_cpu_dump_state (CPUState *cs,FILE *f,int flags);hwaddr arm_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr,MemTxAttrs *attrs);
target/arm/translate-a64.c +41 -41
154 lines not on this page · raw message
target/arm/translate.c +29 -29
101 lines not on this page · raw message
target/arm/translate.h +2 -5
@@ -166,8 +166,7 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)#ifdef TARGET_AARCH64 void a64_translate_init (void );void gen_a64_set_pc_im (uint64_t val); -void aarch64_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags); +void aarch64_cpu_dump_state (CPUState *cs,FILE *f,int flags);extern const TranslatorOps aarch64_translator_ops;#else static inline void a64_translate_init (void )
@@ -178,9 +177,7 @@ static inline void gen_a64_set_pc_im(uint64_t val) { } -static inline void aarch64_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf, -int flags) +static inline void aarch64_cpu_dump_state (CPUState *cs,FILE *f,int flags) { }#endif
target/cris/cpu.h +1 -2
@@ -207,8 +207,7 @@ void cris_cpu_do_interrupt(CPUState *cpu);void crisv10_cpu_do_interrupt (CPUState *cpu);bool cris_cpu_exec_interrupt (CPUState *cpu,int int_req); -void cris_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags); +void cris_cpu_dump_state (CPUState *cs,FILE *f,int flags);hwaddr cris_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);
target/cris/helper.c +1 -1
@@ -60,7 +60,7 @@ int cris_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, cs->exception_index =0xaa ; cpu->env.pregs[PR_EDA ] = address; -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );return 1 ; }
target/cris/translate.c +18 -18
@@ -33,6 +33,7 @@#include "exec/cpu_ldst.h" #include "exec/translator.h" #include "crisv32-decode.h" +#include "qemu/qemu-print.h" #include "exec/helper-gen.h"
@@ -3299,8 +3300,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)#endif } -void cris_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags) +void cris_cpu_dump_state (CPUState *cs,FILE *f,int flags) {CRISCPU *cpu =CRIS_CPU (cs);CPUCRISState *env = &cpu->env;
@@ -3308,7 +3308,7 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,const char **pregnames;int i; -if (!env || !f) { +if (!env) {return ; }if (env->pregs[PR_VR ] <32 ) {
@@ -3319,40 +3319,40 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, regnames = regnames_v32; } -cpu_fprintf (f,"PC=%x CCS=%x btaken=%d btarget=%x\n" -"cc_op=%d cc_src=%d cc_dest=%d cc_result=%x cc_mask=%x\n" , - env->pc, env->pregs[PR_CCS ], env->btaken, env->btarget, - env->cc_op, - env->cc_src, env->cc_dest, env->cc_result, env->cc_mask); +qemu_fprintf (f,"PC=%x CCS=%x btaken=%d btarget=%x\n" +"cc_op=%d cc_src=%d cc_dest=%d cc_result=%x cc_mask=%x\n" , + env->pc, env->pregs[PR_CCS ], env->btaken, env->btarget, + env->cc_op, + env->cc_src, env->cc_dest, env->cc_result, env->cc_mask);for (i =0 ; i <16 ; i++) { -cpu_fprintf (f,"%s=%8.8x " , regnames[i], env->regs[i]); +qemu_fprintf (f,"%s=%8.8x " , regnames[i], env->regs[i]);if ((i +1 ) %4 ==0 ) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); } } -cpu_fprintf (f,"\nspecial regs:\n" ); +qemu_fprintf (f,"\nspecial regs:\n" );for (i =0 ; i <16 ; i++) { -cpu_fprintf (f,"%s=%8.8x " , pregnames[i], env->pregs[i]); +qemu_fprintf (f,"%s=%8.8x " , pregnames[i], env->pregs[i]);if ((i +1 ) %4 ==0 ) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); } }if (env->pregs[PR_VR ] >=32 ) {uint32_t srs = env->pregs[PR_SRS ]; -cpu_fprintf (f,"\nsupport function regs bank %x:\n" , srs); +qemu_fprintf (f,"\nsupport function regs bank %x:\n" , srs);if (srs <ARRAY_SIZE (env->sregs)) {for (i =0 ; i <16 ; i++) { -cpu_fprintf (f,"s%2.2d=%8.8x " , - i, env->sregs[srs][i]); +qemu_fprintf (f,"s%2.2d=%8.8x " , + i, env->sregs[srs][i]);if ((i +1 ) %4 ==0 ) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); } } } } -cpu_fprintf (f,"\n\n" ); +qemu_fprintf (f,"\n\n" ); }
target/hppa/cpu.h +1 -1
@@ -359,7 +359,7 @@ int hppa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);int hppa_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);void hppa_cpu_do_interrupt (CPUState *cpu);bool hppa_cpu_exec_interrupt (CPUState *cpu,int int_req); -void hppa_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function ,int ); +void hppa_cpu_dump_state (CPUState *cs,FILE *f,int );#ifdef CONFIG_USER_ONLY int hppa_cpu_handle_mmu_fault (CPUState *cpu,vaddr address,int size,int rw,int midx);
target/hppa/helper.c +12 -12
@@ -23,6 +23,7 @@#include "fpu/softfloat.h" #include "exec/exec-all.h" #include "exec/helper-proto.h" +#include "qemu/qemu-print.h" target_ureg cpu_hppa_get_psw (CPUHPPAState *env) {
@@ -76,8 +77,7 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw) } } -void hppa_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags) +void hppa_cpu_dump_state (CPUState *cs,FILE *f,int flags) {HPPACPU *cpu =HPPA_CPU (cs);CPUHPPAState *env = &cpu->env;
@@ -86,9 +86,9 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f,char psw_c[20 ];int i; -cpu_fprintf (f,"IA_F " TARGET_FMT_lx" IA_B " TARGET_FMT_lx"\n" , -hppa_form_gva_psw (psw, env->iasq_f, env->iaoq_f), -hppa_form_gva_psw (psw, env->iasq_b, env->iaoq_b)); +qemu_fprintf (f,"IA_F " TARGET_FMT_lx" IA_B " TARGET_FMT_lx"\n" , +hppa_form_gva_psw (psw, env->iasq_f, env->iaoq_f), +hppa_form_gva_psw (psw, env->iasq_b, env->iaoq_b)); psw_c[0 ] = (psw &PSW_W ?'W' :'-' ); psw_c[1 ] = (psw &PSW_E ?'E' :'-' );
@@ -111,20 +111,20 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f, psw_c[18 ] ='\0' ; psw_cb = ((env->psw_cb >>4 ) &0x01111111 ) | (env->psw_cb_msb <<28 ); -cpu_fprintf (f,"PSW " TREG_FMT_lx" CB " TREG_FMT_lx" %s\n" , - psw, psw_cb, psw_c); +qemu_fprintf (f,"PSW " TREG_FMT_lx" CB " TREG_FMT_lx" %s\n" , + psw, psw_cb, psw_c);for (i =0 ; i <32 ; i++) { -cpu_fprintf (f,"GR%02d " TREG_FMT_lx"%c" , i, env->gr[i], - (i &3 ) ==3 ?'\n' :' ' ); +qemu_fprintf (f,"GR%02d " TREG_FMT_lx"%c" , i, env->gr[i], + (i &3 ) ==3 ?'\n' :' ' ); }#ifndef CONFIG_USER_ONLY for (i =0 ; i <8 ; i++) { -cpu_fprintf (f,"SR%02d %08x%c" , i, (uint32_t )(env->sr[i] >>32 ), - (i &3 ) ==3 ?'\n' :' ' ); +qemu_fprintf (f,"SR%02d %08x%c" , i, (uint32_t )(env->sr[i] >>32 ), + (i &3 ) ==3 ?'\n' :' ' ); }#endif -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" );/* ??? FR */ }
target/i386/cpu.h +1 -2
@@ -1521,8 +1521,7 @@ int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,void x86_cpu_get_memory_mapping (CPUState *cpu,MemoryMappingList *list,Error **errp); -void x86_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags); +void x86_cpu_dump_state (CPUState *cs,FILE *f,int flags);hwaddr x86_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);
target/i386/hax-all.c +2 -2
@@ -540,7 +540,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) ht->_exit_reason);qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );hax_vcpu_sync_state (env,0 ); -cpu_dump_state (cpu, stderr, fprintf,0 ); +cpu_dump_state (cpu, stderr,0 ); ret =-1 ;break ;case HAX_EXIT_HLT :
@@ -571,7 +571,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)fprintf (stderr,"Unknown exit %x from HAX\n" , ht->_exit_status);qemu_system_reset_request (SHUTDOWN_CAUSE_GUEST_RESET );hax_vcpu_sync_state (env,0 ); -cpu_dump_state (cpu, stderr, fprintf,0 ); +cpu_dump_state (cpu, stderr,0 ); ret =1 ;break ; }
target/i386/helper.c +138 -139
378 lines not on this page · raw message
target/lm32/cpu.h +1 -2
@@ -219,8 +219,7 @@ extern const struct VMStateDescription vmstate_lm32_cpu;void lm32_cpu_do_interrupt (CPUState *cpu);bool lm32_cpu_exec_interrupt (CPUState *cs,int int_req); -void lm32_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void lm32_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr lm32_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int lm32_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int lm32_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/lm32/translate.c +18 -18
@@ -24,6 +24,7 @@#include "exec/exec-all.h" #include "exec/translator.h" #include "tcg-op.h" +#include "qemu/qemu-print.h" #include "exec/cpu_ldst.h" #include "hw/lm32/lm32_pic.h"
@@ -1161,38 +1162,37 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)#endif } -void lm32_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags) +void lm32_cpu_dump_state (CPUState *cs,FILE *f,int flags) {LM32CPU *cpu =LM32_CPU (cs);CPULM32State *env = &cpu->env;int i; -if (!env || !f) { +if (!env) {return ; } -cpu_fprintf (f,"IN: PC=%x %s\n" , - env->pc,lookup_symbol (env->pc)); +qemu_fprintf (f,"IN: PC=%x %s\n" , + env->pc,lookup_symbol (env->pc)); -cpu_fprintf (f,"ie=%8.8x (IE=%x EIE=%x BIE=%x) im=%8.8x ip=%8.8x\n" , - env->ie, - (env->ie &IE_IE ) ?1 :0 , - (env->ie &IE_EIE ) ?1 :0 , - (env->ie &IE_BIE ) ?1 :0 , -lm32_pic_get_im (env->pic_state), -lm32_pic_get_ip (env->pic_state)); -cpu_fprintf (f,"eba=%8.8x deba=%8.8x\n" , - env->eba, - env->deba); +qemu_fprintf (f,"ie=%8.8x (IE=%x EIE=%x BIE=%x) im=%8.8x ip=%8.8x\n" , + env->ie, + (env->ie &IE_IE ) ?1 :0 , + (env->ie &IE_EIE ) ?1 :0 , + (env->ie &IE_BIE ) ?1 :0 , +lm32_pic_get_im (env->pic_state), +lm32_pic_get_ip (env->pic_state)); +qemu_fprintf (f,"eba=%8.8x deba=%8.8x\n" , + env->eba, + env->deba);for (i =0 ; i <32 ; i++) { -cpu_fprintf (f,"r%2.2d=%8.8x " , i, env->regs[i]); +qemu_fprintf (f,"r%2.2d=%8.8x " , i, env->regs[i]);if ((i +1 ) %4 ==0 ) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); } } -cpu_fprintf (f,"\n\n" ); +qemu_fprintf (f,"\n\n" ); } void restore_state_to_opc(CPULM32State *env, TranslationBlock *tb,
target/m68k/cpu.h +1 -2
@@ -179,8 +179,7 @@ static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)void m68k_cpu_do_interrupt (CPUState *cpu);bool m68k_cpu_exec_interrupt (CPUState *cpu,int int_req); -void m68k_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void m68k_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr m68k_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int m68k_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int m68k_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/m68k/translate.c +43 -43
125 lines not on this page · raw message
target/microblaze/cpu.h +1 -2
@@ -328,8 +328,7 @@ static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env)void mb_cpu_do_interrupt (CPUState *cs);bool mb_cpu_exec_interrupt (CPUState *cs,int int_req); -void mb_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void mb_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr mb_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int mb_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int mb_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/microblaze/helper.c +1 -1
@@ -42,7 +42,7 @@ int mb_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, int mmu_idx) { cs->exception_index =0xaa ; -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );return 1 ; }
target/microblaze/translate.c +20 -19
@@ -28,6 +28,7 @@#include "exec/cpu_ldst.h" #include "exec/helper-gen.h" #include "exec/translator.h" +#include "qemu/qemu-print.h" #include "trace-tcg.h" #include "exec/log.h"
@@ -1785,36 +1786,36 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)assert (!dc->abort_at_next_insn); } -void mb_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags) +void mb_cpu_dump_state (CPUState *cs,FILE *f,int flags) {MicroBlazeCPU *cpu =MICROBLAZE_CPU (cs);CPUMBState *env = &cpu->env;int i; -if (!env || !f) +if (!env) {return ; + } -cpu_fprintf (f,"IN: PC=%" PRIx64" %s\n" , - env->sregs[SR_PC ],lookup_symbol (env->sregs[SR_PC ])); -cpu_fprintf (f,"rmsr=%" PRIx64" resr=%" PRIx64" rear=%" PRIx64" " -"debug=%x imm=%x iflags=%x fsr=%" PRIx64"\n" , - env->sregs[SR_MSR ], env->sregs[SR_ESR ], env->sregs[SR_EAR ], - env->debug, env->imm, env->iflags, env->sregs[SR_FSR ]); -cpu_fprintf (f,"btaken=%d btarget=%" PRIx64" mode=%s(saved=%s) " -"eip=%d ie=%d\n" , - env->btaken, env->btarget, - (env->sregs[SR_MSR ] &MSR_UM ) ?"user" :"kernel" , - (env->sregs[SR_MSR ] &MSR_UMS ) ?"user" :"kernel" , - (bool )(env->sregs[SR_MSR ] &MSR_EIP ), - (bool )(env->sregs[SR_MSR ] &MSR_IE )); +qemu_fprintf (f,"IN: PC=%" PRIx64" %s\n" , + env->sregs[SR_PC ],lookup_symbol (env->sregs[SR_PC ])); +qemu_fprintf (f,"rmsr=%" PRIx64" resr=%" PRIx64" rear=%" PRIx64" " +"debug=%x imm=%x iflags=%x fsr=%" PRIx64"\n" , + env->sregs[SR_MSR ], env->sregs[SR_ESR ], env->sregs[SR_EAR ], + env->debug, env->imm, env->iflags, env->sregs[SR_FSR ]); +qemu_fprintf (f,"btaken=%d btarget=%" PRIx64" mode=%s(saved=%s) " +"eip=%d ie=%d\n" , + env->btaken, env->btarget, + (env->sregs[SR_MSR ] &MSR_UM ) ?"user" :"kernel" , + (env->sregs[SR_MSR ] &MSR_UMS ) ?"user" :"kernel" , + (bool )(env->sregs[SR_MSR ] &MSR_EIP ), + (bool )(env->sregs[SR_MSR ] &MSR_IE ));for (i =0 ; i <32 ; i++) { -cpu_fprintf (f,"r%2.2d=%8.8x " , i, env->regs[i]); +qemu_fprintf (f,"r%2.2d=%8.8x " , i, env->regs[i]);if ((i +1 ) %4 ==0 ) -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); } -cpu_fprintf (f,"\n\n" ); +qemu_fprintf (f,"\n\n" ); }void mb_tcg_init (void )
target/mips/internal.h +1 -2
@@ -76,8 +76,7 @@ enum CPUMIPSMSADataFormat {void mips_cpu_do_interrupt (CPUState *cpu);bool mips_cpu_exec_interrupt (CPUState *cpu,int int_req); -void mips_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void mips_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr mips_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int mips_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int mips_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/mips/translate.c +38 -38
114 lines not on this page · raw message
target/moxie/cpu.h +1 -2
@@ -112,8 +112,7 @@ static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env)#define ENV_OFFSET offsetof(MoxieCPU, env)void moxie_cpu_do_interrupt (CPUState *cs); -void moxie_cpu_dump_state (CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void moxie_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr moxie_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);void moxie_translate_init (void ); int cpu_moxie_signal_handler(int host_signum, void *pinfo,
target/moxie/helper.c +1 -1
@@ -101,7 +101,7 @@ int moxie_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, cs->exception_index =0xaa ; cpu->env.debug1 = address; -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 );return 1 ; }
target/moxie/translate.c +11 -11
@@ -28,6 +28,7 @@#include "disas/disas.h" #include "tcg-op.h" #include "exec/cpu_ldst.h" +#include "qemu/qemu-print.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h"
@@ -69,24 +70,23 @@ static int extract_branch_offset(int opcode)return (((signed short )((opcode & ((1 <<10 ) -1 )) <<6 )) >>6 ) <<1 ; } -void moxie_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags) +void moxie_cpu_dump_state (CPUState *cs,FILE *f,int flags) {MoxieCPU *cpu =MOXIE_CPU (cs);CPUMoxieState *env = &cpu->env;int i; -cpu_fprintf (f,"pc=0x%08x\n" , env->pc); -cpu_fprintf (f,"$fp=0x%08x $sp=0x%08x $r0=0x%08x $r1=0x%08x\n" , - env->gregs[0 ], env->gregs[1 ], env->gregs[2 ], env->gregs[3 ]); +qemu_fprintf (f,"pc=0x%08x\n" , env->pc); +qemu_fprintf (f,"$fp=0x%08x $sp=0x%08x $r0=0x%08x $r1=0x%08x\n" , + env->gregs[0 ], env->gregs[1 ], env->gregs[2 ], env->gregs[3 ]);for (i =4 ; i <16 ; i +=4 ) { -cpu_fprintf (f,"$r%d=0x%08x $r%d=0x%08x $r%d=0x%08x $r%d=0x%08x\n" , - i-2 , env->gregs[i], i-1 , env->gregs[i +1 ], - i, env->gregs[i +2 ], i+1 , env->gregs[i +3 ]); +qemu_fprintf (f,"$r%d=0x%08x $r%d=0x%08x $r%d=0x%08x $r%d=0x%08x\n" , + i -2 , env->gregs[i], i -1 , env->gregs[i +1 ], + i, env->gregs[i +2 ], i +1 , env->gregs[i +3 ]); }for (i =4 ; i <16 ; i +=4 ) { -cpu_fprintf (f,"sr%d=0x%08x sr%d=0x%08x sr%d=0x%08x sr%d=0x%08x\n" , - i-2 , env->sregs[i], i-1 , env->sregs[i +1 ], - i, env->sregs[i +2 ], i+1 , env->sregs[i +3 ]); +qemu_fprintf (f,"sr%d=0x%08x sr%d=0x%08x sr%d=0x%08x sr%d=0x%08x\n" , + i -2 , env->sregs[i], i -1 , env->sregs[i +1 ], + i, env->sregs[i +2 ], i +1 , env->sregs[i +3 ]); } }
target/nios2/cpu.h +1 -2
@@ -213,8 +213,7 @@ void nios2_tcg_init(void);void nios2_cpu_do_interrupt (CPUState *cs);int cpu_nios2_signal_handler (int host_signum,void *pinfo,void *puc);void dump_mmu (CPUNios2State *env); -void nios2_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void nios2_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr nios2_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type,
target/nios2/helper.c +1 -1
@@ -42,7 +42,7 @@ int nios2_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, cs->exception_index =0xaa ;/* Page 0x1000 is kuser helper */ if (address <0x1000 || address >=0x2000 ) { -cpu_dump_state (cs, stderr, fprintf,0 ); +cpu_dump_state (cs, stderr,0 ); }return 1 ; }
target/nios2/translate.c +12 -12
@@ -31,6 +31,7 @@#include "exec/log.h" #include "exec/cpu_ldst.h" #include "exec/translator.h" +#include "qemu/qemu-print.h" /* is_jmp field values */ #define DISAS_JUMP DISAS_TARGET_0/* only pc was modified dynamically */
@@ -914,33 +915,32 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)#endif } -void nios2_cpu_dump_state (CPUState *cs,FILE *f,fprintf_function cpu_fprintf, -int flags) +void nios2_cpu_dump_state (CPUState *cs,FILE *f,int flags) {Nios2CPU *cpu =NIOS2_CPU (cs);CPUNios2State *env = &cpu->env;int i; -if (!env || !f) { +if (!env) {return ; } -cpu_fprintf (f,"IN: PC=%x %s\n" , - env->regs[R_PC ],lookup_symbol (env->regs[R_PC ])); +qemu_fprintf (f,"IN: PC=%x %s\n" , + env->regs[R_PC ],lookup_symbol (env->regs[R_PC ]));for (i =0 ; i <NUM_CORE_REGS ; i++) { -cpu_fprintf (f,"%9s=%8.8x " , regnames[i], env->regs[i]); +qemu_fprintf (f,"%9s=%8.8x " , regnames[i], env->regs[i]);if ((i +1 ) %4 ==0 ) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); } }#if !defined(CONFIG_USER_ONLY ) -cpu_fprintf (f," mmu write: VPN=%05X PID %02X TLBACC %08X\n" , - env->mmu.pteaddr_wr &CR_PTEADDR_VPN_MASK , - (env->mmu.tlbmisc_wr &CR_TLBMISC_PID_MASK ) >>4 , - env->mmu.tlbacc_wr); +qemu_fprintf (f," mmu write: VPN=%05X PID %02X TLBACC %08X\n" , + env->mmu.pteaddr_wr &CR_PTEADDR_VPN_MASK , + (env->mmu.tlbmisc_wr &CR_TLBMISC_PID_MASK ) >>4 , + env->mmu.tlbacc_wr);#endif -cpu_fprintf (f,"\n\n" ); +qemu_fprintf (f,"\n\n" ); }void nios2_tcg_init (void )
target/openrisc/cpu.h +1 -2
@@ -339,8 +339,7 @@ static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)void cpu_openrisc_list (void );void openrisc_cpu_do_interrupt (CPUState *cpu);bool openrisc_cpu_exec_interrupt (CPUState *cpu,int int_req); -void openrisc_cpu_dump_state (CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void openrisc_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr openrisc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int openrisc_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int openrisc_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/openrisc/translate.c +5 -6
@@ -26,6 +26,7 @@#include "qemu-common.h" #include "qemu/log.h" #include "qemu/bitops.h" +#include "qemu/qemu-print.h" #include "exec/cpu_ldst.h" #include "exec/translator.h"
@@ -1415,18 +1416,16 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)translator_loop (&openrisc_tr_ops, &ctx.base, cs, tb); } -void openrisc_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf, -int flags) +void openrisc_cpu_dump_state (CPUState *cs,FILE *f,int flags) {OpenRISCCPU *cpu =OPENRISC_CPU (cs);CPUOpenRISCState *env = &cpu->env;int i; -cpu_fprintf (f,"PC=%08x\n" , env->pc); +qemu_fprintf (f,"PC=%08x\n" , env->pc);for (i =0 ; i <32 ; ++i) { -cpu_fprintf (f,"R%02d=%08x%c" , i,cpu_get_gpr (env, i), - (i %4 ) ==3 ?'\n' :' ' ); +qemu_fprintf (f,"R%02d=%08x%c" , i,cpu_get_gpr (env, i), + (i %4 ) ==3 ?'\n' :' ' ); } }
target/ppc/cpu.h +1 -2
@@ -1268,8 +1268,7 @@ struct PPCVirtualHypervisorClass {void ppc_cpu_do_interrupt (CPUState *cpu);bool ppc_cpu_exec_interrupt (CPUState *cpu,int int_req); -void ppc_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void ppc_cpu_dump_state (CPUState *cpu,FILE *f,int flags);void ppc_cpu_dump_statistics (CPUState *cpu,int flags);hwaddr ppc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int ppc_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);
target/ppc/translate.c +80 -81
240 lines not on this page · raw message
target/riscv/cpu.c +18 -19
@@ -194,40 +194,39 @@ static ObjectClass *riscv_cpu_class_by_name(const char *cpu_model)return oc; } -static void riscv_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags) +static void riscv_cpu_dump_state (CPUState *cs,FILE *f,int flags) {RISCVCPU *cpu =RISCV_CPU (cs);CPURISCVState *env = &cpu->env;int i; -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"pc " , env->pc); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"pc " , env->pc);#ifndef CONFIG_USER_ONLY -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mhartid " , env->mhartid); -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mstatus " , env->mstatus); -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mip " , - (target_ulong )atomic_read (&env->mip)); -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mie " , env->mie); -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mideleg " , env->mideleg); -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"medeleg " , env->medeleg); -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mtvec " , env->mtvec); -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mepc " , env->mepc); -cpu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mcause " , env->mcause); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mhartid " , env->mhartid); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mstatus " , env->mstatus); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mip " , + (target_ulong )atomic_read (&env->mip)); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mie " , env->mie); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mideleg " , env->mideleg); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"medeleg " , env->medeleg); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mtvec " , env->mtvec); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mepc " , env->mepc); +qemu_fprintf (f," %s " TARGET_FMT_lx"\n" ,"mcause " , env->mcause);#endif for (i =0 ; i <32 ; i++) { -cpu_fprintf (f," %s " TARGET_FMT_lx, - riscv_int_regnames[i], env->gpr[i]); +qemu_fprintf (f," %s " TARGET_FMT_lx, + riscv_int_regnames[i], env->gpr[i]);if ((i &3 ) ==3 ) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); } }if (flags &CPU_DUMP_FPU ) {for (i =0 ; i <32 ; i++) { -cpu_fprintf (f," %s %016" PRIx64, - riscv_fpr_regnames[i], env->fpr[i]); +qemu_fprintf (f," %s %016" PRIx64, + riscv_fpr_regnames[i], env->fpr[i]);if ((i &3 ) ==3 ) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); } } }
target/s390x/helper.c +21 -21
92 lines not on this page · raw message
target/s390x/internal.h +1 -2
@@ -292,8 +292,7 @@ void s390_cpu_gdb_init(CPUState *cs);/* helper.c */ -void s390_cpu_dump_state (CPUState *cpu,FILE *f,fprintf_function cpu_fprintf, -int flags); +void s390_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr s390_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);hwaddr s390_cpu_get_phys_addr_debug (CPUState *cpu,vaddr addr);uint64_t get_psw_mask (CPUS390XState *env);
target/sh4/cpu.h +1 -2
@@ -232,8 +232,7 @@ static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)void superh_cpu_do_interrupt (CPUState *cpu);bool superh_cpu_exec_interrupt (CPUState *cpu,int int_req); -void superh_cpu_dump_state (CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void superh_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr superh_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int superh_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int superh_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/sh4/translate.c +14 -13
@@ -30,6 +30,7 @@#include "exec/translator.h" #include "trace-tcg.h" #include "exec/log.h" +#include "qemu/qemu-print.h" typedef struct DisasContext {
@@ -156,32 +157,32 @@ void sh4_translate_init(void) fregnames[i]); } -void superh_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags) +void superh_cpu_dump_state (CPUState *cs,FILE *f,int flags) {SuperHCPU *cpu =SUPERH_CPU (cs);CPUSH4State *env = &cpu->env;int i; -cpu_fprintf (f,"pc=0x%08x sr=0x%08x pr=0x%08x fpscr=0x%08x\n" , - env->pc,cpu_read_sr (env), env->pr, env->fpscr); -cpu_fprintf (f,"spc=0x%08x ssr=0x%08x gbr=0x%08x vbr=0x%08x\n" , - env->spc, env->ssr, env->gbr, env->vbr); -cpu_fprintf (f,"sgr=0x%08x dbr=0x%08x delayed_pc=0x%08x fpul=0x%08x\n" , - env->sgr, env->dbr, env->delayed_pc, env->fpul); + +qemu_fprintf (f,"pc=0x%08x sr=0x%08x pr=0x%08x fpscr=0x%08x\n" , + env->pc,cpu_read_sr (env), env->pr, env->fpscr); +qemu_fprintf (f,"spc=0x%08x ssr=0x%08x gbr=0x%08x vbr=0x%08x\n" , + env->spc, env->ssr, env->gbr, env->vbr); +qemu_fprintf (f,"sgr=0x%08x dbr=0x%08x delayed_pc=0x%08x fpul=0x%08x\n" , + env->sgr, env->dbr, env->delayed_pc, env->fpul);for (i =0 ; i <24 ; i +=4 ) { -cpu_fprintf (f,"r%d=0x%08x r%d=0x%08x r%d=0x%08x r%d=0x%08x\n" , +qemu_printf ("r%d=0x%08x r%d=0x%08x r%d=0x%08x r%d=0x%08x\n" , i, env->gregs[i], i +1 , env->gregs[i +1 ], i +2 , env->gregs[i +2 ], i +3 , env->gregs[i +3 ]); }if (env->flags &DELAY_SLOT ) { -cpu_fprintf (f,"in delay slot (delayed_pc=0x%08x)\n" , +qemu_printf ("in delay slot (delayed_pc=0x%08x)\n" , env->delayed_pc); }else if (env->flags &DELAY_SLOT_CONDITIONAL ) { -cpu_fprintf (f,"in conditional delay slot (delayed_pc=0x%08x)\n" , +qemu_printf ("in conditional delay slot (delayed_pc=0x%08x)\n" , env->delayed_pc); }else if (env->flags &DELAY_SLOT_RTE ) { -cpu_fprintf (f,"in rte delay slot (delayed_pc=0x%08x)\n" , - env->delayed_pc); +qemu_fprintf (f,"in rte delay slot (delayed_pc=0x%08x)\n" , + env->delayed_pc); } }
target/sparc/cpu.c +41 -43
130 lines not on this page · raw message
target/sparc/cpu.h +1 -2
@@ -564,8 +564,7 @@ extern const struct VMStateDescription vmstate_sparc_cpu;#endif void sparc_cpu_do_interrupt (CPUState *cpu); -void sparc_cpu_dump_state (CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void sparc_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr sparc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int sparc_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg);int sparc_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/tilegx/cpu.c +7 -7
@@ -24,9 +24,9 @@#include "qemu-common.h" #include "hw/qdev-properties.h" #include "linux-user/syscall_defs.h" +#include "qemu/qemu-print.h" -static void tilegx_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags) +static void tilegx_cpu_dump_state (CPUState *cs,FILE *f,int flags) {static const char *const reg_names[TILEGX_R_COUNT ] = {"r0" ,"r1" ,"r2" ,"r3" ,"r4" ,"r5" ,"r6" ,"r7" ,
@@ -43,12 +43,12 @@ static void tilegx_cpu_dump_state(CPUState *cs, FILE *f,int i;for (i =0 ; i <TILEGX_R_COUNT ; i++) { -cpu_fprintf (f,"%-4s" TARGET_FMT_lx"%s" , - reg_names[i], env->regs[i], - (i %4 ) ==3 ?"\n" :" " ); +qemu_fprintf (f,"%-4s" TARGET_FMT_lx"%s" , + reg_names[i], env->regs[i], + (i %4 ) ==3 ?"\n" :" " ); } -cpu_fprintf (f,"PC " TARGET_FMT_lx" CEX " TARGET_FMT_lx"\n\n" , - env->pc, env->spregs[TILEGX_SPR_CMPEXCH ]); +qemu_fprintf (f,"PC " TARGET_FMT_lx" CEX " TARGET_FMT_lx"\n\n" , + env->pc, env->spregs[TILEGX_SPR_CMPEXCH ]); }static ObjectClass *tilegx_cpu_class_by_name (const char *cpu_model)
target/tricore/cpu.h +1 -2
@@ -224,8 +224,7 @@ static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)#define ENV_OFFSET offsetof(TriCoreCPU, env)hwaddr tricore_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); -void tricore_cpu_dump_state (CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void tricore_cpu_dump_state (CPUState *cpu,FILE *f,int flags);#define MASK_PCXI_PCPN 0xff000000
target/tricore/translate.c +13 -13
@@ -24,6 +24,7 @@#include "exec/exec-all.h" #include "tcg-op.h" #include "exec/cpu_ldst.h" +#include "qemu/qemu-print.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h"
@@ -88,8 +89,7 @@ enum { MODE_UU = 3, }; -void tricore_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags) +void tricore_cpu_dump_state (CPUState *cs,FILE *f,int flags) {TriCoreCPU *cpu =TRICORE_CPU (cs);CPUTriCoreState *env = &cpu->env;
@@ -98,26 +98,26 @@ void tricore_cpu_dump_state(CPUState *cs, FILE *f, psw =psw_read (env); -cpu_fprintf (f,"PC: " TARGET_FMT_lx, env->PC); -cpu_fprintf (f," PSW: " TARGET_FMT_lx, psw); -cpu_fprintf (f," ICR: " TARGET_FMT_lx, env->ICR); -cpu_fprintf (f,"\nPCXI: " TARGET_FMT_lx, env->PCXI); -cpu_fprintf (f," FCX: " TARGET_FMT_lx, env->FCX); -cpu_fprintf (f," LCX: " TARGET_FMT_lx, env->LCX); +qemu_fprintf (f,"PC: " TARGET_FMT_lx, env->PC); +qemu_fprintf (f," PSW: " TARGET_FMT_lx, psw); +qemu_fprintf (f," ICR: " TARGET_FMT_lx, env->ICR); +qemu_fprintf (f,"\nPCXI: " TARGET_FMT_lx, env->PCXI); +qemu_fprintf (f," FCX: " TARGET_FMT_lx, env->FCX); +qemu_fprintf (f," LCX: " TARGET_FMT_lx, env->LCX);for (i =0 ; i <16 ; ++i) {if ((i &3 ) ==0 ) { -cpu_fprintf (f,"\nGPR A%02d:" , i); +qemu_fprintf (f,"\nGPR A%02d:" , i); } -cpu_fprintf (f," " TARGET_FMT_lx, env->gpr_a[i]); +qemu_fprintf (f," " TARGET_FMT_lx, env->gpr_a[i]); }for (i =0 ; i <16 ; ++i) {if ((i &3 ) ==0 ) { -cpu_fprintf (f,"\nGPR D%02d:" , i); +qemu_fprintf (f,"\nGPR D%02d:" , i); } -cpu_fprintf (f," " TARGET_FMT_lx, env->gpr_d[i]); +qemu_fprintf (f," " TARGET_FMT_lx, env->gpr_d[i]); } -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); }/*
target/unicore32/cpu.h +1 -2
@@ -97,8 +97,7 @@ static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env)void uc32_cpu_do_interrupt (CPUState *cpu);bool uc32_cpu_exec_interrupt (CPUState *cpu,int int_req); -void uc32_cpu_dump_state (CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void uc32_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr uc32_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);#define ASR_M (0x1f)
target/unicore32/translate.c +19 -20
@@ -17,6 +17,7 @@#include "qemu/log.h" #include "exec/cpu_ldst.h" #include "exec/translator.h" +#include "qemu/qemu-print.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h"
@@ -2043,8 +2044,7 @@ static const char *cpu_mode_names[16] = {#undef UCF64_DUMP_STATE#ifdef UCF64_DUMP_STATE -static void cpu_dump_state_ucf64 (CPUUniCore32State *env,FILE *f, -fprintf_function cpu_fprintf,int flags) +static void cpu_dump_state_ucf64 (CPUUniCore32State *env,int flags) {int i; union {
@@ -2064,20 +2064,19 @@ static void cpu_dump_state_ucf64(CPUUniCore32State *env, FILE *f, s0.i = d.l.lower; s1.i = d.l.upper; d0.f64 = d.d; -cpu_fprintf (f,"s%02d=%08x(%8g) s%02d=%08x(%8g)" , - i *2 , (int )s0.i, s0.s, - i *2 +1 , (int )s1.i, s1.s); -cpu_fprintf (f," d%02d=%" PRIx64"(%8g)\n" , - i, (uint64_t)d0.f64, d0.d); +qemu_fprintf (f,"s%02d=%08x(%8g) s%02d=%08x(%8g)" , + i *2 , (int )s0.i, s0.s, + i *2 +1 , (int )s1.i, s1.s); +qemu_fprintf (f," d%02d=%" PRIx64"(%8g)\n" , + i, (uint64_t)d0.f64, d0.d); } -cpu_fprintf (f,"FPSCR: %08x\n" , (int )env->ucf64.xregs[UC32_UCF64_FPSCR ]); +qemu_fprintf (f,"FPSCR: %08x\n" , (int )env->ucf64.xregs[UC32_UCF64_FPSCR ]); }#else #define cpu_dump_state_ucf64 (env, file, pr, flags) do { } while (0)#endif -void uc32_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags) +void uc32_cpu_dump_state (CPUState *cs,FILE *f,int flags) {UniCore32CPU *cpu =UNICORE32_CPU (cs);CPUUniCore32State *env = &cpu->env;
@@ -2085,21 +2084,21 @@ void uc32_cpu_dump_state(CPUState *cs, FILE *f,uint32_t psr;for (i =0 ; i <32 ; i++) { -cpu_fprintf (f,"R%02d=%08x" , i, env->regs[i]); +qemu_fprintf (f,"R%02d=%08x" , i, env->regs[i]);if ((i %4 ) ==3 ) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" ); }else { -cpu_fprintf (f," " ); +qemu_fprintf (f," " ); } } psr =cpu_asr_read (env); -cpu_fprintf (f,"PSR=%08x %c%c%c%c %s\n" , - psr, - psr & (1 <<31 ) ?'N' :'-' , - psr & (1 <<30 ) ?'Z' :'-' , - psr & (1 <<29 ) ?'C' :'-' , - psr & (1 <<28 ) ?'V' :'-' , - cpu_mode_names[psr &0xf ]); +qemu_fprintf (f,"PSR=%08x %c%c%c%c %s\n" , + psr, + psr & (1 <<31 ) ?'N' :'-' , + psr & (1 <<30 ) ?'Z' :'-' , + psr & (1 <<29 ) ?'C' :'-' , + psr & (1 <<28 ) ?'V' :'-' , + cpu_mode_names[psr &0xf ]);if (flags &CPU_DUMP_FPU ) {cpu_dump_state_ucf64 (env, f, cpu_fprintf, flags);
target/xtensa/cpu.h +1 -2
@@ -560,8 +560,7 @@ void xtensa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retaddr); -void xtensa_cpu_dump_state (CPUState *cpu,FILE *f, -fprintf_function cpu_fprintf,int flags); +void xtensa_cpu_dump_state (CPUState *cpu,FILE *f,int flags);hwaddr xtensa_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);void xtensa_count_regs (const XtensaConfig *config,unsigned *n_regs,unsigned *n_core_regs);
target/xtensa/translate.c +21 -19
@@ -35,6 +35,7 @@#include "disas/disas.h" #include "tcg-op.h" #include "qemu/log.h" +#include "qemu/qemu-print.h" #include "sysemu/sysemu.h" #include "exec/cpu_ldst.h" #include "exec/semihost.h"
@@ -1640,60 +1641,61 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)translator_loop (&xtensa_translator_ops, &dc.base, cpu, tb); } -void xtensa_cpu_dump_state (CPUState *cs,FILE *f, -fprintf_function cpu_fprintf,int flags) +void xtensa_cpu_dump_state (CPUState *cs,FILE *f,int flags) {XtensaCPU *cpu =XTENSA_CPU (cs);CPUXtensaState *env = &cpu->env;int i, j; -cpu_fprintf (f,"PC=%08x\n\n" , env->pc); +qemu_fprintf (f,"PC=%08x\n\n" , env->pc);for (i = j =0 ; i <256 ; ++i) {if (xtensa_option_bits_enabled (env->config, sregnames[i].opt_bits)) { -cpu_fprintf (f,"%12s=%08x%c" , sregnames[i].name, env->sregs[i], - (j++ %4 ) ==3 ?'\n' :' ' ); +qemu_fprintf (f,"%12s=%08x%c" , + sregnames[i].name, env->sregs[i], + (j++ %4 ) ==3 ?'\n' :' ' ); } } -cpu_fprintf (f, (j %4 ) ==0 ?"\n" :"\n\n" ); +qemu_fprintf (f, (j %4 ) ==0 ?"\n" :"\n\n" );for (i = j =0 ; i <256 ; ++i) {if (xtensa_option_bits_enabled (env->config, uregnames[i].opt_bits)) { -cpu_fprintf (f,"%s=%08x%c" , uregnames[i].name, env->uregs[i], - (j++ %4 ) ==3 ?'\n' :' ' ); +qemu_fprintf (f,"%s=%08x%c" , + uregnames[i].name, env->uregs[i], + (j++ %4 ) ==3 ?'\n' :' ' ); } } -cpu_fprintf (f, (j %4 ) ==0 ?"\n" :"\n\n" ); +qemu_fprintf (f, (j %4 ) ==0 ?"\n" :"\n\n" );for (i =0 ; i <16 ; ++i) { -cpu_fprintf (f," A%02d=%08x%c" , i, env->regs[i], - (i %4 ) ==3 ?'\n' :' ' ); +qemu_fprintf (f," A%02d=%08x%c" , + i, env->regs[i], (i %4 ) ==3 ?'\n' :' ' ); }xtensa_sync_phys_from_window (env); -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" );for (i =0 ; i < env->config->nareg; ++i) { -cpu_fprintf (f,"AR%02d=%08x " , i, env->phys_regs[i]); +qemu_fprintf (f,"AR%02d=%08x " , i, env->phys_regs[i]);if (i %4 ==3 ) {bool ws = (env->sregs[WINDOW_START ] & (1 << (i /4 ))) !=0 ;bool cw = env->sregs[WINDOW_BASE ] == i /4 ; -cpu_fprintf (f,"%c%c\n" , ws ?'<' :' ' , cw ?'=' :' ' ); +qemu_fprintf (f,"%c%c\n" , ws ?'<' :' ' , cw ?'=' :' ' ); } }if ((flags &CPU_DUMP_FPU ) &&xtensa_option_enabled (env->config,XTENSA_OPTION_FP_COPROCESSOR )) { -cpu_fprintf (f,"\n" ); +qemu_fprintf (f,"\n" );for (i =0 ; i <16 ; ++i) { -cpu_fprintf (f,"F%02d=%08x (%+10.8e)%c" , i, -float32_val (env->fregs[i].f32[FP_F32_LOW ]), - *(float *)(env->fregs[i].f32 +FP_F32_LOW ), - (i %2 ) ==1 ?'\n' :' ' ); +qemu_fprintf (f,"F%02d=%08x (%+10.8e)%c" , i, +float32_val (env->fregs[i].f32[FP_F32_LOW ]), + *(float *)(env->fregs[i].f32 +FP_F32_LOW ), + (i %2 ) ==1 ?'\n' :' ' ); } } }
Signature · 1 line
2.17.2
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PULL for-4.1 00/36] Error reporting & monitor patches for 2019-04-18
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'f65f9a57a6 include: Move fprintf_function to disas/3613cf2952 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h 8362074a2c monitor: Clean up how monitor_disas() funnels output to monitor 41465772c0 qom/cpu: Simplify how CPUClass:cpu_dump_state() prints 49fd3a8181 qemu-print: New qemu_fprintf(), qemu_vfprintf() 195a57362a qom/cpu: Simplify how CPUClass::dump_statistics() prints b439ddf49d target/i386: Simplify how x86_cpu_dump_local_apic_state() prints f02a059161 target: Clean up how the dump_mmu() print71ad53d2d8 target: Simplify how the TARGET_cpu_list() print e48c937bbb memory: Clean up how mtree_info() printsde799bd96a block/qapi: Clean up how we print to monitor or stdout de39c5a100 qsp: Simplify how qsp_report() printse597dab6a6 tcg: Simplify how dump_drift_info() prints903672bb0a tcg: Simplify how dump_exec_info() printsb011a591b1 tcg: Simplify how dump_opcount_info() prints e2066e0297 trace: Simplify how st_print_trace_file_status() prints ba66678390 include: Include fprintf-fn.h only where needed 6bf830e5fa monitor: Simplify how -device/device_add print help f9837a2629 char-pty: Print "char device redirected" message to stdout 8ffea401ea char: Make -chardev help print to stdout7e517c0c83 blockdev: Make -drive format=help print to stdout 4fc29bdae6 qemu-print: New qemu_printf(), qemu_vprintf() etc. da66543644 monitor error: Make printf()-like functions return a value bb86c3751c vl: Make -machine $TYPE, help and -accel help print to stdout f0f1843fa5 s390x/kvm: Report warnings with warn_report(), not error_printf() 30004a79dd vfio: Report warnings with warn_report(), not error_printf() 86648932be hpet: Report warnings with warn_report(), not error_printf() 77849d6ae3 pci: Report fatal errors with error_report(), not error_printf() 5384051d57 mips/boston: Report errors with error_report(), not error_printf() 5542ac28ff loader-fit: Wean off error_printf()390e511dee block/ssh: Do not report read/write/flush errors to the user 85da455e60 qemu-img: Use error_vreport() in error_exit() 376c0acbff util/error: do not free error on error_abort d515fdf4f0 error: Fix error_report_err(), warn_report_err() hint printing d4406797be log: Make glib logging go through QEMU3c051888c6 qemu-io: Use error_[gs]et_progname()
=== OUTPUT BEGIN ===
1/36 Checking commit 3c051888c617 (qemu-io: Use error_[gs]et_progname())
2/36 Checking commit d4406797beb3 (log: Make glib logging go through QEMU)
3/36 Checking commit d515fdf4f02b (error: Fix error_report_err(), warn_report_err() hint printing) 4/36 Checking commit 376c0acbff33 (util/error: do not free error on error_abort)
5/36 Checking commit 85da455e604b (qemu-img: Use error_vreport() in error_exit()) 6/36 Checking commit 390e511dee92 (block/ssh: Do not report read/write/flush errors to the user) 7/36 Checking commit 5542ac28ff9b (loader-fit: Wean off error_printf())
8/36 Checking commit 5384051d5721 (mips/boston: Report errors with error_report(), not error_printf()) 9/36 Checking commit 77849d6ae3cf (pci: Report fatal errors with error_report(), not error_printf()) 10/36 Checking commit 86648932bea9 (hpet: Report warnings with warn_report(), not error_printf()) 11/36 Checking commit 30004a79dd0d (vfio: Report warnings with warn_report(), not error_printf()) 12/36 Checking commit f0f1843fa518 (s390x/kvm: Report warnings with warn_report(), not error_printf()) 13/36 Checking commit bb86c3751c7d (vl: Make -machine $TYPE, help and -accel help print to stdout) 14/36 Checking commit da6654364435 (monitor error: Make printf()-like functions return a value) 15/36 Checking commit 4fc29bdae6ff (qemu-print: New qemu_printf(), qemu_vprintf() etc.)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#36:
new file mode 100644
total: 0 errors, 1 warnings, 94 lines checked
Patch 15/36 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
16/36 Checking commit 7e517c0c8383 (blockdev: Make -drive format=help print to stdout) 17/36 Checking commit 8ffea401ea28 (char: Make -chardev help print to stdout) 18/36 Checking commit f9837a26297b (char-pty: Print "char device redirected" message to stdout) 19/36 Checking commit 6bf830e5fac5 (monitor: Simplify how -device/device_add print help) 20/36 Checking commit ba6667839046 (include: Include fprintf-fn.h only where needed) 21/36 Checking commit e2066e029740 (trace: Simplify how st_print_trace_file_status() prints) 22/36 Checking commit b011a591b165 (tcg: Simplify how dump_opcount_info() prints) 23/36 Checking commit 903672bb0a4a (tcg: Simplify how dump_exec_info() prints) 24/36 Checking commit e597dab6a65a (tcg: Simplify how dump_drift_info() prints) 25/36 Checking commit de39c5a100c3 (qsp: Simplify how qsp_report() prints)
26/36 Checking commit de799bd96ae3 (block/qapi: Clean up how we print to monitor or stdout) 27/36 Checking commit e48c937bbbe0 (memory: Clean up how mtree_info() prints) 28/36 Checking commit 71ad53d2d8cf (target: Simplify how the TARGET_cpu_list() print) 29/36 Checking commit f02a05916155 (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+ qemu_printf("\tVaddr Paddr ASID Attr RWX Cache\n"
total: 0 errors, 1 warnings, 848 lines checked
Patch 29/36 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
30/36 Checking commit b439ddf49dd3 (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints) 31/36 Checking commit 195a57362a6f (qom/cpu: Simplify how CPUClass::dump_statistics() prints) 32/36 Checking commit 49fd3a8181f6 (qemu-print: New qemu_fprintf(), qemu_vfprintf()) 33/36 Checking commit 41465772c004 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+ qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+ "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+ "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+ "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"
ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+ "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+ qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",
WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+ qemu_fprintf(f, "CP0 Status 0x%08x Cause 0x%08x EPC 0x" TARGET_FMT_lx "\n",
total: 5 errors, 2 warnings, 2551 lines checked
Patch 33/36 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
34/36 Checking commit 8362074a2c1b (monitor: Clean up how monitor_disas() funnels output to monitor) 35/36 Checking commit 3613cf29520d (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#297:
rename from include/disas/bfd.h
total: 0 errors, 1 warnings, 192 lines checked
Patch 35/36 has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
36/36 Checking commit f65f9a57a620 (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #45:
deleted file mode 100644
total: 0 errors, 1 warnings, 17 lines checked
Patch 36/36 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Peter Maydell
AppliedQuoted 10 lines · Markus Armbruster
Early pull request because I'll be on vacation when 4.1 opens. Hope that's okay.
The following changes since commit
eeba63fc7fface36f438bcbc0d3b02e7dcb59983:Update version for v4.0.0-rc4 release (2019-04-16 21:53:00 +0100)
are available in the Git repository at:
Quoted 9 lines
git://repo.or.cz/qemu/armbru.gittags/pull-error-monitor-2019-04-18for you to fetch changes up to
ede9a8a656c992deecce45f8175985dd81cc6be9:include: Move
fprintf_functionto disas/ (2019-04-18 22:18:59 +0200)----------------------------------------------------------------
Error reporting & monitor patches for 2019-04-18
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.
-- PMM