fix regress/mips_except.py

This commit is contained in:
Nguyen Anh Quynh 2015-09-09 15:32:31 +08:00
parent 18b6680e96
commit 6b52be24a3

View file

@ -6,24 +6,33 @@ def hook_intr(uc, intno, _):
print 'interrupt', intno print 'interrupt', intno
CODE = 0x400000 CODE = 0x400000
asm = '0000a48f'.decode('hex') asm = '0000a48f'.decode('hex') # lw $a0, ($sp)
uc = Uc(UC_ARCH_MIPS, UC_MODE_MIPS32 + UC_MODE_LITTLE_ENDIAN) uc = Uc(UC_ARCH_MIPS, UC_MODE_MIPS32 + UC_MODE_LITTLE_ENDIAN)
uc.hook_add(UC_HOOK_INTR, hook_intr) uc.hook_add(UC_HOOK_INTR, hook_intr)
uc.mem_map(CODE, 0x1000) uc.mem_map(CODE, 0x1000)
uc.mem_write(CODE, asm) uc.mem_write(CODE, asm)
print 'unaligned access (exc 12)' try:
uc.reg_write(UC_MIPS_REG_SP, 0x01) print 'unaligned access (exc 12)'
uc.emu_start(CODE, CODE + len(asm), 300) uc.reg_write(UC_MIPS_REG_SP, 0x400001)
print uc.emu_start(CODE, CODE + len(asm), 300)
print
except UcError as e:
print("ERROR: %s" % e)
print 'dunno (exc 26)' try:
uc.reg_write(UC_MIPS_REG_SP, 0xFFFFFFF0) print 'dunno (exc 26)'
uc.emu_start(CODE, CODE + len(asm), 200) uc.reg_write(UC_MIPS_REG_SP, 0xFFFFFFF0)
print uc.emu_start(CODE, CODE + len(asm), 200)
print
except UcError as e:
print("ERROR: %s" % e)
print 'unassigned access (exc 28)' try:
uc.reg_write(UC_MIPS_REG_SP, 0x80000000) print 'unassigned access (exc 28)'
uc.emu_start(CODE, CODE + len(asm), 100) uc.reg_write(UC_MIPS_REG_SP, 0x80000000)
print uc.emu_start(CODE, CODE + len(asm), 100)
print
except UcError as e:
print("ERROR: %s" % e)