Skip to content

Commit

Permalink
add regress for keystone-engine#226
Browse files Browse the repository at this point in the history
  • Loading branch information
lunixbochs committed Jul 22, 2016
1 parent 2fdd772 commit 734937c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions suite/regress/x86_lea_three.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/python
# Ryan Hileman, 2016

# This is to test three-operand relative addressing using symbol math.

# Github issue: #226
# Author: Ryan Hileman

from keystone import *

import regress


class TestX86Nasm(regress.RegressTest):
def runTest(self):
# Initialize Keystone engine
ks = Ks(KS_ARCH_X86, KS_MODE_32)
# change the syntax to NASM
ks.syntax = KS_OPT_SYNTAX_NASM

# [eax + b - a] should assemble to [eax + length], or [eax + 6] here
encoding, count = ks.asm(b"a:\nlea eax, [eax + b - a]\nb:")
self.assertEqual(encoding, [ 141, 128, 6, 0, 0, 0 ])

if __name__ == '__main__':
regress.main()

0 comments on commit 734937c

Please sign in to comment.