|
Ghidra 11.4.2
Ghidra internal decompiler documentation.
|
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. | |
| ~DisassemblyCache (void) | |
| Destructor. | |
| ParserContext * | getParserContext (const Address &addr) |
| Get the parser for a particular Address. | |
Private Member Functions | |
| void | initialize (int4 min, int4 hashsize) |
| Initialize the hash-table of ParserContexts. | |
| 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 | ||
| ) |
| 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 |
References constspace, contextcache, initialize(), and translate.
| 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(), hashtable, list, mask, minimumreuse, and nextfree.
Referenced by ghidra::Sleigh::obtainContext().
|
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 |
References constspace, contextcache, hashtable, list, mask, minimumreuse, nextfree, and translate.
Referenced by DisassemblyCache().