diff --git a/suite/regress/arm_bl_location.py b/suite/regress/arm_bl_location.py new file mode 100755 index 0000000000000000000000000000000000000000..e0990d27497d0c399c80d36981d92f18e48f9e51 --- /dev/null +++ b/suite/regress/arm_bl_location.py @@ -0,0 +1,41 @@ +#!/usr/bin/python + +# Test BL <target> instruction for ARM32 + +# Github issue: #257 +# Author: shakamd + +from keystone import * + +import regress + +class TestARM(regress.RegressTest): + def runTest(self): + # Initialize Keystone engine + ks = Ks(KS_ARCH_ARM, KS_MODE_ARM) + # Assemble to get back insn encoding & statement count + encoding, count = ks.asm(b""" + nop + bl #0xfffe5064 + """) + # Assert the result + self.assertEqual(encoding[-4:], [ 0x16, 0x94, 0xff, 0xeb ]) + + encoding, count = ks.asm(b""" + nop + nop + bl #0xfffe5068 + """) + # Assert the result + self.assertEqual(encoding[-4:], [ 0x16, 0x94, 0xff, 0xeb ]) + + encoding, count = ks.asm(b""" + nop + lsr r7, r2, #8 + bl #0xfffe5068 + """) + # Assert the result + self.assertEqual(encoding[-4:], [ 0x16, 0x94, 0xff, 0xeb ]) + +if __name__ == '__main__': + regress.main()