decompiler
1.0.0
|
Public Member Functions | |
Sleigh (LoadImage *ld, ContextDatabase *c_db) | |
void | reset (LoadImage *ld, ContextDatabase *c_db) |
virtual void | initialize (DocumentStorage &store) |
Initialize the translator given XML configuration documents. More... | |
virtual void | registerContext (const string &name, int4 sbit, int4 ebit) |
Add a new context variable to the model for this processor. More... | |
virtual void | setContextDefault (const string &nm, uintm val) |
Set the default value for a particular context variable. More... | |
virtual void | allowContextSet (bool val) const |
Toggle whether disassembly is allowed to affect context. More... | |
virtual int4 | instructionLength (const Address &baseaddr) const |
Get the length of a machine instruction. More... | |
virtual int4 | oneInstruction (PcodeEmit &emit, const Address &baseaddr) const |
Transform a single machine instruction into pcode. More... | |
virtual int4 | printAssembly (AssemblyEmit &emit, const Address &baseaddr) const |
Disassemble a single machine instruction. More... | |
Public Member Functions inherited from SleighBase | |
SleighBase (void) | |
Construct an uninitialized translator. | |
bool | isInitialized (void) const |
Return true if this is initialized. | |
virtual | ~SleighBase (void) |
Destructor. | |
virtual void | addRegister (const string &nm, AddrSpace *base, uintb offset, int4 size) |
Add a named register to the model for this processor. More... | |
virtual const VarnodeData & | getRegister (const string &nm) const |
Get a register as VarnodeData given its name. More... | |
virtual string | getRegisterName (AddrSpace *base, uintb off, int4 size) const |
Get the name of a register given its location. More... | |
virtual void | getAllRegisters (map< VarnodeData, string > ®list) const |
Get a list of all register names and the corresponding location. More... | |
virtual void | getUserOpNames (vector< string > &res) const |
Get a list of all user-defined pcode ops. More... | |
SleighSymbol * | findSymbol (const string &nm) const |
Find a specific SLEIGH symbol by name in the current scope. | |
SleighSymbol * | findSymbol (uintm id) const |
Find a specific SLEIGH symbol by id. | |
SleighSymbol * | findGlobalSymbol (const string &nm) const |
Find a specific global SLEIGH symbol by name. | |
void | saveXml (ostream &s) const |
Write out the SLEIGH specification as an XML <sleigh> tag. More... | |
Public Member Functions inherited from Translate | |
Translate (void) | |
Constructor for the translator. More... | |
void | setDefaultFloatFormats (void) |
If no explicit float formats, set up default formats. More... | |
bool | isBigEndian (void) const |
Is the processor big endian? More... | |
const FloatFormat * | getFloatFormat (int4 size) const |
Get format for a particular floating point encoding. More... | |
int4 | getAlignment (void) const |
Get the instruction alignment for the processor. More... | |
uintm | getUniqueBase (void) const |
Get the base offset for new temporary registers. More... | |
Public Member Functions inherited from AddrSpaceManager | |
AddrSpaceManager (void) | |
Construct an empty address space manager. More... | |
virtual | ~AddrSpaceManager (void) |
Destroy the manager. More... | |
char | assignShortcut (spacetype tp) const |
Select a shortcut character for a new space. More... | |
int4 | getDefaultSize (void) const |
Get size of addresses for the default space. More... | |
AddrSpace * | getSpaceByName (const string &nm) const |
Get address space by name. More... | |
AddrSpace * | getSpaceByShortcut (char sc) const |
Get address space from its shortcut. More... | |
AddrSpace * | getIopSpace (void) const |
Get the internal pcode op space. More... | |
AddrSpace * | getFspecSpace (void) const |
Get the internal callspec space. More... | |
AddrSpace * | getJoinSpace (void) const |
Get the joining space. More... | |
AddrSpace * | getStackSpace (void) const |
Get the stack space for this processor. More... | |
AddrSpace * | getUniqueSpace (void) const |
Get the temporary register space for this processor. More... | |
AddrSpace * | getDefaultSpace (void) const |
Get the default address space of this processor. More... | |
AddrSpace * | getConstantSpace (void) const |
Get the constant space. More... | |
Address | getConstant (uintb val) const |
Get a constant encoded as an Address. More... | |
Address | createConstFromSpace (AddrSpace *spc) const |
Create a constant address encoding an address space. More... | |
Address | resolveConstant (AddrSpace *spc, uintb val, int4 sz, const Address &point) const |
Resolve native constant to address. | |
int4 | numSpaces (void) const |
Get the number of address spaces for this processor. More... | |
AddrSpace * | getSpace (int4 i) const |
Get an address space via its index. More... | |
AddrSpace * | getNextSpaceInOrder (AddrSpace *spc) const |
Get the next contiguous address space. More... | |
JoinRecord * | findAddJoin (const vector< VarnodeData > &pieces, uint4 logicalsize) |
Get (or create) JoinRecord for pieces. More... | |
JoinRecord * | findJoin (uintb offset) const |
Find JoinRecord for offset in the join space. More... | |
void | setDeadcodeDelay (int4 spcnum, int4 delaydelta) |
Set the deadcodedelay for a specific space. More... | |
void | truncateSpace (const TruncationTag &tag) |
Mark a space as truncated from its original size. More... | |
Address | constructFloatExtensionAddress (const Address &realaddr, int4 realsize, int4 logicalsize) |
Build a logically lower precision storage location for a bigger floating point register. More... | |
Address | constructJoinAddress (const Translate *translate, const Address &hiaddr, int4 hisz, const Address &loaddr, int4 losz) |
Build a logical whole from register pairs. More... | |
Protected Member Functions | |
ParserContext * | obtainContext (const Address &addr, int4 state) const |
void | resolve (ParserContext &pos) const |
void | resolveHandles (ParserContext &pos) const |
Protected Member Functions inherited from SleighBase | |
void | buildXrefs (void) |
Build register map. Collect user-ops and context-fields. More... | |
void | reregisterContext (void) |
Reregister context fields for a new executable. More... | |
void | restoreXml (const Element *el) |
Read a SLEIGH specification from XML. More... | |
Protected Member Functions inherited from Translate | |
void | setBigEndian (bool val) |
Set general endianness to big if val is true. More... | |
void | setUniqueBase (uintm val) |
Set the base offset for new temporary registers. More... | |
Protected Member Functions inherited from AddrSpaceManager | |
AddrSpace * | restoreXmlSpace (const Element *el, const Translate *trans) |
Add a space to the model based an on XML tag. More... | |
void | restoreXmlSpaces (const Element *el, const Translate *trans) |
Restore address spaces in the model from an XML tag. More... | |
void | setDefaultSpace (int4 index) |
Set the default address space. More... | |
void | setReverseJustified (AddrSpace *spc) |
Set reverse justified property on this space. More... | |
void | insertSpace (AddrSpace *spc) |
Add a new address space to the model. More... | |
void | copySpaces (const AddrSpaceManager *op2) |
Copy spaces from another manager. More... | |
void | addSpacebasePointer (SpacebaseSpace *basespace, const VarnodeData &ptrdata, int4 truncSize, bool stackGrowth) |
Set the base register of a spacebase space. More... | |
void | insertResolver (AddrSpace *spc, AddressResolver *rsolv) |
Override the base resolver for a space. More... | |
Private Member Functions | |
void | clearForDelete (void) |
Private Attributes | |
LoadImage * | loader |
ContextDatabase * | context_db |
ContextCache * | cache |
DisassemblyCache * | discache |
PcodeCacher | pcode_cache |
Additional Inherited Members | |
Protected Attributes inherited from SleighBase | |
SubtableSymbol * | root |
The root SLEIGH decoding symbol. | |
SymbolTable | symtab |
The SLEIGH symbol table. | |
uint4 | maxdelayslotbytes |
Maximum number of bytes in a delay-slot directive. | |
uint4 | unique_allocatemask |
Bits that are guaranteed to be zero in the unique allocation scheme. | |
uint4 | numSections |
Number of named sections. | |
Protected Attributes inherited from Translate | |
int4 | alignment |
Byte modulo on which instructions are aligned. | |
vector< FloatFormat > | floatformats |
Floating point formats utilized by the processor. | |
|
virtual |
Toggle whether disassembly is allowed to affect context.
By default the disassembly/pcode translation engine can change the global context, thereby affecting later disassembly. Context may be getting determined by something other than control flow in, the disassembly, in which case this function can turn off changes made by the disassembly
val | is true to allow context changes, false prevents changes |
Reimplemented from Translate.
References ContextCache::allowSet().
|
virtual |
Initialize the translator given XML configuration documents.
A translator gets initialized once, possibly using XML documents to configure it.
store | is a set of configuration documents |
Implements Translate.
References AddrSpaceManager::getConstantSpace(), SleighBase::isInitialized(), SleighBase::maxdelayslotbytes, SleighBase::reregisterContext(), SleighBase::restoreXml(), and SleighBase::unique_allocatemask.
|
virtual |
Transform a single machine instruction into pcode.
This is the main interface to the pcode translation engine. The dump method in the emit object is invoked exactly once for each pcode operation in the translation for the machine instruction at the given address. This routine can throw either
emit | is the tailored pcode emitting object |
baseaddr | is the Address of the machine instruction |
Implements Translate.
References Translate::alignment, LowlevelError::explain, AddrSpaceManager::getConstantSpace(), Address::getOffset(), AddrSpaceManager::getUniqueSpace(), UnimplError::instruction_length, and SleighBase::unique_allocatemask.
|
virtual |
Disassemble a single machine instruction.
This is the main interface to the disassembler for the processor. It disassembles a single instruction and returns the result to the application via the dump method in the emit object.
emit | is the disassembly emitting object |
baseaddr | is the address of the machine instruction to disassemble |
Implements Translate.
References AssemblyEmit::dump().
|
virtual |
Add a new context variable to the model for this processor.
Add the name of a context register used by the processor and how that register is packed into the context state. This information is used by a ContextDatabase to associate names with context information and to pack context into a single state variable for the translation engine.
name | is the name of the new context variable |
sbit | is the first bit of the variable in the packed state |
ebit | is the last bit of the variable in the packed state |
Reimplemented from Translate.
References ContextDatabase::registerVariable().
|
virtual |
Set the default value for a particular context variable.
Set the value to be returned for a context variable when there are no explicit address ranges specifying a value for the variable.
name | is the name of the context variable |
val | is the value to be considered default |
Reimplemented from Translate.
References ContextDatabase::setVariableDefault().