GP-3716: Fix context flow in Emulator's decoder

This commit is contained in:
Dan 2023-08-11 12:10:48 -04:00
parent 5888ac64e1
commit 7b97d1899c
5 changed files with 160 additions and 65 deletions

View file

@ -444,6 +444,12 @@ public class DefaultPcodeThread<T> implements PcodeThread<T> {
}
}
@Override
public void stepPatch(String sleigh) {
PcodeProgram prog = getMachine().compileSleigh("patch", sleigh + ";");
executor.execute(prog, library);
}
/**
* Start execution of the instruction or inject at the program counter
*/
@ -499,10 +505,11 @@ public class DefaultPcodeThread<T> implements PcodeThread<T> {
overrideCounter(counter.addWrap(decoder.getLastLengthWithDelays()));
}
if (contextreg != Register.NO_CONTEXT) {
RegisterValue flowCtx =
defaultContext.getFlowValue(instruction.getRegisterValue(contextreg));
RegisterValue commitCtx = getContextAfterCommits();
overrideContext(flowCtx.combineValues(commitCtx));
RegisterValue ctx = new RegisterValue(contextreg, BigInteger.ZERO)
.combineValues(defaultContext.getDefaultValue(contextreg, counter))
.combineValues(defaultContext.getFlowValue(context))
.combineValues(getContextAfterCommits());
overrideContext(ctx);
}
postExecuteInstruction();
frame = null;

View file

@ -196,6 +196,13 @@ public interface PcodeThread<T> {
*/
void skipPcodeOp();
/**
* Apply a patch to the emulator
*
* @param sleigh a line of sleigh semantic source to execute (excluding the final semicolon)
*/
void stepPatch(String sleigh);
/**
* Get the current frame, if present
*