Skip to contentSkip to conversation

sparc: show size for unassigned accesses

PATCH Applied Robert Reif 4 participants 7 messages Oct 2, 2008 – Oct 6, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: show size for unassigned accesses

cpu.h +1 -1
Index: target-sparc/cpu.h
===================================================================
@@ -424,7 +424,7 @@
 
 /* cpu-exec.c */
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int is_asi);
+                          int is_asi, int size);
 int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);
 
 #define CPUState CPUSPARCState
op_helper.c +14 -13
Index: target-sparc/op_helper.c
===================================================================
@@ -950,7 +950,7 @@
         break;
     case 8: /* User code access, XXX */
     default:
-        do_unassigned_access(addr, 0, 0, asi);
+        do_unassigned_access(addr, 0, 0, asi, size);
         ret = 0;
         break;
     }
@@ -1284,7 +1284,7 @@
     case 8: /* User code access, XXX */
     case 9: /* Supervisor code access, XXX */
     default:
-        do_unassigned_access(addr, 1, 0, asi);
+        do_unassigned_access(addr, 1, 0, asi, size);
         break;
     }
 #ifdef DEBUG_ASI
@@ -1464,7 +1464,7 @@
     case 0x8a: // Primary no-fault LE, RO
     case 0x8b: // Secondary no-fault LE, RO
     default:
-        do_unassigned_access(addr, 1, 0, 1);
+        do_unassigned_access(addr, 1, 0, 1, size);
         return;
     }
 }
@@ -1675,7 +1675,7 @@
     case 0x5f: // D-MMU demap, WO
     case 0x77: // Interrupt vector, WO
     default:
-        do_unassigned_access(addr, 0, 0, 1);
+        do_unassigned_access(addr, 0, 0, 1, size);
         ret = 0;
         break;
     }
@@ -2082,7 +2082,7 @@
     case 0x8a: // Primary no-fault LE, RO
     case 0x8b: // Secondary no-fault LE, RO
     default:
-        do_unassigned_access(addr, 1, 0, 1);
+        do_unassigned_access(addr, 1, 0, 1, size);
         return;
     }
 }
@@ -3025,7 +3025,7 @@
 
 #ifndef TARGET_SPARC64
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int is_asi)
+                          int is_asi, int size)
 {
     CPUState *saved_env;
 
@@ -3035,14 +3035,15 @@
     env = cpu_single_env;
 #ifdef DEBUG_UNASSIGNED
     if (is_asi)
-        printf("Unassigned mem %s access to " TARGET_FMT_plx
+        printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
                " asi 0x%02x from " TARGET_FMT_lx "\n",
-               is_exec ? "exec" : is_write ? "write" : "read", addr, is_asi,
-               env->pc);
+               is_exec ? "exec" : is_write ? "write" : "read", size, 
+               size == 1 ? "" : "s", 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);
+        printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
+               " from " TARGET_FMT_lx "\n",
+               is_exec ? "exec" : is_write ? "write" : "read", size,
+               size == 1 ? "" : "s", addr, env->pc);
 #endif
     if (env->mmuregs[3]) /* Fault status register */
         env->mmuregs[3] = 1; /* overflow (not read before another fault) */
@@ -3066,7 +3067,7 @@
 }
 #else
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int is_asi)
+                          int is_asi, int size)
 {
 #ifdef DEBUG_UNASSIGNED
     CPUState *saved_env;
exec.c +54 -4

89 lines not on this page · raw message

exec-all.h +3 -1
Index: exec-all.h
===================================================================
@@ -330,7 +330,9 @@
     }
     pd = env1->tlb_table[mmu_idx][page_index].addr_code & ~TARGET_PAGE_MASK;
     if (pd > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) {
-#if defined(TARGET_SPARC) || defined(TARGET_MIPS)
+#if defined(TARGET_SPARC)
+        do_unassigned_access(addr, 0, 1, 0, 4);
+#elif defined(TARGET_MIPS)
         do_unassigned_access(addr, 0, 1, 0);
 #else
         cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x" TARGET_FMT_lx "\n", addr);
#1 lore raw
Quoted 6 lines · Robert Reif

#ifdef TARGET_SPARC
+ do_unassigned_access(addr, 0, 0, 0, 1);
+#elif defined(TARGET_CRIS)

     do_unassigned_access(addr, 0, 0, 0);

+#endif
+ return 0;

I think it would be cleaner solution to convert also CRIS and MIPS versions to take the size argument.

#2 lore raw
Quoted 10 lines · Blue Swirl
Quoted 7 lines · Robert Reif

#ifdef TARGET_SPARC
+ do_unassigned_access(addr, 0, 0, 0, 1);
+#elif defined(TARGET_CRIS)

     do_unassigned_access(addr, 0, 0, 0);

+#endif
+ return 0;

Quoted 6 lines

I think it would be cleaner solution to convert also CRIS and MIPS versions to take the size argument.

cpu.h +1 -1
Index: target-cris/cpu.h
===================================================================
@@ -168,7 +168,7 @@
 int cpu_cris_signal_handler(int host_signum, void *pinfo,
                            void *puc);
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int is_asi);
+                          int is_asi, int size);
 
 enum {
     CC_OP_DYNAMIC, /* Use env->cc_op  */
op_helper.c +3 -3
Index: target-cris/op_helper.c
===================================================================
@@ -237,10 +237,10 @@
 }
 
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int is_asi)
+                          int is_asi, int size)
 {
-	D(printf("%s addr=%x w=%d ex=%d asi=%d\n", 
-		__func__, addr, is_write, is_exec, is_asi));
+	D(printf("%s addr=%x w=%d ex=%d asi=%d, size=%d\n", 
+		__func__, addr, is_write, is_exec, is_asi, size));
 }
 
 static void evaluate_flags_writeback(uint32_t flags)
cpu.h +1 -1
Index: target-sparc/cpu.h
===================================================================
@@ -430,7 +430,7 @@
 
 /* cpu-exec.c */
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int is_asi);
+                          int is_asi, int size);
 int cpu_sparc_signal_handler(int host_signum, void *pinfo, void *puc);
 
 #define CPUState CPUSPARCState
op_helper.c +14 -13
Index: target-sparc/op_helper.c
===================================================================
@@ -950,7 +950,7 @@
         break;
     case 8: /* User code access, XXX */
     default:
-        do_unassigned_access(addr, 0, 0, asi);
+        do_unassigned_access(addr, 0, 0, asi, size);
         ret = 0;
         break;
     }
@@ -1284,7 +1284,7 @@
     case 8: /* User code access, XXX */
     case 9: /* Supervisor code access, XXX */
     default:
-        do_unassigned_access(addr, 1, 0, asi);
+        do_unassigned_access(addr, 1, 0, asi, size);
         break;
     }
 #ifdef DEBUG_ASI
@@ -1464,7 +1464,7 @@
     case 0x8a: // Primary no-fault LE, RO
     case 0x8b: // Secondary no-fault LE, RO
     default:
-        do_unassigned_access(addr, 1, 0, 1);
+        do_unassigned_access(addr, 1, 0, 1, size);
         return;
     }
 }
@@ -1675,7 +1675,7 @@
     case 0x5f: // D-MMU demap, WO
     case 0x77: // Interrupt vector, WO
     default:
-        do_unassigned_access(addr, 0, 0, 1);
+        do_unassigned_access(addr, 0, 0, 1, size);
         ret = 0;
         break;
     }
@@ -2082,7 +2082,7 @@
     case 0x8a: // Primary no-fault LE, RO
     case 0x8b: // Secondary no-fault LE, RO
     default:
-        do_unassigned_access(addr, 1, 0, 1);
+        do_unassigned_access(addr, 1, 0, 1, size);
         return;
     }
 }
@@ -3025,7 +3025,7 @@
 
 #ifndef TARGET_SPARC64
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int is_asi)
+                          int is_asi, int size)
 {
     CPUState *saved_env;
 
@@ -3035,14 +3035,15 @@
     env = cpu_single_env;
 #ifdef DEBUG_UNASSIGNED
     if (is_asi)
-        printf("Unassigned mem %s access to " TARGET_FMT_plx
+        printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
                " asi 0x%02x from " TARGET_FMT_lx "\n",
-               is_exec ? "exec" : is_write ? "write" : "read", addr, is_asi,
-               env->pc);
+               is_exec ? "exec" : is_write ? "write" : "read", size, 
+               size == 1 ? "" : "s", 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);
+        printf("Unassigned mem %s access of %d byte%s to " TARGET_FMT_plx
+               " from " TARGET_FMT_lx "\n",
+               is_exec ? "exec" : is_write ? "write" : "read", size,
+               size == 1 ? "" : "s", addr, env->pc);
 #endif
     if (env->mmuregs[3]) /* Fault status register */
         env->mmuregs[3] = 1; /* overflow (not read before another fault) */
@@ -3066,7 +3067,7 @@
 }
 #else
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int is_asi)
+                          int is_asi, int size)
 {
 #ifdef DEBUG_UNASSIGNED
     CPUState *saved_env;
cpu.h +1 -1
Index: target-mips/cpu.h
===================================================================
@@ -470,7 +470,7 @@
 void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
 
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int unused);
+                          int unused, int size);
 
 #define CPUState CPUMIPSState
 #define cpu_init cpu_mips_init
op_helper.c +1 -1
Index: target-mips/op_helper.c
===================================================================
@@ -1911,7 +1911,7 @@
 }
 
 void do_unassigned_access(target_phys_addr_t addr, int is_write, int is_exec,
-                          int unused)
+                          int unused, int size)
 {
     if (is_exec)
         do_raise_exception(EXCP_IBE);
exec.c +50 -12

86 lines not on this page · raw message

exec-all.h +1 -1
Index: exec-all.h
===================================================================
@@ -331,7 +331,7 @@
     pd = env1->tlb_table[mmu_idx][page_index].addr_code & ~TARGET_PAGE_MASK;
     if (pd > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) {
 #if defined(TARGET_SPARC) || defined(TARGET_MIPS)
-        do_unassigned_access(addr, 0, 1, 0);
+        do_unassigned_access(addr, 0, 1, 0, 4);
 #else
         cpu_abort(env1, "Trying to execute code outside RAM or ROM at 0x" TARGET_FMT_lx "\n", addr);
 #endif
#3 lore raw
Quoted 14 lines · Robert Reif
Quoted 12 lines · Blue Swirl
Quoted 8 lines · Robert Reif

#ifdef TARGET_SPARC
+ do_unassigned_access(addr, 0, 0, 0, 1);
+#elif defined(TARGET_CRIS)

    do_unassigned_access(addr, 0, 0, 0);

+#endif
+ return 0;

Quoted 2 lines
Quoted 2 lines

I think it would be cleaner solution to convert also CRIS and MIPS versions to take the size argument.

Is this patch OK for CRIS and MIPS too? The extra parameter should not hurt.

#4 lore raw
Quoted 15 lines · Blue Swirl
Quoted 14 lines · Robert Reif
Quoted 12 lines · Blue Swirl
Quoted 8 lines · Robert Reif

#ifdef TARGET_SPARC
+ do_unassigned_access(addr, 0, 0, 0, 1);
+#elif defined(TARGET_CRIS)

    do_unassigned_access(addr, 0, 0, 0);

+#endif
+ return 0;

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

I think it would be cleaner solution to convert also CRIS and MIPS versions to take the size argument.

Is this patch OK for CRIS and MIPS too? The extra parameter should not hurt.

It doesn't hurt for CRIS.

Thanks

Acked-by
#5 lore raw
In reply to Blue Swirl
Quoted 15 lines · Blue Swirl
Quoted 14 lines · Robert Reif
Quoted 12 lines · Blue Swirl
Quoted 8 lines · Robert Reif

#ifdef TARGET_SPARC
+ do_unassigned_access(addr, 0, 0, 0, 1);
+#elif defined(TARGET_CRIS)

    do_unassigned_access(addr, 0, 0, 0);

+#endif
+ return 0;

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

I think it would be cleaner solution to convert also CRIS and MIPS versions to take the size argument.

Is this patch OK for CRIS and MIPS too? The extra parameter should not hurt.

Applied
#6 lore raw
In reply to Robert Reif
Quoted 14 lines · Robert Reif
Quoted 12 lines · Blue Swirl
Quoted 8 lines · Robert Reif

#ifdef TARGET_SPARC
+ do_unassigned_access(addr, 0, 0, 0, 1);
+#elif defined(TARGET_CRIS)

    do_unassigned_access(addr, 0, 0, 0);

+#endif
+ return 0;

Quoted 9 lines
Quoted 7 lines

I think it would be cleaner solution to convert also CRIS and MIPS versions to take the size argument.

Thanks, applied.