Fix non-anulled calls so that return address is correct
authorMichael Meissner <gnu@the-meissners.org>
Thu, 8 May 1997 18:36:00 +0000 (18:36 +0000)
committerMichael Meissner <gnu@the-meissners.org>
Thu, 8 May 1997 18:36:00 +0000 (18:36 +0000)
sim/tic80/ChangeLog
sim/tic80/insns

index 51e676ab12dd09bc5ef8adaf452145f4943fe536..4a458e428fb9d59066991fd54435584ebcbfea20 100644 (file)
@@ -1,5 +1,9 @@
 Thu May  8 11:57:47 1997  Michael Meissner  <meissner@cygnus.com>
 
+       * insns (jsr,bsr): For non-allulled calls, set r31 so that the
+       return address does not reexecute the instruction in the delay
+       slot.
+
        * misc.c (tic80_trace_*): Change format slightly to accomidate
        real large decimal values.
 
index 437b6c95b6ffbdcad1ec361a3372e84e606be5fc..7c16213a775d473c1449d8cd57d89051a77a11c1 100644 (file)
@@ -230,7 +230,7 @@ instruction_address::function::do_bsr:instruction_address nia, signed32 *rLink,
            nia.ip = -1;
          }
        else
-         *rLink = cia.dp + sizeof (instruction_word);
+         *rLink = nia.ip + sizeof (instruction_word);
        nia.dp = cia.ip + 4 * offset;
        TRACE_UCOND_BR (MY_INDEX, nia.dp);
        return nia;
@@ -614,7 +614,7 @@ instruction_address::function::do_jsr:instruction_address nia, signed32 *rLink,
            nia.ip = -1;
          }
        else
-         *rLink = cia.dp + sizeof (instruction_word);
+         *rLink = nia.ip + sizeof (instruction_word);
        nia.dp = offset + base;
        if (nia.dp & 0x3)
          engine_error (SD, CPU, cia,