9e64cba6ec
- UC_ERR_READ_INVALID -> UC_ERR_READ_UNMAPPED - UC_ERR_WRITE_INVALID -> UC_ERR_WRITE_UNMAPPED - UC_ERR_FETCH_INVALID -> UC_ERR_FETCH_UNMAPPED - UC_MEM_READ_INVALID -> UC_MEM_READ_UNMAPPED - UC_MEM_WRITE_INVALID -> UC_MEM_WRITE_UNMAPPED - UC_MEM_FETCH_INVALID -> UC_MEM_FETCH_UNMAPPED - UC_HOOK_MEM_READ_INVALID -> UC_HOOK_MEM_READ_UNMAPPED - UC_HOOK_MEM_WRITE_INVALID -> UC_HOOK_MEM_WRITE_UNMAPPED - UC_HOOK_MEM_FETCH_INVALID -> UC_HOOK_MEM_FETCH_UNMAPPED - UC_HOOK_MEM_INVALID -> UC_HOOK_MEM_UNMAPPED This also renames some newly added macros to use _INVALID postfix: - UC_HOOK_MEM_READ_ERR -> UC_HOOK_MEM_READ_INVALID - UC_HOOK_MEM_WRITE_ERR -> UC_HOOK_MEM_WRITE_INVALID - UC_HOOK_MEM_FETCH_ERR -> UC_HOOK_MEM_FETCH_INVALID - UC_HOOK_MEM_ERR -> UC_HOOK_MEM_INVALID Fixed all the bindings Java, Go & Python.
29 lines
705 B
Python
Executable File
29 lines
705 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
from unicorn import *
|
|
from unicorn.arm_const import *
|
|
|
|
import regress
|
|
|
|
class BxHang(regress.RegressTest):
|
|
|
|
def runTest(self):
|
|
uc = Uc(UC_ARCH_ARM, UC_MODE_ARM)
|
|
uc.mem_map(0x1000, 0x1000)
|
|
uc.mem_write(0x1000, '1eff2f010000a0e1'.decode('hex')) # bxeq lr; mov r0, r0
|
|
uc.count = 0
|
|
|
|
def hook_block(uc, addr, *args):
|
|
print 'enter block 0x%04x' % addr
|
|
uc.count += 1
|
|
|
|
uc.reg_write(UC_ARM_REG_LR, 0x1004)
|
|
uc.hook_add(UC_HOOK_BLOCK, hook_block)
|
|
print 'block should only run once'
|
|
uc.emu_start(0x1000, 0x1004)
|
|
|
|
self.assertEqual(uc.count, 1)
|
|
|
|
if __name__ == '__main__':
|
|
regress.main()
|