From 822198ad1681ed5c4da32b8c5f619aca40b2e457 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Mon, 28 Dec 2015 00:34:26 +0000 Subject: [PATCH 1/2] Added new regression test for ability to execute MIPS at KSEG0 and higher when in kernel mode --- tests/regress/mips_kernel_mmu.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 tests/regress/mips_kernel_mmu.py diff --git a/tests/regress/mips_kernel_mmu.py b/tests/regress/mips_kernel_mmu.py new file mode 100755 index 00000000..09991770 --- /dev/null +++ b/tests/regress/mips_kernel_mmu.py @@ -0,0 +1,25 @@ +#!/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(addr + len(code), uc.reg_read(UC_MIPS_REG_PC)) + self.assertEqual(uc.reg_read(UC_MIPS_REG_AT), 0x3456) + + +if __name__ == '__main__': + regress.main() From 9da93af86171d4f5099d11ef26375129a82701a7 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Mon, 28 Dec 2015 00:36:56 +0000 Subject: [PATCH 2/2] Removed commented out code from MIPS kernel MMU test --- tests/regress/mips_kernel_mmu.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/regress/mips_kernel_mmu.py b/tests/regress/mips_kernel_mmu.py index 09991770..51602fa3 100755 --- a/tests/regress/mips_kernel_mmu.py +++ b/tests/regress/mips_kernel_mmu.py @@ -17,7 +17,6 @@ class MipsSyscall(regress.RegressTest): uc.emu_start(addr, addr + len(code)) - #self.assertEqual(addr + len(code), uc.reg_read(UC_MIPS_REG_PC)) self.assertEqual(uc.reg_read(UC_MIPS_REG_AT), 0x3456)