* mem.c (rx_mem_ptr): When invalidating the decode cache, account
authorKevin Buettner <kevinb@redhat.com>
Thu, 30 Sep 2010 00:03:23 +0000 (00:03 +0000)
committerKevin Buettner <kevinb@redhat.com>
Thu, 30 Sep 2010 00:03:23 +0000 (00:03 +0000)
for the fact that the instruction decoder never uses swapped
addresses.

sim/rx/ChangeLog
sim/rx/mem.c

index 4da59659d4a8a536539d9956b95c73524c91cdc2..8728ebf0373652ab7e80b11ee67dc357bdd11ace 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-29  Kevin Buettner  <kevinb@redhat.com>
+
+       * mem.c (rx_mem_ptr): When invalidating the decode cache, account
+       for the fact that the instruction decoder never uses swapped
+       addresses.
+
 2010-09-29  Nick Clifton  <nickc@redhat.com>
 
        * rx.c (decode_opcode: RXO_int): Only break out of the emulation
index 7405518e3aa2f5dc006dc28d99d3b5612554383a..3a976cb85545d7abb3aa896fbb17e412080df789 100644 (file)
@@ -104,13 +104,19 @@ rx_mem_ptr (unsigned long address, enum mem_ptr_action action)
 
   if (action == MPA_WRITING)
     {
+      int pto_dc;
       if (ptr[pt1][pt2][pto] == MC_PUSHED_PC)
        execution_error (SIM_ERR_CORRUPT_STACK, address);
       ptr[pt1][pt2][pto] = MC_DATA;
-      if (ptdc[pt1][pt2][pto])
+
+      /* The instruction decoder doesn't store it's decoded instructions
+         at word swapped addresses.  Therefore, when clearing the decode
+        cache, we have to account for that here.  */
+      pto_dc = pto ^ (rx_big_endian ? 3 : 0);
+      if (ptdc[pt1][pt2][pto_dc])
        {
-         free (ptdc[pt1][pt2][pto]);
-         ptdc[pt1][pt2][pto] = NULL;
+         free (ptdc[pt1][pt2][pto_dc]);
+         ptdc[pt1][pt2][pto_dc] = NULL;
        }
     }