Interface IRegisterData

All Known Implementing Classes:
AbstractRegisterData, RegisterDataArm, RegisterDataArm64, RegisterDataMips, RegisterDataMips64, RegisterDataX64, RegisterDataX86

public interface IRegisterData
Processor registers data, consisting of a register bank and their concrete values.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the layout used by this register bank.
    int
    getBitsize(int regnum)
    Get the register size in bits.
    Get the byte ordering used by the registers of this bank.
    long
    This convenience method returns the value of the general purpose flag.
    getName(int regnum)
    Get the common name of a register.
    long
    This convenience method returns the value of the program counter register.
    byte[]
    getValue(int regnum)
    Get the binary value of a register.
    getValueAsLong(int regnum)
    Get the value of a register that does not exceed 64 bits, as a long, using the bank's set byte ordering.
    boolean
    setValue(int regnum, byte[] bytes)
    Set the binary value of a register.
    boolean
    setValueAsLong(int regnum, long value)
    Set the value of a register, if it does not exceed 64 bits.
    int
    Retrieve the number of registers defined in the layout used by this register bank.
  • Method Details

    • getBank

      IRegisterBank getBank()
      Get the layout used by this register bank.
      Returns:
      non-null layout
    • getEndianness

      Endianness getEndianness()
      Get the byte ordering used by the registers of this bank.
      Returns:
      non-null endianness
    • size

      int size()
      Retrieve the number of registers defined in the layout used by this register bank. Convenience method.
      Returns:
    • getName

      String getName(int regnum)
      Get the common name of a register. Convenience method.
      Parameters:
      regnum - register number
      Returns:
    • getBitsize

      int getBitsize(int regnum)
      Get the register size in bits. Convenience method.
      Parameters:
      regnum - register number
      Returns:
    • getValue

      byte[] getValue(int regnum)
      Get the binary value of a register. This method returns null if the value is not available. The bytes are laid out in the target processor byte order.

      Note: If the register size is not a multiple of 8, the resulting integer value should be masked to discard the irrelevant upper bits.

      Parameters:
      regnum - register number
      Returns:
      raw bytes (regardless of byte ordering); null if no value was set for the register
    • getValueAsLong

      Long getValueAsLong(int regnum)
      Get the value of a register that does not exceed 64 bits, as a long, using the bank's set byte ordering.
      Parameters:
      regnum - register number
      Returns:
      null on error (eg, no value set for given register, value does not fit on 64-bit)
    • setValue

      boolean setValue(int regnum, byte[] bytes)
      Set the binary value of a register.
      Parameters:
      regnum - register number
      bytes - raw bytes (regardless of byte ordering)
      Returns:
      success indicator
    • setValueAsLong

      boolean setValueAsLong(int regnum, long value)
      Set the value of a register, if it does not exceed 64 bits.
      Parameters:
      regnum - register number
      value - register value
      Returns:
      success indicator
    • getProgramCounter

      long getProgramCounter() throws CannotReadRegisterException
      This convenience method returns the value of the program counter register. The value should be interpreted as an unsigned 64-bit integer.
      Returns:
      the PC value
      Throws:
      CannotReadRegisterException - on error
    • getFlags

      long getFlags() throws CannotReadRegisterException
      This convenience method returns the value of the general purpose flag. Which register(s) that value maps to is processor-dependent.
      Returns:
      the flags value
      Throws:
      CannotReadRegisterException - on error