public abstract class

AbstractRegisterData

extends Object
implements IRegisterData
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.processor.arch.AbstractRegisterData
Known Direct Subclasses

Class Overview

Common base implementation of a bank of registers.

Summary

Fields
protected Set<Integer> dirtyRegisters
protected Map<Integer, byte[]> values
Public Constructors
AbstractRegisterData(AbstractRegisterBank layout, Endianness endianness)
Public Methods
void clearAllDirty()
void clearDirty(int regnum)
AbstractRegisterBank getBank()
Get the layout used by this register bank.
int getBitsize(int regnum)
Get the register size in bits.
Set<Integer> getDirtyRegisters()
Endianness getEndianness()
Get the byte ordering used by the registers of this bank.
long getFlags()
This convenience method returns the value of the general purpose flag.
String getName(int regnum)
Get the common name of a register.
long getProgramCounter()
This convenience method returns the value of the program counter register.
int getSize(int regnum)
byte[] getValue(int regnum)
Get the binary value of a register.
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.
boolean isDirty(int regnum)
void setAllDirty()
void setDirty(int regnum)
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 size()
Retrieve the number of registers defined in the layout used by this register bank.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.units.code.asm.processor.IRegisterData

Fields

protected Set<Integer> dirtyRegisters

protected Map<Integer, byte[]> values

Public Constructors

public AbstractRegisterData (AbstractRegisterBank layout, Endianness endianness)

Public Methods

public void clearAllDirty ()

public void clearDirty (int regnum)

public AbstractRegisterBank getBank ()

Get the layout used by this register bank.

Returns
  • non-null layout

public int getBitsize (int regnum)

Get the register size in bits. Convenience method.

Parameters
regnum register number

public Set<Integer> getDirtyRegisters ()

public Endianness getEndianness ()

Get the byte ordering used by the registers of this bank.

Returns
  • non-null endianness

public long getFlags ()

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

public String getName (int regnum)

Get the common name of a register. Convenience method.

Parameters
regnum register number

public long getProgramCounter ()

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

public int getSize (int regnum)

public 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

public 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)

public boolean isDirty (int regnum)

public void setAllDirty ()

public void setDirty (int regnum)

public 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

public 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

public int size ()

Retrieve the number of registers defined in the layout used by this register bank. Convenience method.

public String toString ()