mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-3716: Fix context flow in Emulator's decoder
This commit is contained in:
parent
5888ac64e1
commit
7b97d1899c
5 changed files with 160 additions and 65 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue