Merge pull request #347 from metrzero/master
Regression test for MIPS kernel mode execution
This commit is contained in:
commit
de197ffab4
24
tests/regress/mips_kernel_mmu.py
Executable file
24
tests/regress/mips_kernel_mmu.py
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from unicorn import *
|
||||
from unicorn.mips_const import *
|
||||
|
||||
import regress
|
||||
|
||||
class MipsSyscall(regress.RegressTest):
|
||||
def test(self):
|
||||
addr = 0x80000000
|
||||
code = '34213456'.decode('hex') # ori $at, $at, 0x3456
|
||||
|
||||
uc = Uc(UC_ARCH_MIPS, UC_MODE_MIPS32 + UC_MODE_BIG_ENDIAN)
|
||||
uc.mem_map(addr, 0x1000)
|
||||
uc.mem_write(addr, code)
|
||||
uc.reg_write(UC_MIPS_REG_AT, 0)
|
||||
|
||||
uc.emu_start(addr, addr + len(code))
|
||||
|
||||
self.assertEqual(uc.reg_read(UC_MIPS_REG_AT), 0x3456)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
regress.main()
|
Loading…
Reference in New Issue
Block a user