Python unicorn.UC_MODE_64 Examples

The following are 2 code examples of unicorn.UC_MODE_64(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module unicorn , or try the search function .
Example #1
Source File: x64.py    From rainbow with GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, trace=True, sca_mode=False, local_vars={}):
        super().__init__(trace, sca_mode)
        self.emu = uc.Uc(uc.UC_ARCH_X86, uc.UC_MODE_64)
        self.disasm = cs.Cs(cs.CS_ARCH_X86, cs.CS_MODE_64)
        self.disasm.detail = True
        self.word_size = 8
        self.endianness = "little"
        self.page_size = self.emu.query(uc.UC_QUERY_PAGE_SIZE)
        self.page_shift = self.page_size.bit_length() - 1
        self.pc = uc.x86_const.UC_X86_REG_RIP

        # workaround for capstone 4
        uc.x86_const.UC_X86_REG_RFLAGS = uc.x86_const.UC_X86_REG_EFLAGS

        known_regs = [i[len('UC_X86_REG_'):] for i in dir(uc.x86_const) if '_REG' in i]
        self.reg_map = {r.lower(): getattr(uc.x86_const, 'UC_X86_REG_'+r) for r in known_regs}

        self.stubbed_functions = local_vars
        self.setup(sca_mode)

        self.reset_stack() 
Example #2
Source File: unicorn_trace.py    From bootloader_instrumentation_suite with MIT License 5 votes vote down vote up
def __init__(self):
        Emulator.__init__(self, "X86",
                          unicorn.UC_ARCH_X86,
                          unicorn.UC_MODE_64,
                          "rip",
                          64,
                          ["rsp", "cs", "ss", "rbx", "si", "ip"])
        self.syscall_regnames = ["rdi", "rsi", "rcx", "r8", "rdx",
                                 "r9", "rbx", "rax"]
        self.stackbot = "rbp"
        self.stacktop = "rsp"