| 
    Ghidra Decompiler Analysis Engine
    
   | 
 
 
 
 
Go to the documentation of this file.
   19 #ifndef __PCODEINJECT__ 
   20 #define __PCODEINJECT__ 
   40   const string &getName(
void)
 const { 
return name; }    
 
   41   int4 getIndex(
void)
 const { 
return index; }       
 
   42   uint4 getSize(
void)
 const { 
return size; }        
 
   70   virtual void saveXml(ostream &s) 
const=0;
 
   98   int4 getParamShift(
void)
 const { 
return paramshift; } 
 
   99   bool isDynamic(
void)
 const { 
return dynamic; }    
 
  101   int4 sizeInput(
void)
 const { 
return inputlist.size(); }   
 
  102   int4 sizeOutput(
void)
 const { 
return output.size(); }     
 
  120   string getName(
void)
 const { 
return name; }       
 
  121   int4 getType(
void)
 const { 
return type; }     
 
  139   vector<uintb> inputList;      
 
  140   vector<uintb> outputList;     
 
  147   uintb 
evaluate(
const vector<uintb> &input);       
 
  188   virtual int4 
allocateInject(
const string &sourceName,
const string &name,int4 type)=0;
 
  200   uintb getUniqueBase(
void)
 const { 
return tempbase; }      
 
  222   virtual int4 
manualCallFixup(
const string &name,
const string &snippetstring)=0;
 
  233   virtual int4 
manualCallOtherFixup(
const string &name,
const string &outname,
const vector<string> &inname,
 
  234                     const string &snippet)=0;
 
  248   virtual const vector<OpBehavior *> &
getBehaviors(
void)=0;
 
  
vector< InjectParameter > output
List of output parameters.
Definition: pcodeinject.hh:93
 
Abstract class for emitting pcode to an application.
Definition: translate.hh:76
 
Architecture * glb
Architecture associated with the injection.
Definition: pcodeinject.hh:58
 
virtual int4 manualCallFixup(const string &name, const string &snippetstring)=0
Manually add a call-fixup payload given a compilable snippet of p-code source.
 
virtual const vector< OpBehavior * > & getBehaviors(void)=0
Get the array of op-code behaviors for initializing and emulator.
 
int4 paramshift
Number of parameters shifted in the original call.
Definition: pcodeinject.hh:91
 
int4 getPayloadId(int4 type, const string &nm) const
Map name and type to the payload id.
Definition: pcodeinject.cc:252
 
void orderParameters(void)
Assign an index to parameters.
Definition: pcodeinject.cc:44
 
map< string, int4 > callFixupMap
Map of registered call-fixup names to injection id.
Definition: pcodeinject.hh:167
 
@ CALLFIXUP_TYPE
Injection that replaces a CALL.
Definition: pcodeinject.hh:81
 
virtual void inject(InjectContext &context, PcodeEmit &emit) const =0
 
string getCallMechanismName(int4 injectid) const
Get the call mechanism name associated with an id.
Definition: pcodeinject.cc:301
 
int4 type
Type of this payload: CALLFIXUP_TYPE, CALLOTHERFIXUP_TYPE, etc.
Definition: pcodeinject.hh:88
 
vector< VarnodeData > output
Storage location for output.
Definition: pcodeinject.hh:63
 
vector< string > callFixupNames
Map from injectid to call-fixup name.
Definition: pcodeinject.hh:171
 
virtual void printTemplate(ostream &s) const =0
Print the p-code ops of the injection to a stream (for debugging)
 
ExecutablePcode(Architecture *g, const string &src, const string &nm)
Constructor.
Definition: pcodeinject.cc:103
 
virtual string getSource(void) const =0
Return a string describing the source of the injection (.cspec, prototype model, etc....
 
A collection of p-code injection payloads.
Definition: pcodeinject.hh:162
 
An input or output parameter to a p-code injection payload.
Definition: pcodeinject.hh:33
 
virtual InjectContext & getCachedContext(void)=0
Retrieve a reusable context object for this library.
 
An XML element. A node in the DOM tree.
Definition: xml.hh:150
 
Address baseaddr
Address of instruction causing inject.
Definition: pcodeinject.hh:59
 
Manager for all the major decompiler subsystems.
Definition: architecture.hh:119
 
Architecture * glb
The Architecture to which the injection payloads apply.
Definition: pcodeinject.hh:164
 
virtual string getSource(void) const
Return a string describing the source of the injection (.cspec, prototype model, etc....
Definition: pcodeinject.hh:146
 
map< string, int4 > callMechFixupMap
Map of registered mechanism names to injection id.
Definition: pcodeinject.hh:169
 
void registerExeScript(const string &scriptName, int4 injectid)
Map a p-code script name to a payload id.
Definition: pcodeinject.cc:235
 
Context needed to emit a p-code injection as a full set of p-code operations.
Definition: pcodeinject.hh:56
 
vector< VarnodeData > inputlist
Storage location for input parameters.
Definition: pcodeinject.hh:62
 
An active container for a set of p-code operations that can be injected into data-flow.
Definition: pcodeinject.hh:78
 
vector< string > callOtherTarget
Map from injectid to callother-fixup target-op name.
Definition: pcodeinject.hh:172
 
void registerCallOtherFixup(const string &fixupName, int4 injectid)
Map a callother-fixup name to a payload id.
Definition: pcodeinject.cc:203
 
Address calladdr
If the instruction being injected is a call, this is the address being called.
Definition: pcodeinject.hh:61
 
int4 restoreXmlInject(const string &src, const string &nm, int4 tp, const Element *el)
Read in and register an injection payload from an XML stream.
Definition: pcodeinject.cc:319
 
@ CALLMECHANISM_TYPE
Injection to patch up data-flow around the caller/callee boundary.
Definition: pcodeinject.hh:83
 
map< string, int4 > callOtherFixupMap
Map of registered callother-fixup names to injection id.
Definition: pcodeinject.hh:168
 
virtual void restoreXml(const Element *el)
Restore this payload from an XML stream.
Definition: pcodeinject.cc:62
 
(Lightweight) emulation interface for executing PcodeOp objects within a syntax tree or for executing...
 
map< string, int4 > scriptMap
Map of registered script names to ExecutablePcode id.
Definition: pcodeinject.hh:170
 
virtual void saveXml(ostream &s) const =0
Save this context to an XML stream as a <context> tag.
 
virtual int4 manualCallOtherFixup(const string &name, const string &outname, const vector< string > &inname, const string &snippet)=0
Manually add a callother-fixup payload given a compilable snippet of p-code source.
 
Emulate a snippet of PcodeOps out of a functional context.
Definition: emulateutil.hh:111
 
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
 
void registerCallMechanism(const string &fixupName, int4 injectid)
Map a call mechanism name to a payload id.
Definition: pcodeinject.cc:219
 
@ CALLOTHERFIXUP_TYPE
Injection that replaces a user-defined p-code op, CALLOTHER.
Definition: pcodeinject.hh:82
 
vector< InjectPayload * > injection
Registered injections.
Definition: pcodeinject.hh:166
 
uintb tempbase
Offset within unique space for allocating temporaries within a payload.
Definition: pcodeinject.hh:165
 
bool dynamic
True if the injection is generated dynamically.
Definition: pcodeinject.hh:89
 
@ EXECUTABLEPCODE_TYPE
Injection running as a stand-alone p-code script.
Definition: pcodeinject.hh:84
 
Address nextaddr
Address of following instruction.
Definition: pcodeinject.hh:60
 
vector< InjectParameter > inputlist
List of input parameters to this payload.
Definition: pcodeinject.hh:92
 
string getCallFixupName(int4 injectid) const
Get the call-fixup name associated with an id.
Definition: pcodeinject.cc:281
 
virtual int4 allocateInject(const string &sourceName, const string &name, int4 type)=0
Allocate a new InjectPayload object.
 
vector< string > scriptNames
Map from injectid to script name.
Definition: pcodeinject.hh:174
 
vector< string > callMechTarget
Map from injectid to call-mech name.
Definition: pcodeinject.hh:173
 
static void readParameter(const Element *el, string &name, uint4 &size)
Read in an <input> or <output> XML tag describing an injection parameter.
Definition: pcodeinject.cc:24
 
virtual void restoreDebug(const Element *el)
A method for reading in p-code generated externally for use in debugging.
Definition: pcodeinject.hh:214
 
string getCallOtherTarget(int4 injectid) const
Get the callother-fixup name associated with an id.
Definition: pcodeinject.cc:291
 
virtual ~PcodeInjectLibrary(void)
Destructor.
Definition: pcodeinject.cc:175
 
void registerCallFixup(const string &fixupName, int4 injectid)
Map a call-fixup name to a payload id.
Definition: pcodeinject.cc:187
 
uintb evaluate(const vector< uintb > &input)
Evaluate the snippet on the given inputs.
Definition: pcodeinject.cc:159
 
string name
Formal name of the payload.
Definition: pcodeinject.hh:87
 
A snippet of p-code that can be executed outside of normal analysis.
Definition: pcodeinject.hh:134
 
bool incidentalCopy
True if injected COPYs are considered incidental.
Definition: pcodeinject.hh:90
 
virtual void registerInject(int4 injectid)=0
Finalize a payload within the library, once the payload is initialized.