decompiler
1.0.0
|
A container for disassembly context used by the SLEIGH engine. More...
#include <sleigh.hh>
Public Member Functions | |
DisassemblyCache (Translate *trans, ContextCache *ccache, AddrSpace *cspace, int4 cachesize, int4 windowsize) | |
Constructor. More... | |
~DisassemblyCache (void) | |
Destructor. | |
ParserContext * | getParserContext (const Address &addr) |
Get the parser for a particular Address. More... | |
Private Member Functions | |
void | initialize (int4 min, int4 hashsize) |
Initialize the hash-table of ParserContexts. More... | |
void | free (void) |
Free the hash-table of ParserContexts. | |
Private Attributes | |
Translate * | translate |
The Translate object that owns this cache. | |
ContextCache * | contextcache |
Cached values from the ContextDatabase. | |
AddrSpace * | constspace |
The constant address space. | |
int4 | minimumreuse |
Can call getParserContext this many times, before a ParserContext is reused. | |
uint4 | mask |
Size of the hashtable in form 2^n-1. | |
ParserContext ** | list |
(circular) array of currently cached ParserContext objects | |
int4 | nextfree |
Current end/beginning of circular list. | |
ParserContext ** | hashtable |
Hashtable for looking up ParserContext via Address. | |
A container for disassembly context used by the SLEIGH engine.
This acts as a factor for the ParserContext objects which are used to disassemble a single instruction. These all share a ContextCache which is a front end for accessing the ContextDatabase and resolving context variables from the SLEIGH spec. ParserContext objects are stored in a hash-table keyed by the address of the instruction.
ghidra::DisassemblyCache::DisassemblyCache | ( | Translate * | trans, |
ContextCache * | ccache, | ||
AddrSpace * | cspace, | ||
int4 | cachesize, | ||
int4 | windowsize | ||
) |
Constructor.
trans | is the Translate object instantiating this cache (for inst_next2 callbacks) |
ccache | is the ContextCache front-end shared across all the parser contexts |
cspace | is the constant address space used for minting constant Varnodes |
cachesize | is the number of distinct ParserContext objects in this cache |
windowsize | is the size of the ParserContext hash-table |
ParserContext * ghidra::DisassemblyCache::getParserContext | ( | const Address & | addr | ) |
Get the parser for a particular Address.
Return a (possibly cached) ParserContext that is associated with addr If n different calls to this interface are made with n different Addresses, if
then the cacher guarantees that you get all different ParserContext objects
addr | is the Address to disassemble at |
References ghidra::Address::getOffset().
Referenced by ghidra::Sleigh::obtainContext(), and ghidra::SleighBuilder::SleighBuilder().
|
private |
Initialize the hash-table of ParserContexts.
min | is the minimum number of allocations before a reuse is expected |
hashsize | is the number of elements in the hash-table |