[PATCH] sparc32: better unassigned memory debug message

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] sparc32: better unassigned memory debug message

Robert Reif
Pass the asi number in is_asi.  This works because asi 0 is not a valid asi.
Print out the type of access (read, write, exec).

diff -p -u -r1.61 op_helper.c
--- target-sparc/op_helper.c 10 Dec 2007 19:58:20 -0000 1.61
+++ target-sparc/op_helper.c 28 Dec 2007 17:07:49 -0000
@@ -416,7 +416,7 @@ void helper_ld_asi(int asi, int size, in
         break;
     case 0x21 ... 0x2d: /* MMU passthrough, unassigned */
     default:
-        do_unassigned_access(T0, 0, 0, 1);
+        do_unassigned_access(T0, 0, 0, asi);
         ret = 0;
         break;
     }
@@ -717,7 +717,7 @@ void helper_st_asi(int asi, int size)
     case 9: /* Supervisor code access, XXX */
     case 0x21 ... 0x2d: /* MMU passthrough, unassigned */
     default:
-        do_unassigned_access(T0, 1, 0, 1);
+        do_unassigned_access(T0, 1, 0, asi);
         return;
     }
 }
@@ -1832,6 +1832,17 @@ void do_unassigned_access(target_phys_ad
        generated code */
     saved_env = env;
     env = cpu_single_env;
+#ifdef DEBUG_UNASSIGNED
+    if (is_asi)
+        printf("Unassigned mem %s access to " TARGET_FMT_plx " asi 0x%02x from "
+               TARGET_FMT_lx "\n",
+               is_exec ? "exec" : is_write ? "write" : "read", addr, is_asi,
+               env->pc);
+    else
+        printf("Unassigned mem %s access to " TARGET_FMT_plx " from "
+               TARGET_FMT_lx "\n",
+               is_exec ? "exec" : is_write ? "write" : "read", addr, env->pc);
+#endif
     if (env->mmuregs[3]) /* Fault status register */
         env->mmuregs[3] = 1; /* overflow (not read before another fault) */
     if (is_asi)
@@ -1845,10 +1856,6 @@ void do_unassigned_access(target_phys_ad
     env->mmuregs[3] |= (5 << 2) | 2;
     env->mmuregs[4] = addr; /* Fault address register */
     if ((env->mmuregs[0] & MMU_E) && !(env->mmuregs[0] & MMU_NF)) {
-#ifdef DEBUG_UNASSIGNED
-        printf("Unassigned mem access to " TARGET_FMT_plx " from " TARGET_FMT_lx
-               "\n", addr, env->pc);
-#endif
         if (is_exec)
             raise_exception(TT_CODE_ACCESS);
         else