decompiler
1.0.0
|
Abstract class for emitting pcode to an application. More...
#include <translate.hh>
Public Types | |
enum | { unimpl_tag = 0x20, inst_tag = 0x21, op_tag = 0x22, void_tag = 0x23, spaceid_tag = 0x24, addrsz_tag = 0x25, end_tag = 0x60 } |
Public Member Functions | |
virtual | ~PcodeEmit (void) |
Virtual destructor. | |
virtual void | dump (const Address &addr, OpCode opc, VarnodeData *outvar, VarnodeData *vars, int4 isize)=0 |
The main pcode emit method. More... | |
void | restoreXmlOp (const Element *el, const AddrSpaceManager *trans) |
Emit pcode directly from an XML tag. More... | |
const uint1 * | restorePackedOp (const Address &addr, const uint1 *ptr, const AddrSpaceManager *trans) |
Emit pcode directly from a packed byte stream. More... | |
Static Public Member Functions | |
static const uint1 * | unpackOffset (const uint1 *ptr, uintb &off) |
Helper function for unpacking an offset from a pcode byte stream. More... | |
static const uint1 * | unpackVarnodeData (const uint1 *ptr, VarnodeData &v, const AddrSpaceManager *trans) |
Helper function for unpacking a varnode from a pcode byte stream. More... | |
Abstract class for emitting pcode to an application.
Translation engines pass back the generated pcode for an instruction to the application using this class.
|
pure virtual |
The main pcode emit method.
A single pcode instruction is returned to the application via this method. Particular applications override it to tailor how the operations are used.
addr | is the Address of the machine instruction |
opc | is the opcode of the particular pcode instruction |
outvar | if not null is a pointer to data about the output varnode |
vars | is a pointer to an array of VarnodeData for each input varnode |
isize | is the number of input varnodes |
Implemented in PcodeEmitFd, and PcodeEmitCache.
Referenced by restorePackedOp(), and restoreXmlOp().
const uint1 * PcodeEmit::restorePackedOp | ( | const Address & | addr, |
const uint1 * | ptr, | ||
const AddrSpaceManager * | manage | ||
) |
Emit pcode directly from a packed byte stream.
A convenience method for passing around pcode operations via a special packed format. A single pcode operation is parsed from a byte stream and returned to the application via the PcodeEmit::dump method.
addr | is the address of the instruction that generated this pcode |
ptr | is a pointer into a packed byte stream |
manage | is the AddrSpace manager object of the associated processor |
References dump(), and unpackVarnodeData().
Referenced by GhidraTranslate::oneInstruction().
void PcodeEmit::restoreXmlOp | ( | const Element * | el, |
const AddrSpaceManager * | manage | ||
) |
Emit pcode directly from an XML tag.
A convenience method for passing around pcode operations via XML. A single pcode operation is parsed from an XML tag and returned to the application via the PcodeEmit::dump method.
el | is the pcode operation XML tag |
manage | is the AddrSpace manager object of the associated processor |
References dump(), AddrSpaceManager::getConstantSpace(), AddrSpaceManager::getSpaceByName(), VarnodeData::offset, VarnodeData::restoreXml(), Address::restoreXml(), VarnodeData::size, and VarnodeData::space.
|
static |
Helper function for unpacking an offset from a pcode byte stream.
A Helper function for PcodeEmit::restorePackedOp that reads an unsigned offset from a packed stream
ptr | is a pointer into a packed byte stream |
off | is where the offset read from the stream is stored |
Referenced by GhidraTranslate::oneInstruction(), and unpackVarnodeData().
|
static |
Helper function for unpacking a varnode from a pcode byte stream.
A Helper function for PcodeEmit::restorePackedOp that reads a varnode from a packed stream
ptr | is a pointer into a packed byte stream |
v | is the VarnodeData object being filled in by the stream |
manage | is the AddrSpace manager object of the associated processor |
References AddrSpaceManager::getConstantSpace(), AddrSpaceManager::getSpace(), VarnodeData::offset, VarnodeData::size, VarnodeData::space, and unpackOffset().
Referenced by restorePackedOp().