class documentation

class Register(object):

View In Hierarchy

Models an architecture register that can serve as key to designate that register.

Also provides useful information about the register, such as its size, category or parent register

A Register instance is not meant to be constructed directly. Use registers defined in the reven2.arch modules instead.

Examples

Registers are predefined inside of the arch submodules arch.x64, arch.x87, arch.msr and arch.sse2.

>>> arch.x64.rax
Register(x64.rax)

The main use of registers is to pass them as keys to various methods:

>>> context.read(arch.x64.rax) # reads rax in the current context
42

You can also get some information about the registers:

>>> arch.x64.rax.category
Category(general_purpose)
>>> arch.x64.rax.size_bytes
8
Method __init__ Initializes a Register from a low-level object. Not meant to be called directly.
Property name Property: The name of this register as a string.
Method parent The parent register of this register, if exists. Otherwise, None
Property size_bits Property: The exact size of the register, in bits
Property size_bytes Property: The smallest number of bytes required to contain the register
Property bit_offset Property: The offset in bits from the parent register.
Property root_bit_offset Property: The offset in bits from the root register.
Property category Property: The category of the register.
Property arch Property: The architecture of the register, as a string.
Static Method from_name Get the register from its name or None if reg_name doesn't represent a valid register.
Method __repr__ Undocumented
Method __eq__ Undocumented
Method __ne__ Undocumented
Instance Variable _rvn_reg Undocumented
Instance Variable _rvn_node Undocumented
Instance Variable _arch Undocumented
def __init__(self, _rvn_reg, arch):

Initializes a Register from a low-level object. Not meant to be called directly.

Use registers defined in the reven2.arch modules instead.

Information

Parameters_rvn_reglow-level representation of a register
archstring representing the architecture of that register
_rvn_reg =

Undocumented

_rvn_node =

Undocumented

_arch =

Undocumented

@property
name =

Property: The name of this register as a string.

Examples

>>> arch.x64.rax.name
'rax'
>>> arch.x87.fp0.name
'fp0'

Information

ReturnsA string.
def parent(self):

The parent register of this register, if exists. Otherwise, None

Examples

>>> arch.x64.ah.parent()
Register(x64.eax)
>>> arch.x64.ah.parent().parent()
Register(x64.rax)
>>> arch.x64.ah.parent().parent().parent()
None

Information

ReturnsA Register.
@property
size_bits =

Property: The exact size of the register, in bits

Examples

>>> arch.sse2.zmm0.size_bits
512
>>> arch.x64.rax.size_bits
64
>>> arch.x64.iopl.size_bits
2
>>> arch.x64.cf.size_bits
1

Information

ReturnsAn integer.
@property
size_bytes =

Property: The smallest number of bytes required to contain the register

Examples

>>> arch.sse2.zmm0.size_bytes
64
>>> arch.x64.rax.size_bytes
8
>>> arch.x64.iopl.size_bytes
1
>>> arch.x64.cf.size_bytes
1

Information

ReturnsAn integer.
@property
bit_offset =

Property: The offset in bits from the parent register.

If there is no parent register (e.g., rax), returns 0.

Examples

>>> arch.x64.iopl.bit_offset
12
>>> arch.x64.pf.bit_offset
2
>>> arch.x64.rax.bit_offset
0
>>> arch.x87.top.bit_offset
11
>>> arch.msr.aperf.bit_offset
0

Information

ReturnsAn integer.
@property
root_bit_offset =

Property: The offset in bits from the root register.

If the current register is the root register (e.g. rax), returns 0.

Note: Most of the time, this returns the same as Register.bit_offset.

Examples

>>> arch.x64.iopl.root_bit_offset
12
>>> arch.x64.pf.root_bit_offset
2
>>> arch.x64.rax.root_bit_offset
0
>>> arch.x87.top.root_bit_offset
11
>>> arch.msr.aperf.root_bit_offset
0

Information

ReturnsAn integer.
@property
category =

Property: The category of the register.

Examples

>>> arch.x64.iopl.category
Category(flags)
>>> arch.x64.rflags.category
Category(condensed_flags)
>>> arch.x64.rax.category
Category(general_purpose)
>>> arch.x64.rip.category
Category(pc)

Information

ReturnsA Category instance.
@property
arch =

Property: The architecture of the register, as a string.

The architecture is always the same as the module name in which the register resides.

Note: "architectures" are currently defined somewhat arbitrarily:

  • x64: GPR + flags + rip registers
  • sse2: SIMD registers
  • x87: floating point registers
  • msr: msr registers

Examples

>>> arch.x64.iopl.arch
'x64'
>>> arch.sse2.xmm0.arch
'sse2'
>>> arch.x87.fp0.arch
'x87'
>>> arch.msr.aperf.arch
'msr'

Information

ReturnsA string.
@staticmethod
def from_name(reg_name):

Get the register from its name or None if reg_name doesn't represent a valid register.

Information

Parametersreg_namethe name of register.
ReturnsA Register such that its name is equal to reg_name.
def __repr__(self):

Undocumented

def __eq__(self, r):

Undocumented

def __ne__(self, r):

Undocumented

API Documentation for reven2, generated by pydoctor 21.2.2 at 2021-04-08 12:32:07.