Class AbstractMemoryState

java.lang.Object
ghidra.pcode.memstate.AbstractMemoryState
All Implemented Interfaces:
MemoryState
Direct Known Subclasses:
AdaptedMemoryState, DefaultMemoryState

public abstract class AbstractMemoryState extends Object implements MemoryState
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getBigInteger(AddressSpace spc, long off, int size, boolean signed)
    This is the main interface for reading values from the MemoryState.
    A convenience method for reading a value directly from a register rather than querying for the offset and space
    getBigInteger(Varnode vn, boolean signed)
    A convenience method for reading a value directly from a varnode rather than querying for the offset and space
    This is a convenience method for reading registers by name.
    final long
    getValue(AddressSpace spc, long off, int size)
    This is the main interface for reading values from the MemoryState.
    final long
    A convenience method for reading a value directly from a register rather than querying for the offset and space
    final long
    A convenience method for reading a value directly from a varnode rather than querying for the offset and space
    final long
    This is a convenience method for reading registers by name.
    final void
    setValue(AddressSpace spc, long off, int size, long cval)
    This is the main interface for writing values to the MemoryState.
    final void
    setValue(AddressSpace spc, long off, int size, BigInteger cval)
    This is the main interface for writing values to the MemoryState.
    final void
    setValue(Register reg, long cval)
    A convenience method for setting a value directly on a register rather than breaking out the components
    final void
    A convenience method for setting a value directly on a register rather than breaking out the components
    final void
    setValue(Varnode vn, long cval)
    A convenience method for setting a value directly on a varnode rather than breaking out the components
    final void
    A convenience method for setting a value directly on a varnode rather than breaking out the components
    final void
    setValue(String nm, long cval)
    This is a convenience method for setting registers by name.
    final void
    This is a convenience method for setting registers by name.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface ghidra.pcode.memstate.MemoryState

    getChunk, getMemoryBank, setChunk, setInitialized, setMemoryBank
  • Constructor Details

    • AbstractMemoryState

      public AbstractMemoryState(Language language)
  • Method Details

    • setValue

      public final void setValue(Varnode vn, long cval)
      A convenience method for setting a value directly on a varnode rather than breaking out the components
      Specified by:
      setValue in interface MemoryState
      Parameters:
      vn - the varnode location to be written
      cval - the value to write into the varnode location
    • setValue

      public final void setValue(Register reg, long cval)
      A convenience method for setting a value directly on a register rather than breaking out the components
      Specified by:
      setValue in interface MemoryState
      Parameters:
      reg - the register location to be written
      cval - the value to write into the register location
    • setValue

      public final void setValue(String nm, long cval)
      This is a convenience method for setting registers by name. Any register name known to the language can be used as a write location. The associated address space, offset, and size is looked up and automatically passed to the main setValue routine.
      Specified by:
      setValue in interface MemoryState
      Parameters:
      nm - is the name of the register
      cval - is the value to write to the register
    • setValue

      public final void setValue(AddressSpace spc, long off, int size, long cval)
      This is the main interface for writing values to the MemoryState. If there is no registered MemoryBank for the desired address space, or if there is some other error, an exception is thrown.
      Specified by:
      setValue in interface MemoryState
      Parameters:
      spc - is the address space to write to
      off - is the offset where the value should be written
      size - is the number of bytes to be written
      cval - is the value to be written
    • getValue

      public final long getValue(Varnode vn)
      A convenience method for reading a value directly from a varnode rather than querying for the offset and space
      Specified by:
      getValue in interface MemoryState
      Parameters:
      vn - the varnode location to be read
      Returns:
      the value read from the varnode location
    • getValue

      public final long getValue(Register reg)
      A convenience method for reading a value directly from a register rather than querying for the offset and space
      Specified by:
      getValue in interface MemoryState
      Parameters:
      reg - the register location to be read
      Returns:
      the value read from the register location
    • getValue

      public final long getValue(String nm)
      This is a convenience method for reading registers by name. any register name known to the language can be used as a read location. The associated address space, offset, and size is looked up and automatically passed to the main getValue routine.
      Specified by:
      getValue in interface MemoryState
      Parameters:
      nm - is the name of the register
      Returns:
      the value associated with that register
    • getValue

      public final long getValue(AddressSpace spc, long off, int size)
      This is the main interface for reading values from the MemoryState. If there is no registered MemoryBank for the desired address space, or if there is some other error, an exception is thrown.
      Specified by:
      getValue in interface MemoryState
      Parameters:
      spc - is the address space being queried
      off - is the offset of the value being queried
      size - is the number of bytes to query
      Returns:
      the queried value
    • setValue

      public final void setValue(Varnode vn, BigInteger cval)
      A convenience method for setting a value directly on a varnode rather than breaking out the components
      Specified by:
      setValue in interface MemoryState
      Parameters:
      vn - the varnode location to be written
      cval - the value to write into the varnode location
    • setValue

      public final void setValue(Register reg, BigInteger cval)
      A convenience method for setting a value directly on a register rather than breaking out the components
      Specified by:
      setValue in interface MemoryState
      Parameters:
      reg - the register location to be written
      cval - the value to write into the register location
    • setValue

      public final void setValue(String nm, BigInteger cval)
      This is a convenience method for setting registers by name. Any register name known to the language can be used as a write location. The associated address space, offset, and size is looked up and automatically passed to the main setValue routine.
      Specified by:
      setValue in interface MemoryState
      Parameters:
      nm - is the name of the register
      cval - is the value to write to the register
    • setValue

      public final void setValue(AddressSpace spc, long off, int size, BigInteger cval)
      This is the main interface for writing values to the MemoryState. If there is no registered MemoryBank for the desired address space, or if there is some other error, an exception is thrown.
      Specified by:
      setValue in interface MemoryState
      Parameters:
      spc - is the address space to write to
      off - is the offset where the value should be written
      size - is the number of bytes to be written
      cval - is the value to be written
    • getBigInteger

      public final BigInteger getBigInteger(Varnode vn, boolean signed)
      A convenience method for reading a value directly from a varnode rather than querying for the offset and space
      Specified by:
      getBigInteger in interface MemoryState
      Parameters:
      vn - the varnode location to be read
      signed - true if signed value should be returned, false for unsigned value
      Returns:
      the unsigned value read from the varnode location
    • getBigInteger

      public final BigInteger getBigInteger(Register reg)
      A convenience method for reading a value directly from a register rather than querying for the offset and space
      Specified by:
      getBigInteger in interface MemoryState
      Parameters:
      reg - the register location to be read
      Returns:
      the unsigned value read from the register location
    • getBigInteger

      public final BigInteger getBigInteger(String nm)
      This is a convenience method for reading registers by name. any register name known to the language can be used as a read location. The associated address space, offset, and size is looked up and automatically passed to the main getValue routine.
      Specified by:
      getBigInteger in interface MemoryState
      Parameters:
      nm - is the name of the register
      Returns:
      the unsigned value associated with that register
    • getBigInteger

      public final BigInteger getBigInteger(AddressSpace spc, long off, int size, boolean signed)
      This is the main interface for reading values from the MemoryState. If there is no registered MemoryBank for the desired address space, or if there is some other error, an exception is thrown.
      Specified by:
      getBigInteger in interface MemoryState
      Parameters:
      spc - is the address space being queried
      off - is the offset of the value being queried
      size - is the number of bytes to query
      signed - true if signed value should be returned, false for unsigned value
      Returns:
      the queried unsigned value