You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
782 B
29 lines
782 B
3 years ago
|
#!/usr/bin/python
|
||
|
|
||
|
# Test BL <label> instruction for ARM32
|
||
|
|
||
|
# Github issue: #248
|
||
|
# Author: dmxcsnsbh
|
||
|
|
||
|
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"""
|
||
|
bl func
|
||
|
sub r0, r0, r0
|
||
|
sub r1, r1, r1
|
||
|
func:
|
||
|
""")
|
||
|
# Assert the result
|
||
|
# self.assertEqual(encoding, [ 0x01, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x40, 0xe0, 0x01, 0x10, 0x41, 0xe0 ])
|
||
|
self.assertEqual(encoding[:4], [ 0x01, 0x00, 0x00, 0xeb ])
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
regress.main()
|