Class AbstractRegisterData
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.processor.arch.AbstractRegisterData
- All Implemented Interfaces:
IRegisterData
- Direct Known Subclasses:
RegisterDataArm
,RegisterDataArm64
,RegisterDataMips
,RegisterDataMips64
,RegisterDataX64
,RegisterDataX86
Common base implementation of a bank of registers.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
clearDirty
(int regnum) getBank()
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
getFlags()
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.int
getSize
(int regnum) 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
isDirty
(int regnum) void
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.toString()
-
Field Details
-
values
-
dirtyRegisters
-
-
Constructor Details
-
AbstractRegisterData
-
-
Method Details
-
getBank
Description copied from interface:IRegisterData
Get the layout used by this register bank.- Specified by:
getBank
in interfaceIRegisterData
- Returns:
- non-null layout
-
getEndianness
Description copied from interface:IRegisterData
Get the byte ordering used by the registers of this bank.- Specified by:
getEndianness
in interfaceIRegisterData
- Returns:
- non-null endianness
-
size
public int size()Description copied from interface:IRegisterData
Retrieve the number of registers defined in the layout used by this register bank. Convenience method.- Specified by:
size
in interfaceIRegisterData
- Returns:
-
getName
Description copied from interface:IRegisterData
Get the common name of a register. Convenience method.- Specified by:
getName
in interfaceIRegisterData
- Parameters:
regnum
- register number- Returns:
-
getBitsize
public int getBitsize(int regnum) Description copied from interface:IRegisterData
Get the register size in bits. Convenience method.- Specified by:
getBitsize
in interfaceIRegisterData
- Parameters:
regnum
- register number- Returns:
-
getSize
public int getSize(int regnum) -
getValue
public byte[] getValue(int regnum) Description copied from interface:IRegisterData
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.
- Specified by:
getValue
in interfaceIRegisterData
- Parameters:
regnum
- register number- Returns:
- raw bytes (regardless of byte ordering); null if no value was set for the register
-
getValueAsLong
Description copied from interface:IRegisterData
Get the value of a register that does not exceed 64 bits, as a long, using the bank's set byte ordering.- Specified by:
getValueAsLong
in interfaceIRegisterData
- Parameters:
regnum
- register number- Returns:
- null on error (eg, no value set for given register, value does not fit on 64-bit)
-
setValue
public boolean setValue(int regnum, byte[] bytes) Description copied from interface:IRegisterData
Set the binary value of a register.- Specified by:
setValue
in interfaceIRegisterData
- Parameters:
regnum
- register numberbytes
- raw bytes (regardless of byte ordering)- Returns:
- success indicator
-
setValueAsLong
public boolean setValueAsLong(int regnum, long value) Description copied from interface:IRegisterData
Set the value of a register, if it does not exceed 64 bits.- Specified by:
setValueAsLong
in interfaceIRegisterData
- Parameters:
regnum
- register numbervalue
- register value- Returns:
- success indicator
-
getDirtyRegisters
-
isDirty
public boolean isDirty(int regnum) -
setDirty
public void setDirty(int regnum) -
setAllDirty
public void setAllDirty() -
clearDirty
public void clearDirty(int regnum) -
clearAllDirty
public void clearAllDirty() -
getProgramCounter
Description copied from interface:IRegisterData
This convenience method returns the value of the program counter register. The value should be interpreted as an unsigned 64-bit integer.- Specified by:
getProgramCounter
in interfaceIRegisterData
- Returns:
- the PC value
- Throws:
CannotReadRegisterException
- on error
-
getFlags
Description copied from interface:IRegisterData
This convenience method returns the value of the general purpose flag. Which register(s) that value maps to is processor-dependent.- Specified by:
getFlags
in interfaceIRegisterData
- Returns:
- the flags value
- Throws:
CannotReadRegisterException
- on error
-
toString
-