Package ghidra.program.model.lang
Class InjectPayloadSleigh
- java.lang.Object
-
- ghidra.program.model.lang.InjectPayloadSleigh
-
- All Implemented Interfaces:
InjectPayload
- Direct Known Subclasses:
InjectPayloadCallfixup
,InjectPayloadCallother
public class InjectPayloadSleigh extends java.lang.Object implements InjectPayload
InjectPayloadSleigh
defines an InjectPayload of p-code which is defined via a String passed to the sleigh compiler
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ghidra.program.model.lang.InjectPayload
InjectPayload.InjectParameter
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
name
protected java.lang.String
source
protected int
type
-
Fields inherited from interface ghidra.program.model.lang.InjectPayload
CALLFIXUP_TYPE, CALLMECHANISM_TYPE, CALLOTHERFIXUP_TYPE, EXECUTABLEPCODE_TYPE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
InjectPayloadSleigh(java.lang.String sourceName)
Constructor for use where restoreXml is overridden and provides name and typeInjectPayloadSleigh(java.lang.String nm, int tp, java.lang.String sourceName)
Provide basic form, restoreXml fills in the rest
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InjectPayloadSleigh
clone()
protected void
copy(InjectPayloadSleigh op2)
InjectPayload.InjectParameter[]
getInput()
java.lang.String
getName()
InjectPayload.InjectParameter[]
getOutput()
int
getParamShift()
PcodeOp[]
getPcode(Program program, InjectContext con)
A convenience function wrapping the inject method, to produce the final set of PcodeOp objects in an arrayjava.lang.String
getSource()
int
getType()
void
inject(InjectContext context, PcodeEmit emit)
Given a context, send the p-code payload to the emitterboolean
isFallThru()
protected void
orderParameters()
All input and output parameters must have a unique index.void
restoreXml(XmlPullParser parser)
protected void
setInputParameters(java.util.ArrayList<InjectPayload.InjectParameter> in)
protected void
setOutputParameters(java.util.ArrayList<InjectPayload.InjectParameter> out)
void
setTemplate(ConstructTpl ctl)
-
-
-
Constructor Detail
-
InjectPayloadSleigh
protected InjectPayloadSleigh(java.lang.String sourceName)
Constructor for use where restoreXml is overridden and provides name and type- Parameters:
sourceName
-
-
InjectPayloadSleigh
public InjectPayloadSleigh(java.lang.String nm, int tp, java.lang.String sourceName)
Provide basic form, restoreXml fills in the rest- Parameters:
nm
- must provide formal nametp
- must provide typesourceName
-
-
-
Method Detail
-
clone
public InjectPayloadSleigh clone()
- Overrides:
clone
in classjava.lang.Object
-
copy
protected void copy(InjectPayloadSleigh op2)
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceInjectPayload
- Returns:
- formal name for this injection
-
getType
public int getType()
- Specified by:
getType
in interfaceInjectPayload
- Returns:
- the type of this injection: CALLFIXUP_TYPE, CALLMECHANISM_TYPE, etc.
-
getSource
public java.lang.String getSource()
- Specified by:
getSource
in interfaceInjectPayload
- Returns:
- a String describing the source of this payload
-
getParamShift
public int getParamShift()
- Specified by:
getParamShift
in interfaceInjectPayload
- Returns:
- number of parameters from the original call which should be truncated
-
setInputParameters
protected void setInputParameters(java.util.ArrayList<InjectPayload.InjectParameter> in)
-
setOutputParameters
protected void setOutputParameters(java.util.ArrayList<InjectPayload.InjectParameter> out)
-
getInput
public InjectPayload.InjectParameter[] getInput()
- Specified by:
getInput
in interfaceInjectPayload
- Returns:
- array of any input parameters for this inject
-
getOutput
public InjectPayload.InjectParameter[] getOutput()
- Specified by:
getOutput
in interfaceInjectPayload
- Returns:
- array of any output parameters for this inject
-
inject
public void inject(InjectContext context, PcodeEmit emit)
Description copied from interface:InjectPayload
Given a context, send the p-code payload to the emitter- Specified by:
inject
in interfaceInjectPayload
- Parameters:
context
- is the context for injectionemit
- is the object accumulating the final p-code
-
getPcode
public PcodeOp[] getPcode(Program program, InjectContext con)
Description copied from interface:InjectPayload
A convenience function wrapping the inject method, to produce the final set of PcodeOp objects in an array- Specified by:
getPcode
in interfaceInjectPayload
- Parameters:
program
- is the Program for which injection is happeningcon
- is the context for injection- Returns:
- the array of PcodeOps
-
isFallThru
public boolean isFallThru()
- Specified by:
isFallThru
in interfaceInjectPayload
- Returns:
- true if the injected p-code falls thru
-
orderParameters
protected void orderParameters()
All input and output parameters must have a unique index. Order them so that inputs come first, then outputs
-
restoreXml
public void restoreXml(XmlPullParser parser)
-
setTemplate
public void setTemplate(ConstructTpl ctl)
-
-