* cris/cris-tmpl.c (MY (f_model_insn_before)): Make sure only the
authorHans-Peter Nilsson <hp@axis.com>
Wed, 16 Nov 2005 04:50:57 +0000 (04:50 +0000)
committerHans-Peter Nilsson <hp@axis.com>
Wed, 16 Nov 2005 04:50:57 +0000 (04:50 +0000)
low 32 bits are used after an unsigned long cast.

sim/ChangeLog
sim/cris/cris-tmpl.c

index e7ef6a5a3807147117ba38ab1985ea064599c63d..3fa2416c3b8542b332c91f89f64879ddd2d640c4 100644 (file)
@@ -1,3 +1,8 @@
+2005-11-16  Hans-Peter Nilsson  <hp@axis.com>
+
+       * cris/cris-tmpl.c (MY (f_model_insn_before)): Make sure only the
+       low 32 bits are used after an unsigned long cast.
+
 2005-05-28  Hans-Peter Nilsson  <hp@axis.com>
 
        * cris/Makefile.in (stamp-v32fmloop): Depend on stamp-v10fmloop.
index 3a24cf3333bdd1ab233c975372c50692d6090cdb..678ac01d38c74c58cb8aedbb33bfe78215aa7855 100644 (file)
@@ -121,13 +121,15 @@ MY (f_model_insn_before) (SIM_CPU *current_cpu, int first_p ATTRIBUTE_UNUSED)
     char flags[7];
     SIM_DESC sd = CPU_STATE (current_cpu);
 
-    cris_trace_printf (sd, current_cpu, "%lx ", (unsigned long) (CPU (h_pc)));
+    cris_trace_printf (sd, current_cpu, "%lx ",
+                      0xffffffffUL & (unsigned long) (CPU (h_pc)));
 
     for (i = 0; i < 15; i++)
       cris_trace_printf (sd, current_cpu, "%lx ",
-                        (unsigned long) (XCONCAT3(crisv,BASENUM,
-                                                  f_h_gr_get) (current_cpu,
-                                                               i)));
+                        0xffffffffUL
+                        & (unsigned long) (XCONCAT3(crisv,BASENUM,
+                                                    f_h_gr_get) (current_cpu,
+                                                                 i)));
     flags[0] = GET_H_IBIT () != 0 ? 'I' : 'i';
     flags[1] = GET_H_XBIT () != 0 ? 'X' : 'x';
     flags[2] = GET_H_NBIT () != 0 ? 'N' : 'n';
@@ -148,9 +150,10 @@ MY (f_model_insn_before) (SIM_CPU *current_cpu, int first_p ATTRIBUTE_UNUSED)
                             ->unaligned_mem_dword_count
                             - CPU_CRIS_PREV_MISC_PROFILE (current_cpu)
                             ->unaligned_mem_dword_count)),
-                        (unsigned long) (XCONCAT3(crisv,BASENUM,
-                                                  f_h_gr_get) (current_cpu,
-                                                               15)));
+                        0xffffffffUL
+                        & (unsigned long) (XCONCAT3(crisv,BASENUM,
+                                                    f_h_gr_get) (current_cpu,
+                                                                 15)));
     else
       cris_trace_printf (sd, current_cpu, "%s %d\n", flags,
                         (int)