[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 05/33] target/ppc: Use proper logging function for poss
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 05/33] target/ppc: Use proper logging function for possible guest errors |
Date: |
Tue, 12 Jun 2018 16:44:35 +1000 |
From: Thomas Huth <address@hidden>
fprintf() and qemu_log_separate() are frowned upon these days for printing
logging information in QEMU. Accessing the wrong SPRs indicates wrong guest
behaviour in most cases, and we've got a proper way to log such situations,
which is the qemu_log_mask(LOG_GUEST_ERROR, ...) function. So use this
function now for logging the bad SPR accesses instead.
Signed-off-by: Thomas Huth <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/translate.c | 37 ++++++++++++-------------------------
1 file changed, 12 insertions(+), 25 deletions(-)
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index b28e8b91d3..8ba8f67dc5 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -3933,13 +3933,9 @@ static inline void gen_op_mfspr(DisasContext *ctx)
* allowing userland application to read the PVR
*/
if (sprn != SPR_PVR) {
- fprintf(stderr, "Trying to read privileged spr %d (0x%03x) at "
- TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - 4);
- if (qemu_log_separate()) {
- qemu_log("Trying to read privileged spr %d (0x%03x) at "
- TARGET_FMT_lx "\n", sprn, sprn,
- ctx->base.pc_next - 4);
- }
+ qemu_log_mask(LOG_GUEST_ERROR, "Trying to read privileged spr "
+ "%d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn,
+ ctx->base.pc_next - 4);
}
gen_priv_exception(ctx, POWERPC_EXCP_PRIV_REG);
}
@@ -3951,12 +3947,9 @@ static inline void gen_op_mfspr(DisasContext *ctx)
return;
}
/* Not defined */
- fprintf(stderr, "Trying to read invalid spr %d (0x%03x) at "
- TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - 4);
- if (qemu_log_separate()) {
- qemu_log("Trying to read invalid spr %d (0x%03x) at "
- TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - 4);
- }
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "Trying to read invalid spr %d (0x%03x) at "
+ TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - 4);
/* The behaviour depends on MSR:PR and SPR# bit 0x10,
* it can generate a priv, a hv emu or a no-op
@@ -4097,12 +4090,9 @@ static void gen_mtspr(DisasContext *ctx)
(*write_cb)(ctx, sprn, rS(ctx->opcode));
} else {
/* Privilege exception */
- fprintf(stderr, "Trying to write privileged spr %d (0x%03x) at "
- TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - 4);
- if (qemu_log_separate()) {
- qemu_log("Trying to write privileged spr %d (0x%03x) at "
- TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next -
4);
- }
+ qemu_log_mask(LOG_GUEST_ERROR, "Trying to write privileged spr "
+ "%d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn,
+ ctx->base.pc_next - 4);
gen_priv_exception(ctx, POWERPC_EXCP_PRIV_REG);
}
} else {
@@ -4114,12 +4104,9 @@ static void gen_mtspr(DisasContext *ctx)
}
/* Not defined */
- if (qemu_log_separate()) {
- qemu_log("Trying to write invalid spr %d (0x%03x) at "
- TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - 4);
- }
- fprintf(stderr, "Trying to write invalid spr %d (0x%03x) at "
- TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - 4);
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "Trying to write invalid spr %d (0x%03x) at "
+ TARGET_FMT_lx "\n", sprn, sprn, ctx->base.pc_next - 4);
/* The behaviour depends on MSR:PR and SPR# bit 0x10,
--
2.17.1
- [Qemu-ppc] [PULL 01/33] ppc440_pcix: Fix a typo in setting a register (Coverity CID1390577), (continued)
- [Qemu-ppc] [PULL 01/33] ppc440_pcix: Fix a typo in setting a register (Coverity CID1390577), David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 02/33] macio: add trace-events to timer device, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 03/33] uninorth: remove token register from uninorth device, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 07/33] prep: fix keyboard for the 40p machine, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 11/33] osdep: powerpc64 align memory to allow 2MB radix THP page tables, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 10/33] spapr/vio: deprecate the "irq" property, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 13/33] MAINTAINERS: Add entries for the MOS6522 VIA device, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 09/33] target/ppc: Allow privileged access to SPR_PCR, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 04/33] hw/ppc/spapr_drc: Replace error_setg(&error_abort) by error_report() + abort(), David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 06/33] 40p: remove pci_allow_0_address = true from 40p machine class, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 05/33] target/ppc: Use proper logging function for possible guest errors,
David Gibson <=
- [Qemu-ppc] [PULL 08/33] target/ppc: Factor out the parsing in kvmppc_get_cpu_characteristics(), David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 16/33] ppc: remove obsolete macio_init() definition from mac.h, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 15/33] ppc: remove obsolete pci_pmac_init() definitions from mac.h, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 17/33] ppc: add missing FW_CFG_PPC_NVRAM_FLAT definition, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 14/33] hw/misc/mos6522: Add trailing '\n' to qemu_log() calls, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 20/33] mos6522: move timer frequency initialisation to mos6522_reset, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 12/33] MAINTAINERS: Add an entry for the MacIO device headers, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 19/33] cuda: embed mos6522_cuda device directly rather than using QOM object link, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 22/33] target/ppc: extend eieio for POWER9, David Gibson, 2018/06/12
- [Qemu-ppc] [PULL 18/33] mos6522: fix vmstate_mos6522_timer version in vmstate_mos6522, David Gibson, 2018/06/12