Package ghidra.pcode.emulate
Class EmulateDisassemblerContext
- java.lang.Object
-
- ghidra.pcode.emulate.EmulateDisassemblerContext
-
- All Implemented Interfaces:
DisassemblerContext
,ProcessorContext
,ProcessorContextView
public class EmulateDisassemblerContext extends java.lang.Object implements DisassemblerContext
-
-
Constructor Summary
Constructors Constructor Description EmulateDisassemblerContext(Language language, RegisterValue initialContextValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearRegister(Register register)
Clears the register within this context.Register
getBaseContextRegister()
RegisterValue
getCurrentContextRegisterValue()
Register
getRegister(java.lang.String name)
Get a Register given the name of a registerRegister[]
getRegisters()
Returns all the Registers for the processorRegisterValue
getRegisterValue(Register register)
Get the RegisterValue for the given register.java.math.BigInteger
getValue(Register register, boolean signed)
Get the contents of a processor register as a BigInteger objectboolean
hasValue(Register register)
Returns true if a value is defined for the given register.void
setCurrentAddress(Address addr)
void
setFutureRegisterValue(Address fromAddr, Address toAddr, RegisterValue value)
Combinesvalue
with any previously saved future register value atfromAddr/toAddr
or any value stored in the program if there is no previously saved future value.void
setFutureRegisterValue(Address address, RegisterValue value)
Combinesvalue
with any previously saved future register value ataddress
or any value stored in the program if there is no previously saved future value.void
setRegisterValue(RegisterValue value)
Sets the specified register value within this context.void
setValue(Register register, java.math.BigInteger value)
Sets the value for a Register.
-
-
-
Constructor Detail
-
EmulateDisassemblerContext
public EmulateDisassemblerContext(Language language, RegisterValue initialContextValue)
-
-
Method Detail
-
getBaseContextRegister
public Register getBaseContextRegister()
- Specified by:
getBaseContextRegister
in interfaceProcessorContextView
- Returns:
- the base processor context register or null if one has not been defined
-
getCurrentContextRegisterValue
public RegisterValue getCurrentContextRegisterValue()
-
setCurrentAddress
public void setCurrentAddress(Address addr)
-
clearRegister
public void clearRegister(Register register)
Description copied from interface:ProcessorContext
Clears the register within this context.- Specified by:
clearRegister
in interfaceProcessorContext
- Parameters:
register
- register to be cleared.
-
getRegister
public Register getRegister(java.lang.String name)
Description copied from interface:ProcessorContextView
Get a Register given the name of a register- Specified by:
getRegister
in interfaceProcessorContextView
- Parameters:
name
- the name of the register.- Returns:
- The register with the given name.
-
getRegisterValue
public RegisterValue getRegisterValue(Register register)
Description copied from interface:ProcessorContextView
Get the RegisterValue for the given register.- Specified by:
getRegisterValue
in interfaceProcessorContextView
- Parameters:
register
- register to get the value for- Returns:
- RegisterValue object containing the value of the register if a value exists, otherwise null.
-
getRegisters
public Register[] getRegisters()
Description copied from interface:ProcessorContextView
Returns all the Registers for the processor- Specified by:
getRegisters
in interfaceProcessorContextView
- Returns:
- all the Registers for the processor
-
getValue
public java.math.BigInteger getValue(Register register, boolean signed)
Description copied from interface:ProcessorContextView
Get the contents of a processor register as a BigInteger object- Specified by:
getValue
in interfaceProcessorContextView
- Parameters:
register
- register to get the value for- Returns:
- a BigInteger object containing the value of the register if a value exists, otherwise null.
-
hasValue
public boolean hasValue(Register register)
Description copied from interface:ProcessorContextView
Returns true if a value is defined for the given register.- Specified by:
hasValue
in interfaceProcessorContextView
- Parameters:
register
- the register to check for a value.- Returns:
- true if the given register has a value.
-
setRegisterValue
public void setRegisterValue(RegisterValue value)
Description copied from interface:ProcessorContext
Sets the specified register value within this context.- Specified by:
setRegisterValue
in interfaceProcessorContext
- Parameters:
value
- register value
-
setValue
public void setValue(Register register, java.math.BigInteger value)
Description copied from interface:ProcessorContext
Sets the value for a Register.- Specified by:
setValue
in interfaceProcessorContext
- Parameters:
register
- the register to have its value setvalue
- the value for the register (null is not permitted).
-
setFutureRegisterValue
public void setFutureRegisterValue(Address address, RegisterValue value)
Description copied from interface:DisassemblerContext
Combinesvalue
with any previously saved future register value ataddress
or any value stored in the program if there is no previously saved future value. Use this method when multiple flows to the same address don't matter or the flowing from address is unknown. Whenvalue
has conflicting bits with the previously saved value,value
will take precedence. If the register value is the value for the processor context register and a previously saved value does not exist, the user saved values in the stored context of the program will be used as existing value.- Specified by:
setFutureRegisterValue
in interfaceDisassemblerContext
- Parameters:
address
- the address to store the register valuevalue
- the register value to store at the address
-
setFutureRegisterValue
public void setFutureRegisterValue(Address fromAddr, Address toAddr, RegisterValue value)
Description copied from interface:DisassemblerContext
Combinesvalue
with any previously saved future register value atfromAddr/toAddr
or any value stored in the program if there is no previously saved future value. Whenvalue
has conflicting bits with the previously saved value,value
will take precedence. If the register value is the value for the processor context register and a previously saved value does not exist, the user saved values in the stored context of the program will be used as existing value.- Specified by:
setFutureRegisterValue
in interfaceDisassemblerContext
- Parameters:
fromAddr
- the address this value if flowing fromtoAddr
- the address to store the register valuevalue
- the register value to store at the address
-
-