SCP: Assure consistent PC state while preparing RUN command execution

Some simulator reset routines may reference the RUN target PC value
while others may change the PC, so we set the PC value both before
and after any reset is performed.

As reported in #1020
This commit is contained in:
Mark Pizzolato 2021-03-13 12:38:39 -08:00
parent 6323acd5ea
commit e51d918adb

3
scp.c
View file

@ -8642,6 +8642,7 @@ if ((flag == RU_RUN) || (flag == RU_GO)) { /* run or go */
new_pc = TRUE; new_pc = TRUE;
} }
} }
put_rval_pcchk (sim_PC, 0, new_pcv, new_pc); /* Save in PC in case reset references PC */
if ((flag == RU_RUN) && /* run? */ if ((flag == RU_RUN) && /* run? */
((r = sim_run_boot_prep (flag)) != SCPE_OK)) { /* reset sim */ ((r = sim_run_boot_prep (flag)) != SCPE_OK)) { /* reset sim */
put_rval_pcchk (sim_PC, 0, orig_pcv, FALSE); /* restore original PC */ put_rval_pcchk (sim_PC, 0, orig_pcv, FALSE); /* restore original PC */
@ -8674,7 +8675,7 @@ if ((flag == RU_RUN) || (flag == RU_GO)) { /* run or go */
} }
sim_switches = saved_switches; sim_switches = saved_switches;
} }
put_rval_pcchk (sim_PC, 0, new_pcv, new_pc); /* Save in PC */ put_rval_pcchk (sim_PC, 0, new_pcv, new_pc); /* Save in PC again in case reset changed it */
} }
else if ((flag == RU_STEP) || else if ((flag == RU_STEP) ||