From e474363b10ddaff6ce29f989ecc8c09df64eafb7 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Thu, 5 May 2016 00:06:40 +0800 Subject: [PATCH] regress: add testcase for issue #6 --- suite/regress/x86_jmp_ptr5.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 suite/regress/x86_jmp_ptr5.py diff --git a/suite/regress/x86_jmp_ptr5.py b/suite/regress/x86_jmp_ptr5.py new file mode 100755 index 0000000..5297599 --- /dev/null +++ b/suite/regress/x86_jmp_ptr5.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +# Nguyen Anh Quynh, 2016 + +# Test 'jmp dword ptr [5]' with both X86 Intel & ATT syntax + +# Github issue: #5 +# Author: Nguyen Anh Quynh + +from keystone import * + +import regress + +class TestX86(regress.RegressTest): + def runTest(self): + # Initialize Keystone engine + ks = Ks(KS_ARCH_X86, KS_MODE_32) + + ks.syntax = KS_OPT_SYNTAX_ATT + # Assemble to get back insn encoding & statement count + encoding, count = ks.asm("jmpl *5") + # Assert the result + self.assertEqual(encoding, [ 0xff, 0x25, 0x05, 0x00, 0x00, 0x00 ]) + + ks.syntax = KS_OPT_SYNTAX_INTEL + # Assemble to get back insn encoding & statement count + encoding, count = ks.asm("jmp dword ptr [5]") + # Assert the result + self.assertEqual(encoding, [ 0xff, 0x25, 0x05, 0x00, 0x00, 0x00 ]) + +if __name__ == '__main__': + regress.main()