qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 23/31] target-ppc/helper.c: LOG_SLB macro


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 23/31] target-ppc/helper.c: LOG_SLB macro
Date: Fri, 12 Dec 2008 13:09:02 -0200

Create a LOG_SLB macro and use it instead of #ifdef DEBUG_SLB.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]