[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/31] target-mips/translate.c: LOG_DISAS macro
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 18/31] target-mips/translate.c: LOG_DISAS macro |
Date: |
Fri, 12 Dec 2008 13:08:57 -0200 |
Create a LOG_DISAS macro and use it instead of #ifdef MIPS_DEBUG_DISAS.
Signed-off-by: Eduardo Habkost <address@hidden>
---
target-mips/translate.c | 116 +++++++++--------------------------------------
1 files changed, 22 insertions(+), 94 deletions(-)
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 418b9ef..b6a9fa3 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -521,8 +521,14 @@ do {
\
ctx->pc, ctx->opcode , ##args); \
} \
} while (0)
+#define LOG_DISAS(...) \
+ do { \
+ if (loglevel & CPU_LOG_TB_IN_ASM) \
+ fprintf(logfile, ## __VA_ARGS__); \
+ } while (0)
#else
#define MIPS_DEBUG(fmt, args...) do { } while(0)
+#define LOG_DISAS(...) do { } while (0)
#endif
#define MIPS_INVAL(op) \
@@ -758,12 +764,7 @@ static inline void gen_save_pc(target_ulong pc)
static inline void save_cpu_state (DisasContext *ctx, int do_save_pc)
{
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "hflags %08x saved %08x\n",
- ctx->hflags, ctx->saved_hflags);
- }
-#endif
+ LOG_DISAS("hflags %08x saved %08x\n", ctx->hflags, ctx->saved_hflags);
if (do_save_pc && ctx->pc != ctx->saved_pc) {
gen_save_pc(ctx->pc);
ctx->saved_pc = ctx->pc;
@@ -2318,13 +2319,7 @@ static void gen_compute_branch (DisasContext *ctx,
uint32_t opc,
TCGv t1 = tcg_temp_local_new();
if (ctx->hflags & MIPS_HFLAG_BMASK) {
-#ifdef MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile,
- "Branch in delay slot at PC 0x" TARGET_FMT_lx "\n",
- ctx->pc);
- }
-#endif
+ LOG_DISAS("Branch in delay slot at PC 0x" TARGET_FMT_lx "\n", ctx->pc);
generate_exception(ctx, EXCP_RI);
goto out;
}
@@ -3300,21 +3295,11 @@ static void gen_mfc0 (CPUState *env, DisasContext *ctx,
TCGv t0, int reg, int se
default:
goto die;
}
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "mfc0 %s (reg %d sel %d)\n",
- rn, reg, sel);
- }
-#endif
+ LOG_DISAS("mfc0 %s (reg %d sel %d)\n", rn, reg, sel);
return;
die:
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "mfc0 %s (reg %d sel %d)\n",
- rn, reg, sel);
- }
-#endif
+ LOG_DISAS("mfc0 %s (reg %d sel %d)\n", rn, reg, sel);
generate_exception(ctx, EXCP_RI);
}
@@ -3904,12 +3889,7 @@ static void gen_mtc0 (CPUState *env, DisasContext *ctx,
TCGv t0, int reg, int se
default:
goto die;
}
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "mtc0 %s (reg %d sel %d)\n",
- rn, reg, sel);
- }
-#endif
+ LOG_DISAS("mtc0 %s (reg %d sel %d)\n", rn, reg, sel);
/* For simplicity assume that all writes can cause interrupts. */
if (use_icount) {
gen_io_end();
@@ -3918,12 +3898,7 @@ static void gen_mtc0 (CPUState *env, DisasContext *ctx,
TCGv t0, int reg, int se
return;
die:
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "mtc0 %s (reg %d sel %d)\n",
- rn, reg, sel);
- }
-#endif
+ LOG_DISAS("mtc0 %s (reg %d sel %d)\n", rn, reg, sel);
generate_exception(ctx, EXCP_RI);
}
@@ -4486,21 +4461,11 @@ static void gen_dmfc0 (CPUState *env, DisasContext
*ctx, TCGv t0, int reg, int s
default:
goto die;
}
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "dmfc0 %s (reg %d sel %d)\n",
- rn, reg, sel);
- }
-#endif
+ LOG_DISAS("dmfc0 %s (reg %d sel %d)\n", rn, reg, sel);
return;
die:
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "dmfc0 %s (reg %d sel %d)\n",
- rn, reg, sel);
- }
-#endif
+ LOG_DISAS("dmfc0 %s (reg %d sel %d)\n", rn, reg, sel);
generate_exception(ctx, EXCP_RI);
}
@@ -5077,12 +5042,7 @@ static void gen_dmtc0 (CPUState *env, DisasContext *ctx,
TCGv t0, int reg, int s
default:
goto die;
}
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "dmtc0 %s (reg %d sel %d)\n",
- rn, reg, sel);
- }
-#endif
+ LOG_DISAS("dmtc0 %s (reg %d sel %d)\n", rn, reg, sel);
/* For simplicity assume that all writes can cause interrupts. */
if (use_icount) {
gen_io_end();
@@ -5091,12 +5051,7 @@ static void gen_dmtc0 (CPUState *env, DisasContext *ctx,
TCGv t0, int reg, int s
return;
die:
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "dmtc0 %s (reg %d sel %d)\n",
- rn, reg, sel);
- }
-#endif
+ LOG_DISAS("dmtc0 %s (reg %d sel %d)\n", rn, reg, sel);
generate_exception(ctx, EXCP_RI);
}
#endif /* TARGET_MIPS64 */
@@ -5254,24 +5209,14 @@ static void gen_mftr(CPUState *env, DisasContext *ctx,
int rt, int rd,
default:
goto die;
}
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "mftr (reg %d u %d sel %d h %d)\n",
- rt, u, sel, h);
- }
-#endif
+ LOG_DISAS("mftr (reg %d u %d sel %d h %d)\n", rt, u, sel, h);
gen_store_gpr(t0, rd);
tcg_temp_free(t0);
return;
die:
tcg_temp_free(t0);
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "mftr (reg %d u %d sel %d h %d)\n",
- rt, u, sel, h);
- }
-#endif
+ LOG_DISAS("mftr (reg %d u %d sel %d h %d)\n", rt, u, sel, h);
generate_exception(ctx, EXCP_RI);
}
@@ -5429,23 +5374,13 @@ static void gen_mttr(CPUState *env, DisasContext *ctx,
int rd, int rt,
default:
goto die;
}
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "mttr (reg %d u %d sel %d h %d)\n",
- rd, u, sel, h);
- }
-#endif
+ LOG_DISAS("mttr (reg %d u %d sel %d h %d)\n", rd, u, sel, h);
tcg_temp_free(t0);
return;
die:
tcg_temp_free(t0);
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM) {
- fprintf(logfile, "mttr (reg %d u %d sel %d h %d)\n",
- rd, u, sel, h);
- }
-#endif
+ LOG_DISAS("mttr (reg %d u %d sel %d h %d)\n", rd, u, sel, h);
generate_exception(ctx, EXCP_RI);
}
@@ -8279,11 +8214,7 @@ gen_intermediate_code_internal (CPUState *env,
TranslationBlock *tb,
cpu_dump_state(env, logfile, fprintf, 0);
}
#endif
-#ifdef MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM)
- fprintf(logfile, "\ntb %p idx %d hflags %04x\n",
- tb, ctx.mem_idx, ctx.hflags);
-#endif
+ LOG_DISAS("\ntb %p idx %d hflags %04x\n", tb, ctx.mem_idx, ctx.hflags);
gen_icount_start();
while (ctx.bstate == BS_NONE) {
if (unlikely(!TAILQ_EMPTY(&env->breakpoints))) {
@@ -8371,10 +8302,7 @@ done_generating:
tb->icount = num_insns;
}
#ifdef DEBUG_DISAS
-#if defined MIPS_DEBUG_DISAS
- if (loglevel & CPU_LOG_TB_IN_ASM)
- fprintf(logfile, "\n");
-#endif
+ LOG_DISAS("\n");
if (loglevel & CPU_LOG_TB_IN_ASM) {
fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start));
target_disas(logfile, pc_start, ctx.pc - pc_start, 0);
--
1.5.5.GIT
- [Qemu-devel] [PATCH 31/31] linux-user/vm86.c: LOG_VM86 macro, (continued)
- [Qemu-devel] [PATCH 31/31] linux-user/vm86.c: LOG_VM86 macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 22/31] target-ppc/helper.c: LOG_BATS macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 28/31] target-ppc/translate.c: LOG_DISAS macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 24/31] target-ppc/helper.c: LOG_EXCP macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 07/31] kqemu.c: LOG_INT macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 09/31] kqemu.c: LOG_INT_STATE macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 10/31] kqemu.c: use LOG_INT_STATE instead of #ifdefs, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 12/31] target-i386/op_helper.c: LOG_PCALL macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 15/31] target-i386/op_helper.c: use LOG_PCALL/LOG_PCALL_STATE, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 29/31] hw/ppc4xx_devs.c: LOG_UIC macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 18/31] target-mips/translate.c: LOG_DISAS macro,
Eduardo Habkost <=
- [Qemu-devel] [PATCH 20/31] target-ppc/helper.c: LOG_SWTLB macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 21/31] target-ppc/helper.c: convert commented-out debug code to LOG_SWTLB, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 26/31] target-ppc/helper.c: LOG_MMU_STATE macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 11/31] kqemu.c: kill remaining DEBUG #ifdefs, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 27/31] target-ppc/op_helper.c: LOG_SWTLB macro, Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 17/31] target-cris: replace D(fprintf(logfile, ...)) macros with D_LOG(...), Eduardo Habkost, 2008/12/12
- [Qemu-devel] [PATCH 25/31] target-ppc/helper.c: remaining LOG_BATS & LOG_MMU conversions, Eduardo Habkost, 2008/12/12
- Re: [Qemu-devel] [PATCH 00/31] Logging code cleanup, take 2, Blue Swirl, 2008/12/12