decompiler  1.0.0
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ghidra::LoadGuard Class Reference

Description of a LOAD operation that needs to be guarded. More...

#include <heritage.hh>

Public Member Functions

PcodeOpgetOp (void) const
 Get the PcodeOp being guarded.
 
uintb getMinimum (void) const
 Get minimum offset of the guarded range.
 
uintb getMaximum (void) const
 Get maximum offset of the guarded range.
 
int4 getStep (void) const
 Get the calculated step associated with the range (or 0)
 
bool isGuarded (const Address &addr) const
 Does this guard apply to the given address. More...
 
bool isRangeLocked (void) const
 Return true if the range is fully determined.
 
bool isValid (OpCode opc) const
 Return true if the record still describes an active LOAD.
 

Private Member Functions

void establishRange (const ValueSetRead &valueSet)
 Convert partial value set analysis into guard range. More...
 
void finalizeRange (const ValueSetRead &valueSet)
 Convert value set analysis to final guard range.
 
void set (PcodeOp *o, AddrSpace *s, uintb off)
 Set a new unanalyzed LOAD guard that initially guards everything. More...
 

Private Attributes

PcodeOpop
 The LOAD op.
 
AddrSpacespc
 The stack space being loaded from.
 
uintb pointerBase
 Base offset of the pointer.
 
uintb minimumOffset
 Minimum offset of the LOAD.
 
uintb maximumOffset
 Maximum offset of the LOAD.
 
int4 step
 Step of any access into this range (0=unknown)
 
int4 analysisState
 0=unanalyzed, 1=analyzed(partial result), 2=analyzed(full result)
 

Friends

class Heritage
 

Detailed Description

Description of a LOAD operation that needs to be guarded.

Heritage maintains a list of CPUI_LOAD ops that reference the stack dynamically. These can potentially alias stack Varnodes, so we maintain what (possibly limited) information we known about the range of stack addresses that can be referenced.

Member Function Documentation

◆ establishRange()

void ghidra::LoadGuard::establishRange ( const ValueSetRead valueSet)
private

Convert partial value set analysis into guard range.

Make some determination of the range of possible values for a LOAD based an partial value set analysis. This can sometimes get

  • minimumOffset - otherwise the original constant pulled with the LOAD is used
  • step - the partial analysis shows step and direction
  • maximumOffset - in rare cases

isAnalyzed is set to true, if full range analysis is not needed

Parameters
valueSetis the calculated value set as seen by the LOAD operation

References ghidra::ValueSetRead::getRange(), ghidra::CircleRange::getSize(), ghidra::ValueSetRead::isLeftStable(), and ghidra::ValueSetRead::isRightStable().

Referenced by ghidra::Heritage::analyzeNewLoadGuards().

◆ isGuarded()

bool ghidra::LoadGuard::isGuarded ( const Address addr) const

Does this guard apply to the given address.

Check if the address falls within the range defined by this

Parameters
addris the given address
Returns
true if the address is contained

References ghidra::Address::getOffset(), and ghidra::Address::getSpace().

Referenced by ghidra::RuleIndirectCollapse::applyOp().

◆ set()

void ghidra::LoadGuard::set ( PcodeOp o,
AddrSpace s,
uintb  off 
)
inlineprivate

Set a new unanalyzed LOAD guard that initially guards everything.

Parameters
ois the LOAD op
sis the (stack) space it is loading from
offis the base offset that is indexed from

References ghidra::AddrSpace::getHighest().


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