Class SleighParserContext
- java.lang.Object
-
- ghidra.app.plugin.processors.sleigh.SleighParserContext
-
- All Implemented Interfaces:
ParserContext
public class SleighParserContext extends java.lang.Object implements ParserContext
All the recovered context for a single instruction The main data structure is the tree of constructors and operands
-
-
Constructor Summary
Constructors Constructor Description SleighParserContext(Address aAddr, Address nAddr, Address rAddr, Address dAddr)
Constructor for building precompiled templatesSleighParserContext(MemBuffer memBuf, SleighInstructionPrototype prototype, ProcessorContextView processorContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommit(ConstructState point, TripleSymbol sym, int num, int mask)
void
applyCommits(ProcessorContext ctx)
Address
getAddr()
AddressSpace
getConstSpace()
int
getContextBits(int startbit, int bitsize)
Get bits from context into an intint[]
getContextBytes()
Get full set of context bytes.int
getContextBytes(int bytestart, int bytesize)
Get bytes from context into an intAddressSpace
getCurSpace()
FixedHandle
getFixedHandle(ConstructState constructState)
Address
getFlowDestAddr()
Address
getFlowRefAddr()
int
getInstructionBits(int offset, int startbit, int size)
Get bits from the instruction stream into an int (packed in big endian format).int
getInstructionBytes(int offset, int bytestart, int size)
Get bytes from the instruction stream into an int (packed in big endian format).MemBuffer
getMemBuffer()
Address
getNaddr()
SleighInstructionPrototype
getPrototype()
boolean
isValid(MemBuffer buf)
void
setContextWord(int i, int val, int mask)
void
setDelaySlotLength(int delayByteLength)
-
-
-
Constructor Detail
-
SleighParserContext
public SleighParserContext(MemBuffer memBuf, SleighInstructionPrototype prototype, ProcessorContextView processorContext)
-
SleighParserContext
public SleighParserContext(Address aAddr, Address nAddr, Address rAddr, Address dAddr)
Constructor for building precompiled templates- Parameters:
aAddr
- = address to which 'inst_start' resolvesnAddr
- = address to which 'inst_next' resolvesrAddr
- = special address associated with original calldAddr
- = destination address of original call being replaced
-
-
Method Detail
-
getPrototype
public SleighInstructionPrototype getPrototype()
- Specified by:
getPrototype
in interfaceParserContext
-
addCommit
public void addCommit(ConstructState point, TripleSymbol sym, int num, int mask)
-
applyCommits
public void applyCommits(ProcessorContext ctx) throws MemoryAccessException
- Throws:
MemoryAccessException
-
getFixedHandle
public FixedHandle getFixedHandle(ConstructState constructState)
-
getAddr
public Address getAddr()
-
getNaddr
public Address getNaddr()
-
setDelaySlotLength
public void setDelaySlotLength(int delayByteLength)
-
getCurSpace
public AddressSpace getCurSpace()
-
getConstSpace
public AddressSpace getConstSpace()
-
getMemBuffer
public MemBuffer getMemBuffer()
-
getInstructionBytes
public int getInstructionBytes(int offset, int bytestart, int size) throws MemoryAccessException
Get bytes from the instruction stream into an int (packed in big endian format). Uninitialized or undefined memory will return zero byte values.- Parameters:
offset
- offset relative start of this contextbytestart
- pattern byte offset relative to specified context offsetsize
-- Returns:
- requested byte-range value
- Throws:
MemoryAccessException
- if no bytes are available at first byte when (offset+bytestart==0).
-
getInstructionBits
public int getInstructionBits(int offset, int startbit, int size) throws MemoryAccessException
Get bits from the instruction stream into an int (packed in big endian format). Uninitialized or undefined memory will return zero bit values.- Parameters:
offset
- offset relative start of this contextstartbit
-size
-- Returns:
- requested bit-range value
- Throws:
MemoryAccessException
- if no bytes are available at first byte when (offset+bytestart/8==0).
-
getContextBytes
public int getContextBytes(int bytestart, int bytesize)
Get bytes from context into an int- Parameters:
bytestart
-bytesize
- number of bytes (range: 1 - 4)- Returns:
-
getContextBytes
public int[] getContextBytes()
Get full set of context bytes. Sleigh only supports context which is a multiple of 4-bytes (i.e., size of int)- Returns:
-
getContextBits
public int getContextBits(int startbit, int bitsize)
Get bits from context into an int- Parameters:
startbit
-bitsize
- number of bits (range: 1 - 32)- Returns:
-
setContextWord
public void setContextWord(int i, int val, int mask)
-
isValid
public boolean isValid(MemBuffer buf)
-
getFlowRefAddr
public Address getFlowRefAddr()
-
getFlowDestAddr
public Address getFlowDestAddr()
-
-