2016-02-05 04:35:17 +03:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
from unicorn import *
|
|
|
|
from unicorn.x86_const import *
|
|
|
|
|
|
|
|
import regress
|
|
|
|
|
|
|
|
class VldrPcInsn(regress.RegressTest):
|
|
|
|
|
|
|
|
def runTest(self):
|
|
|
|
uc = Uc(UC_ARCH_X86, UC_MODE_32)
|
|
|
|
uc.mem_map(0x1000, 0x1000)
|
|
|
|
# mov gs, eax; mov eax, 1
|
|
|
|
code = '8ee8b801000000'.decode('hex')
|
|
|
|
uc.mem_write(0x1000, code)
|
|
|
|
uc.reg_write(UC_X86_REG_EAX, 0xFFFFFFFF)
|
2016-07-05 01:07:57 +03:00
|
|
|
|
|
|
|
with self.assertRaises(UcError) as ex_ctx:
|
2016-07-04 08:57:48 +03:00
|
|
|
uc.emu_start(0x1000, 0x1000 + len(code))
|
2016-07-05 01:07:57 +03:00
|
|
|
|
2016-07-05 19:10:39 +03:00
|
|
|
self.assertEquals(ex_ctx.exception.errno, UC_ERR_EXCEPTION)
|
2016-02-05 04:35:17 +03:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
regress.main()
|