decompiler  1.0.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
PcodeEmit Class Referenceabstract

Abstract class for emitting pcode to an application. More...

#include <translate.hh>

Inheritance diagram for PcodeEmit:
PcodeEmitCache PcodeEmitFd

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...
 

Detailed Description

Abstract class for emitting pcode to an application.

Translation engines pass back the generated pcode for an instruction to the application using this class.

Member Function Documentation

virtual void PcodeEmit::dump ( const Address addr,
OpCode  opc,
VarnodeData outvar,
VarnodeData vars,
int4  isize 
)
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.

Parameters
addris the Address of the machine instruction
opcis the opcode of the particular pcode instruction
outvarif not null is a pointer to data about the output varnode
varsis a pointer to an array of VarnodeData for each input varnode
isizeis the number of input varnodes

Implemented in PcodeEmitFd, and PcodeEmitCache.

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.

Parameters
addris the address of the instruction that generated this pcode
ptris a pointer into a packed byte stream
manageis the AddrSpace manager object of the associated processor
Returns
a pointer to the next unconsumed byte of the stream

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.

Parameters
elis the pcode operation XML tag
manageis the AddrSpace manager object of the associated processor

References Element::getAttributeValue(), Element::getChildren(), AddrSpaceManager::getConstantSpace(), AddrSpaceManager::getSpaceByName(), VarnodeData::offset, VarnodeData::restoreXml(), Address::restoreXml(), VarnodeData::size, and VarnodeData::space.

const uint1 * PcodeEmit::unpackOffset ( const uint1 *  ptr,
uintb &  off 
)
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

Parameters
ptris a pointer into a packed byte stream
offis where the offset read from the stream is stored
Returns
a pointer to the next unconsumed byte of the stream

Referenced by GhidraTranslate::oneInstruction().

const uint1 * PcodeEmit::unpackVarnodeData ( const uint1 *  ptr,
VarnodeData v,
const AddrSpaceManager manage 
)
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

Parameters
ptris a pointer into a packed byte stream
vis the VarnodeData object being filled in by the stream
manageis the AddrSpace manager object of the associated processor
Returns
a pointer to the next unconsumed byte of the stream

References AddrSpaceManager::getConstantSpace(), AddrSpaceManager::getSpace(), VarnodeData::offset, VarnodeData::size, and VarnodeData::space.


The documentation for this class was generated from the following files: