Contains useful functions about registers.
Function | all |
Returns a generator over all register categories |
Function | all |
Returns a generator over all registers |
Function | get |
Get the identification number corresponding to the passed model-specific register (msr). |
Function | get |
Get the model-specific register (msr) conrresponding to the passed identification number. |
Function | is |
Whether a register is a condensed flags register or not |
Function | is |
Whether a register is a flag register or not |
Function | is |
Whether a register is a segment register or not |
Function | msr |
Returns a generator over all msr registers |
Function | sse2 |
Returns a generator over all sse2 registers |
Function | x64 |
Returns a generator over all x64 registers |
Function | x87 |
Returns a generator over all x87 registers |
Function | _iter |
Undocumented |
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
Returns | |
_Iterator[ | A generator of available reven2.arch.register.Category . |
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
Returns | |
_Iterator[ | A generator of reven2.arch.register.Register . |
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
Parameters | |
reg:register.Register | Undocumented |
Returns | |
int | An integer. |
Raises | |
ValueError | if the passed register is not an msr. |
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
Parameters | |
msrint | Undocumented |
Returns | |
register.Register | A msr reven2.arch.register.Register . |
Raises | |
ValueError | if the passed id does not correspond to a known msr. |
Whether a register is a condensed flags register or not
Examples
>>> arch.helpers.is_flag_register(arch.x64.rflags) True >>> arch.helpers.is_flag_register(arch.x64.of) False >>> arch.helpers.is_flag_register(arch.x64.rax) False
Information
Parameters | |
reg:arch.register.Register | The register to check. |
Returns | |
bool | A boolean. |
Raises | |
TypeError | if `reg` is not a arch.register.Register . |
Whether a register is a flag register or not
Examples
>>> arch.helpers.is_flag_register(arch.x64.of) True >>> arch.helpers.is_flag_register(arch.x64.rax) False >>> arch.helpers.is_flag_register(arch.x64.rflags) False
Information
Parameters | |
reg:arch.register.Register | The register to check. |
Returns | |
bool | A boolean. |
Raises | |
TypeError | if `reg` is not a arch.register.Register . |
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
Parameters | |
reg:arch.register.Register | The register to check. |
Returns | |
bool | A boolean. |
Raises | |
TypeError | if `reg` is not a arch.register.Register . |
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
Returns | |
_Iterator[ | A generator of msr reven2.arch.register.Register . |
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
Returns | |
_Iterator[ | A generator of sse2 reven2.arch.register.Register . |
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
Returns | |
_Iterator[ | A generator of x64 reven2.arch.register.Register . |
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
Returns | |
_Iterator[ | A generator of x87 reven2.arch.register.Register . |