From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LB9et-0007jk-Of for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LB9eo-0007dP-DD for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:23 -0500 Received: from [199.232.76.173] (port=50390 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LB9en-0007cK-UY for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:22 -0500 Received: from mx2.redhat.com ([66.187.237.31]:33013) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LB9en-0001en-EC for qemu-devel@nongnu.org; Fri, 12 Dec 2008 10:10:21 -0500 From: Eduardo Habkost Date: Fri, 12 Dec 2008 13:09:02 -0200 Message-Id: <1229094550-2022-24-git-send-email-ehabkost@redhat.com> In-Reply-To: <1229094550-2022-1-git-send-email-ehabkost@redhat.com> References: <1229094550-2022-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 23/31] target-ppc/helper.c: LOG_SLB macro Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost Create a LOG_SLB macro and use it instead of #ifdef DEBUG_SLB. Signed-off-by: Eduardo Habkost --- target-ppc/helper.c | 32 ++++++++++++-------------------- 1 files changed, 12 insertions(+), 20 deletions(-) diff --git a/target-ppc/helper.c b/target-ppc/helper.c index d12fb74..9c095e4 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -66,6 +66,14 @@ # define LOG_BATS(...) do { } while (0) #endif +#ifdef DEBUG_SLB +# define LOG_SLB(...) do { \ + if (loglevel) \ + fprintf(logfile, ## __VA_ARGS__); \ + } while (0) +#else +# define LOG_SLB(...) do { } while (0) +#endif /*****************************************************************************/ /* PowerPC MMU emulation */ @@ -702,22 +710,14 @@ static always_inline int slb_lookup (CPUPPCState *env, target_ulong eaddr, ret = -5; sr_base = env->spr[SPR_ASR]; -#if defined(DEBUG_SLB) - if (loglevel != 0) { - fprintf(logfile, "%s: eaddr " ADDRX " base " PADDRX "\n", + LOG_SLB("%s: eaddr " ADDRX " base " PADDRX "\n", __func__, eaddr, sr_base); - } -#endif mask = 0x0000000000000000ULL; /* Avoid gcc warning */ for (n = 0; n < env->slb_nr; n++) { tmp64 = ldq_phys(sr_base); tmp = ldl_phys(sr_base + 8); -#if defined(DEBUG_SLB) - if (loglevel != 0) { - fprintf(logfile, "%s: seg %d " PADDRX " %016" PRIx64 " %08" + LOG_SLB("%s: seg %d " PADDRX " %016" PRIx64 " %08" PRIx32 "\n", __func__, n, sr_base, tmp64, tmp); - } -#endif if (slb_is_valid(tmp64)) { /* SLB entry is valid */ switch (tmp64 & 0x0000000006000000ULL) { @@ -821,12 +821,8 @@ target_ulong ppc_load_slb (CPUPPCState *env, int slb_nr) } else { rt = 0; } -#if defined(DEBUG_SLB) - if (loglevel != 0) { - fprintf(logfile, "%s: " PADDRX " %016" PRIx64 " %08" PRIx32 " => %d " + LOG_SLB("%s: " PADDRX " %016" PRIx64 " %08" PRIx32 " => %d " ADDRX "\n", __func__, sr_base, tmp64, tmp, slb_nr, rt); - } -#endif return rt; } @@ -848,13 +844,9 @@ void ppc_store_slb (CPUPPCState *env, int slb_nr, target_ulong rs) tmp64 |= 1 << 27; /* Set ESID */ tmp64 |= (uint32_t)slb_nr << 28; -#if defined(DEBUG_SLB) - if (loglevel != 0) { - fprintf(logfile, "%s: %d " ADDRX " => " PADDRX " %016" PRIx64 + LOG_SLB("%s: %d " ADDRX " => " PADDRX " %016" PRIx64 " %08" PRIx32 "\n", __func__, slb_nr, rs, sr_base, tmp64, tmp); - } -#endif /* Write SLB entry to memory */ stq_phys(sr_base, tmp64); stl_phys(sr_base + 8, tmp); -- 1.5.5.GIT