From: Jeff Law Date: Mon, 16 Dec 1996 17:08:10 +0000 (+0000) Subject: * simops.c: Fix restoring the PC for "ret" and "retf" instructions. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=16d2e2b67020b95063ddcecc7556f206a5ffab30;p=binutils-gdb.git * simops.c: Fix restoring the PC for "ret" and "retf" instructions. --- diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog index 3f726c8a141..69a7b4dcc46 100644 --- a/sim/mn10300/ChangeLog +++ b/sim/mn10300/ChangeLog @@ -1,3 +1,14 @@ +Mon Dec 16 10:03:52 1996 Jeffrey A Law (law@cygnus.com) + + * simops.c: Fix restoring the PC for "ret" and "retf" instructions. + +Wed Dec 11 09:53:10 1996 Jeffrey A Law (law@cygnus.com) + + * gencode.c (write_opcodes): Also write out the format of the + opcode. + * mn10300_sim.h (simops): Add "format" field. + * interp.c (sim_resume): Deal with endianness issues here. + Tue Dec 10 15:05:37 1996 Jeffrey A Law (law@cygnus.com) * simops.c (REG0_4): Define. diff --git a/sim/mn10300/simops.c b/sim/mn10300/simops.c index 02bf7b2ad5c..ff0a9159460 100644 --- a/sim/mn10300/simops.c +++ b/sim/mn10300/simops.c @@ -2690,7 +2690,6 @@ void OP_DF0000 (insn, extension) unsigned long mask; State.regs[REG_SP] += insn & 0xff; - State.pc = State.regs[REG_MDR] - 3; sp = State.regs[REG_SP]; mask = (insn & 0xff00) >> 8; @@ -2737,6 +2736,14 @@ void OP_DF0000 (insn, extension) State.regs[REG_D0 + 2] = load_mem (sp, 4); sp += 4; } + + /* And make sure to update the stack pointer. */ + State.regs[REG_SP] = sp; + + /* Restore the PC value. */ + State.pc = (State.mem[sp] | (State.mem[sp+1] << 8) + | (State.mem[sp+2] << 16) | (State.mem[sp+3] << 24)); + State.pc -= 3; } /* retf reg_list,imm8 */ @@ -2748,9 +2755,7 @@ void OP_DE0000 (insn, extension) sp = State.regs[REG_SP] + (insn & 0xff); State.regs[REG_SP] = sp; - State.pc = (State.mem[sp] | (State.mem[sp+1] << 8) - | (State.mem[sp+2] << 16) | (State.mem[sp+3] << 24)); - State.pc -= 3; + State.pc = State.regs[REG_MDR] - 3; sp = State.regs[REG_SP]; @@ -2798,6 +2803,9 @@ void OP_DE0000 (insn, extension) State.regs[REG_D0 + 2] = load_mem (sp, 4); sp += 4; } + + /* And make sure to update the stack pointer. */ + State.regs[REG_SP] = sp; } /* rets */