Reviewed-by: Richard Henderson <r...@twiddle.net>
Signed-off-by: Blue Swirl <blauwir...@gmail.com>
---
 target-sparc/win_helper.c |   30 ++++++++----------------------
 trace-events              |    8 ++++++++
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/target-sparc/win_helper.c b/target-sparc/win_helper.c
index f42d996..a68c649 100644
--- a/target-sparc/win_helper.c
+++ b/target-sparc/win_helper.c
@@ -19,15 +19,7 @@

 #include "cpu.h"
 #include "helper.h"
-
-//#define DEBUG_PSTATE
-
-#ifdef DEBUG_PSTATE
-#define DPRINTF_PSTATE(fmt, ...)                                \
-    do { printf("PSTATE: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF_PSTATE(fmt, ...) do {} while (0)
-#endif
+#include "trace.h"

 static inline void memcpy32(target_ulong *dst, const target_ulong *src)
 {
@@ -293,11 +285,7 @@ static inline uint64_t *get_gregset(CPUState
*env, uint32_t pstate)
 {
     switch (pstate) {
     default:
-        DPRINTF_PSTATE("ERROR in get_gregset: active pstate bits=%x%s%s%s\n",
-                       pstate,
-                       (pstate & PS_IG) ? " IG" : "",
-                       (pstate & PS_MG) ? " MG" : "",
-                       (pstate & PS_AG) ? " AG" : "");
+        trace_win_helper_gregset_error(pstate);
         /* pass through to normal set of global registers */
     case 0:
         return env->bgregs;
@@ -324,16 +312,15 @@ void cpu_change_pstate(CPUState *env, uint32_t new_pstate)
     new_pstate_regs = new_pstate & 0xc01;

     if (new_pstate_regs != pstate_regs) {
-        DPRINTF_PSTATE("change_pstate: switching regs old=%x new=%x\n",
-                       pstate_regs, new_pstate_regs);
+        trace_win_helper_switch_pstate(pstate_regs, new_pstate_regs);
+
         /* Switch global register bank */
         src = get_gregset(env, new_pstate_regs);
         dst = get_gregset(env, pstate_regs);
         memcpy32(dst, env->gregs);
         memcpy32(env->gregs, src);
     } else {
-        DPRINTF_PSTATE("change_pstate: regs new=%x (unchanged)\n",
-                       new_pstate_regs);
+        trace_win_helper_no_switch_pstate(new_pstate_regs);
     }
     env->pstate = new_pstate;
 }
@@ -352,8 +339,7 @@ void helper_wrpstate(CPUState *env, target_ulong new_state)
 void helper_wrpil(CPUState *env, target_ulong new_pil)
 {
 #if !defined(CONFIG_USER_ONLY)
-    DPRINTF_PSTATE("helper_wrpil old=%x new=%x\n",
-                   env->psrpil, (uint32_t)new_pil);
+    trace_win_helper_wrpil(env->psrpil, (uint32_t)new_pil);

     env->psrpil = new_pil;

@@ -375,7 +361,7 @@ void helper_done(CPUState *env)
     cpu_put_cwp64(env, tsptr->tstate & 0xff);
     env->tl--;

-    DPRINTF_PSTATE("... helper_done tl=%d\n", env->tl);
+    trace_win_helper_done(env->tl);

 #if !defined(CONFIG_USER_ONLY)
     if (cpu_interrupts_enabled(env)) {
@@ -396,7 +382,7 @@ void helper_retry(CPUState *env)
     cpu_put_cwp64(env, tsptr->tstate & 0xff);
     env->tl--;

-    DPRINTF_PSTATE("... helper_retry tl=%d\n", env->tl);
+    trace_win_helper_retry(env->tl);

 #if !defined(CONFIG_USER_ONLY)
     if (cpu_interrupts_enabled(env)) {
diff --git a/trace-events b/trace-events
index e55839b..78fec90 100644
--- a/trace-events
+++ b/trace-events
@@ -615,3 +615,11 @@ int_helper_clear_softint(uint32_t softint) "new %08x"
 int_helper_write_softint(uint32_t softint) "new %08x"
 int_helper_icache_freeze(void) "Instruction cache: freeze"
 int_helper_dcache_freeze(void) "Data cache: freeze"
+
+# target-sparc/win_helper.c
+win_helper_gregset_error(uint32_t pstate) "ERROR in get_gregset:
active pstate bits=%x"
+win_helper_switch_pstate(uint32_t pstate_regs, uint32_t
new_pstate_regs) "change_pstate: switching regs old=%x new=%x"
+win_helper_no_switch_pstate(uint32_t new_pstate_regs) "change_pstate:
regs new=%x (unchanged)"
+win_helper_wrpil(uint32_t psrpil, uint32_t new_pil) "old=%x new=%x"
+win_helper_done(uint32_t tl) "tl=%d"
+win_helper_retry(uint32_t tl) "tl=%d"
-- 
1.6.2.4
From 50d619b7192b5359691f6e7ae472e51bc874a12e Mon Sep 17 00:00:00 2001
Message-Id: <50d619b7192b5359691f6e7ae472e51bc874a12e.1319577223.git.blauwir...@gmail.com>
In-Reply-To: <5e02e05c1c7888d692706ce5bbaea5b64c8b22a8.1319577223.git.blauwir...@gmail.com>
References: <5e02e05c1c7888d692706ce5bbaea5b64c8b22a8.1319577223.git.blauwir...@gmail.com>
From: Blue Swirl <blauwir...@gmail.com>
Date: Sun, 11 Sep 2011 15:53:35 +0000
Subject: [PATCH 8/9] Sparc: convert win_helper to trace framework

Reviewed-by: Richard Henderson <r...@twiddle.net>
Signed-off-by: Blue Swirl <blauwir...@gmail.com>
---
 target-sparc/win_helper.c |   30 ++++++++----------------------
 trace-events              |    8 ++++++++
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/target-sparc/win_helper.c b/target-sparc/win_helper.c
index f42d996..a68c649 100644
--- a/target-sparc/win_helper.c
+++ b/target-sparc/win_helper.c
@@ -19,15 +19,7 @@
 
 #include "cpu.h"
 #include "helper.h"
-
-//#define DEBUG_PSTATE
-
-#ifdef DEBUG_PSTATE
-#define DPRINTF_PSTATE(fmt, ...)                                \
-    do { printf("PSTATE: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF_PSTATE(fmt, ...) do {} while (0)
-#endif
+#include "trace.h"
 
 static inline void memcpy32(target_ulong *dst, const target_ulong *src)
 {
@@ -293,11 +285,7 @@ static inline uint64_t *get_gregset(CPUState *env, uint32_t pstate)
 {
     switch (pstate) {
     default:
-        DPRINTF_PSTATE("ERROR in get_gregset: active pstate bits=%x%s%s%s\n",
-                       pstate,
-                       (pstate & PS_IG) ? " IG" : "",
-                       (pstate & PS_MG) ? " MG" : "",
-                       (pstate & PS_AG) ? " AG" : "");
+        trace_win_helper_gregset_error(pstate);
         /* pass through to normal set of global registers */
     case 0:
         return env->bgregs;
@@ -324,16 +312,15 @@ void cpu_change_pstate(CPUState *env, uint32_t new_pstate)
     new_pstate_regs = new_pstate & 0xc01;
 
     if (new_pstate_regs != pstate_regs) {
-        DPRINTF_PSTATE("change_pstate: switching regs old=%x new=%x\n",
-                       pstate_regs, new_pstate_regs);
+        trace_win_helper_switch_pstate(pstate_regs, new_pstate_regs);
+
         /* Switch global register bank */
         src = get_gregset(env, new_pstate_regs);
         dst = get_gregset(env, pstate_regs);
         memcpy32(dst, env->gregs);
         memcpy32(env->gregs, src);
     } else {
-        DPRINTF_PSTATE("change_pstate: regs new=%x (unchanged)\n",
-                       new_pstate_regs);
+        trace_win_helper_no_switch_pstate(new_pstate_regs);
     }
     env->pstate = new_pstate;
 }
@@ -352,8 +339,7 @@ void helper_wrpstate(CPUState *env, target_ulong new_state)
 void helper_wrpil(CPUState *env, target_ulong new_pil)
 {
 #if !defined(CONFIG_USER_ONLY)
-    DPRINTF_PSTATE("helper_wrpil old=%x new=%x\n",
-                   env->psrpil, (uint32_t)new_pil);
+    trace_win_helper_wrpil(env->psrpil, (uint32_t)new_pil);
 
     env->psrpil = new_pil;
 
@@ -375,7 +361,7 @@ void helper_done(CPUState *env)
     cpu_put_cwp64(env, tsptr->tstate & 0xff);
     env->tl--;
 
-    DPRINTF_PSTATE("... helper_done tl=%d\n", env->tl);
+    trace_win_helper_done(env->tl);
 
 #if !defined(CONFIG_USER_ONLY)
     if (cpu_interrupts_enabled(env)) {
@@ -396,7 +382,7 @@ void helper_retry(CPUState *env)
     cpu_put_cwp64(env, tsptr->tstate & 0xff);
     env->tl--;
 
-    DPRINTF_PSTATE("... helper_retry tl=%d\n", env->tl);
+    trace_win_helper_retry(env->tl);
 
 #if !defined(CONFIG_USER_ONLY)
     if (cpu_interrupts_enabled(env)) {
diff --git a/trace-events b/trace-events
index e55839b..78fec90 100644
--- a/trace-events
+++ b/trace-events
@@ -615,3 +615,11 @@ int_helper_clear_softint(uint32_t softint) "new %08x"
 int_helper_write_softint(uint32_t softint) "new %08x"
 int_helper_icache_freeze(void) "Instruction cache: freeze"
 int_helper_dcache_freeze(void) "Data cache: freeze"
+
+# target-sparc/win_helper.c
+win_helper_gregset_error(uint32_t pstate) "ERROR in get_gregset: active pstate bits=%x"
+win_helper_switch_pstate(uint32_t pstate_regs, uint32_t new_pstate_regs) "change_pstate: switching regs old=%x new=%x"
+win_helper_no_switch_pstate(uint32_t new_pstate_regs) "change_pstate: regs new=%x (unchanged)"
+win_helper_wrpil(uint32_t psrpil, uint32_t new_pil) "old=%x new=%x"
+win_helper_done(uint32_t tl) "tl=%d"
+win_helper_retry(uint32_t tl) "tl=%d"
-- 
1.7.2.5

Reply via email to