unicorn/regress/arm_movr12_hang.py

18 lines
492 B
Python
Raw Normal View History

#!/usr/bin/python
2015-09-07 15:57:09 +00:00
from unicorn import *
from unicorn.arm_const import *
2015-09-07 15:57:09 +00:00
uc = Uc(UC_ARCH_ARM, UC_MODE_ARM)
uc.mem_map(0x1000, 0x1000)
uc.mem_write(0x1000, '00c000e3'.decode('hex'))
def hook_block(uc, addr, *args):
print 'enter block 0x%04x' % addr
uc.reg_write(UC_ARM_REG_R12, 0x123)
print 'r12 =', uc.reg_read(UC_ARM_REG_R12)
2015-09-07 15:57:09 +00:00
uc.hook_add(UC_HOOK_BLOCK, hook_block)
print 'block should only run once'
uc.emu_start(0x1000, 0x1004, timeout=250)
print 'r12 =', uc.reg_read(UC_ARM_REG_R12)