mirror of
https://github.com/keystone-engine/keystone.git
synced 2026-10-12 02:17:10 +00:00
add arm_blx_label(_thumb) testcase
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/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"""
|
||||
blx func
|
||||
sub r0, r0, r0
|
||||
sub r1, r1, r1
|
||||
func:
|
||||
""")
|
||||
# Assert the result
|
||||
# self.assertEqual(encoding, [ 0x01, 0x00, 0x00, 0xfa, 0x00, 0x00, 0x40, 0xe0, 0x01, 0x10, 0x41, 0xe0 ])
|
||||
self.assertEqual(encoding[:4], [ 0x01, 0x00, 0x00, 0xfa ])
|
||||
|
||||
if __name__ == '__main__':
|
||||
regress.main()
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/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_THUMB)
|
||||
# Assemble to get back insn encoding & statement count
|
||||
encoding, count = ks.asm(b"""
|
||||
blx func
|
||||
movs r0, #0
|
||||
movs r1, #1
|
||||
func:
|
||||
""")
|
||||
# Assert the result
|
||||
# self.assertEqual(encoding, [ 0x00, 0xf0, 0x02, 0xe8, 0x00, 0x20, 0x01, 0x21 ])
|
||||
self.assertEqual(encoding[:4], [ 0x00, 0xf0, 0x02, 0xe8 ])
|
||||
|
||||
if __name__ == '__main__':
|
||||
regress.main()
|
||||
Reference in New Issue
Block a user