Running barebox on qemu-system-mips* with '-d unimp' overloads
stderr by very very many mips_cpu_handle_mmu_fault() messages:
mips_cpu_handle_mmu_fault address=b80003fd ret 0 physical 180003fd
prot 3
mips_cpu_handle_mmu_fault address=a0800884 ret 0 physical 00800884
prot 3
mips_cpu_handle_mmu_fault pc a080cd80 ad b80003fd rw 0 mmu_idx 0
So it's very difficult to find LOG_UNIMP message.
The mips_cpu_handle_mmu_fault() messages appears on enabling ANY
logging! It's not very handy.
Adding separate log category for *_cpu_handle_mmu_fault()
logging fixes the problem.
Signed-off-by: Antony Pavlov antonynpav...@gmail.com
---
Changes since v1:
* add cris, i386, microblaze, ppc, s390x, sparc and unicore32 support.
---
cputlb.c | 3 ++-
include/qemu/log.h | 1 +
qemu-log.c | 2 ++
target-cris/helper.c | 12 +++-
target-i386/helper.c | 18 +-
target-microblaze/helper.c | 15 +++
target-mips/helper.c | 6 --
target-ppc/mmu-hash32.c| 2 +-
target-s390x/helper.c | 4 ++--
target-sparc/mmu_helper.c | 14 ++
target-unicore32/softmmu.c | 3 ++-
11 files changed, 51 insertions(+), 29 deletions(-)
diff --git a/cputlb.c b/cputlb.c
index a55518a..3b271d4 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -270,7 +270,8 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr,
assert(sz = TARGET_PAGE_SIZE);
#if defined(DEBUG_TLB)
-printf(tlb_set_page: vaddr= TARGET_FMT_lx paddr=0x TARGET_FMT_plx
+qemu_log_mask(CPU_LOG_MMU,
+ tlb_set_page: vaddr= TARGET_FMT_lx paddr=0x TARGET_FMT_plx
prot=%x idx=%d\n,
vaddr, paddr, prot, mmu_idx);
#endif
diff --git a/include/qemu/log.h b/include/qemu/log.h
index d515424..195f665 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -40,6 +40,7 @@ static inline bool qemu_log_enabled(void)
#define CPU_LOG_RESET (1 9)
#define LOG_UNIMP (1 10)
#define LOG_GUEST_ERROR(1 11)
+#define CPU_LOG_MMU(1 12)
/* Returns true if a bit is set in the current loglevel mask
*/
diff --git a/qemu-log.c b/qemu-log.c
index 797f2af..05b5493 100644
--- a/qemu-log.c
+++ b/qemu-log.c
@@ -106,6 +106,8 @@ const QEMULogItem qemu_log_items[] = {
show trace before each executed TB (lots of logs) },
{ CPU_LOG_TB_CPU, cpu,
show CPU state before block translation },
+{ CPU_LOG_MMU, mmu,
+ log MMU-related activities },
{ CPU_LOG_PCALL, pcall,
x86 only: show protected mode far calls/returns/exceptions },
{ CPU_LOG_RESET, cpu_reset,
diff --git a/target-cris/helper.c b/target-cris/helper.c
index e901c3a..e368e23 100644
--- a/target-cris/helper.c
+++ b/target-cris/helper.c
@@ -30,9 +30,11 @@
#ifdef CRIS_HELPER_DEBUG
#define D(x) x
#define D_LOG(...) qemu_log(__VA_ARGS__)
+#define LOG_MMU(...) qemu_log_mask(CPU_LOG_MMU, __VA_ARGS__)
#else
#define D(x)
#define D_LOG(...) do { } while (0)
+#define LOG_MMU(...) do { } while (0)
#endif
#if defined(CONFIG_USER_ONLY)
@@ -84,8 +86,8 @@ int cris_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
int rw,
int r = -1;
target_ulong phy;
-D(printf(%s addr=% VADDR_PRIx pc=%x rw=%x\n,
- __func__, address, env-pc, rw));
+LOG_MMU(%s addr=% VADDR_PRIx pc=%x rw=%x\n,
+__func__, address, env-pc, rw);
miss = cris_mmu_translate(res, env, address TARGET_PAGE_MASK,
rw, mmu_idx, 0);
if (miss) {
@@ -112,9 +114,9 @@ int cris_cpu_handle_mmu_fault(CPUState *cs, vaddr address,
int rw,
r = 0;
}
if (r 0) {
-D_LOG(%s returns %d irqreq=%x addr=% VADDR_PRIx phy=%x vec=%x
- pc=%x\n, __func__, r, cs-interrupt_request, address, res.phy,
- res.bf_vec, env-pc);
+LOG_MMU(%s returns %d irqreq=%x addr=% VADDR_PRIx phy=%x vec=%x
+ pc=%x\n, __func__, r, cs-interrupt_request, address,
+res.phy, res.bf_vec, env-pc);
}
return r;
}
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 345bda1..ae159a3 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -27,6 +27,12 @@
//#define DEBUG_MMU
+#ifdef DEBUG_MMU
+# define LOG_MMU(...) qemu_log_mask(CPU_LOG_MMU, __VA_ARGS__)
+#else
+# define LOG_MMU(...) do { } while (0)
+#endif
+
static void cpu_x86_version(CPUX86State *env, int *family, int *model)
{
int cpuver = env-cpuid_version;
@@ -388,9 +394,7 @@ void x86_cpu_set_a20(X86CPU *cpu, int a20_state)
if (a20_state != ((env-a20_mask 20) 1)) {
CPUState *cs = CPU(cpu);
-#if defined(DEBUG_MMU)
-printf(A20 update: a20=%d\n, a20_state);
-#endif
+LOG_MMU(A20 update: a20=%d\n, a20_state);
/* if the cpu is currently executing code, we must unlink it and
all the potentially executing TB */
cpu_interrupt(cs, CPU_INTERRUPT_EXITTB);
@@ -407,9 +411,7 @@ void