module documentation

Contains useful functions about registers.

Function get_id_from_msr Get the identification number corresponding to the passed model-specific register (msr).
Function get_msr_from_id Get the model-specific register (msr) conrresponding to the passed identification number.
Function x64_registers Returns a generator over all x64 registers
Function x87_registers Returns a generator over all x87 registers
Function sse2_registers Returns a generator over all sse2 registers
Function msr_registers Returns a generator over all msr registers
Function all_registers Returns a generator over all registers
Function all_categories Returns a generator over all register categories
Function is_segment_register Whether a register is a segment register or not
Function _iter_regs Undocumented
def get_id_from_msr(reg):

Get the identification number corresponding to the passed model-specific register (msr).

Examples

>>> arch.helpers.get_id_from_msr(arch.msr.aperf)
232
>>> arch.helpers.get_msr_from_id(arch.helpers.get_id_from_msr(arch.msr.aperf)) == arch.msr.aperf
True

Information

ReturnsAn integer.
RaisesValueErrorif the passed register is not an msr.
def get_msr_from_id(msr_id):

Get the model-specific register (msr) conrresponding to the passed identification number.

Examples

>>> arch.get_msr_from_id(0)
Register(msr.mc_address)
>>> arch.get_id_from_msr(arch.get_msr_from_id(0)) == 0
True

Information

ReturnsA msr reven2.arch.register.Register.
RaisesValueErrorif the passed id does not correspond to a known msr.
def _iter_regs(module):

Undocumented

def x64_registers():

Returns a generator over all x64 registers

Examples

Filtering over all general-purpose x64 base registers:

>>> [r for r in arch.helpers.x64_registers() if r.category.name == "general_purpose" and
                                                r.parent() is None]
[Register(x64.r15), Register(x64.r12), Register(x64.r13), Register(x64.r10),
Register(x64.r11), Register(x64.rbp), Register(x64.r8), Register(x64.r9),
Register(x64.rdi), Register(x64.rcx), Register(x64.rsi), Register(x64.rsp),
Register(x64.rbx), Register(x64.r14), Register(x64.rdx), Register(x64.rax)]

Information

ReturnsA generator of x64 reven2.arch.register.Register.
def x87_registers():

Returns a generator over all x87 registers

Examples

Filtering over all x87 registers of size 10 bytes:

>>> [r for r in arch.helpers.x87_registers() if r.size_bytes == 10]
[Register(x87.x87r0), Register(x87.x87r5), Register(x87.st4), Register(x87.st5),
Register(x87.st6), Register(x87.st7), Register(x87.st0), Register(x87.st1),
Register(x87.st3), Register(x87.x87r1), Register(x87.x87r2), Register(x87.x87r3),
Register(x87.x87r4), Register(x87.st2), Register(x87.x87r6), Register(x87.x87r7),
Register(x87.fp6), Register(x87.fp5), Register(x87.fp4), Register(x87.fp7),
Register(x87.fp1), Register(x87.fp0), Register(x87.fp3), Register(x87.fp2)]

Information

ReturnsA generator of x87 reven2.arch.register.Register.
def sse2_registers():

Returns a generator over all sse2 registers

Examples

Filtering over all simd registers whose size in bits is not a multiple of 8:

>>> [r for r in arch.helpers.sse2_registers() if r.size_bits % 8 != 0]
[Register(sse2.sse2ie), Register(sse2.sse2im), Register(sse2.sse2zm), Register(sse2.sse2pm),
Register(sse2.sse2pe), Register(sse2.sse2daz), Register(sse2.sse2de), Register(sse2.sse2dm),
Register(sse2.sse2ue), Register(sse2.sse2r-), Register(sse2.sse2r+), Register(sse2.sse2um),
Register(sse2.sse2fz), Register(sse2.sse2ze), Register(sse2.sse2oe), Register(sse2.sse2om)]

Information

ReturnsA generator of sse2 reven2.arch.register.Register.
def msr_registers():

Returns a generator over all msr registers

Examples

Getting a dictionary of all msr name to their ids:

>>> {r.name : arch.helpers.get_id_from_msr(r) for r in arch.helpers.msr_registers()}
{'aperf': 232, 'apic_base': 27, 'bndcfgs': 3472, 'clock_modulation': 410, 'cstar': 3221225603,
'efer': 3221225600, 'fmask': 3221225604, 'fs_base': 3221225728, 'gs_base': 3221225729,
'kernel_gs_base': 3221225730, 'lstar': 3221225602, [...]}

Information

ReturnsA generator of msr reven2.arch.register.Register.
def all_registers():

Returns a generator over all registers

Examples

Getting all registers whose offset compared to the base register is not 0

>>> [r for r in arch.helpers.all_registers() if r.root_bit_offset != 0]
[Register(x64.iopl), Register(x64.ch), Register(x64.tf), Register(x64.df),
Register(x64.zf), Register(x64.rf), Register(x64.bh), Register(x64.of),
Register(x64.vif), Register(x64.vip), Register(x64.pf), Register(x64.ah),
Register(x64.vm), Register(x64.ac), Register(x64.af), Register(x64.id),
Register(x64.dh), Register(x64.if), Register(x64.nt), Register(x64.sf),
Register(x87.x87pe), Register(x87.x87es), Register(x87.top), Register(x87.x87ue),
Register(x87.x87busy), Register(x87.x87sf), Register(x87.x87c3), Register(x87.x87oe),
Register(x87.x87c1), Register(x87.x87c0), Register(x87.x87ze), Register(x87.x87de),
Register(x87.x87c2), Register(sse2.sse2im), Register(sse2.sse2zm), Register(sse2.sse2pm),
Register(sse2.sse2pe), Register(sse2.sse2daz), Register(sse2.sse2de), Register(sse2.sse2dm),
Register(sse2.sse2ue), Register(sse2.sse2r-), Register(sse2.sse2r+), Register(sse2.sse2um),
Register(sse2.sse2fz), Register(sse2.sse2ze), Register(sse2.sse2oe), Register(sse2.sse2om)]

Information

ReturnsA generator of reven2.arch.register.Register.
def all_categories():

Returns a generator over all register categories

Examples

Getting the name of all categories

>>> [c.name for c in arch.helpers.all_categories()]
['segment_register', 'general_purpose', 'simd_flags', 'fpu_flags',
'condensed_flags', 'msr_register', 'control_register', 'fpu',
'pc', 'simd', 'flags', 'special_purpose', 'debug_register']

Information

ReturnsA generator of available reven2.arch.register.Category.
def is_segment_register(reg):

Whether a register is a segment register or not

Examples

>>> arch.helpers.is_segment_register(arch.x64.cs)
True
>>> arch.helpers.is_segment_register(arch.x64.rax)
False

Information

ParametersregThe register to check. (type: arch.register.Register)
ReturnsA boolean.
RaisesTypeErrorif `reg` is a arch.register.Register.
API Documentation for reven2, generated by pydoctor 21.2.2 at 2021-07-01 16:38:17.