(decode_opcode): RXO_branchrel is relative to the opcode's PC, not
authorDJ Delorie <dj@redhat.com>
Tue, 14 Dec 2010 23:39:03 +0000 (23:39 +0000)
committerDJ Delorie <dj@redhat.com>
Tue, 14 Dec 2010 23:39:03 +0000 (23:39 +0000)
the address following the opcode.

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

index c0b4b5dda64621d1a83a797758a4813f19652411..1f9866a11558bb79715919b6ce0127729f316dee 100644 (file)
@@ -2,6 +2,8 @@
 
        * rx.c (decode_opcode): For "MVFC PC,", use the address of the
        opcode, not the address following the opcode.
+       (decode_opcode): RXO_branchrel is relative to the opcode's PC, not
+       the address following the opcode.
 
 2010-11-11  DJ Delorie  <dj@redhat.com>
 
index 5fb11d9f8c7fe1cda905d6b629a995b734231da3..dd9bb8ef8030246ef471d0b96631ba610c5226a7 100644 (file)
@@ -1087,10 +1087,10 @@ decode_opcode ()
       break;
 
     case RXO_branchrel:
-      if (GS())
+      if (opcode->op[1].type == RX_Operand_None || GS())
        {
          int delta = GD();
-         regs.r_pc += delta;
+         regs.r_pc = opcode_pc + delta;
 #ifdef CYCLE_ACCURATE
          /* Note: specs say 3, chip says 2.  */
          if (delta >= 0 && delta < 16