mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Add Movsb | Movsd to simple_x86
This commit is contained in:
@@ -538,7 +538,7 @@ class Jz(JmpType):
|
||||
class Jnz(JmpType):
|
||||
encoding = [(RawBits.from_int(8, 0x75), JmpImm8(2)),
|
||||
(RawBits.from_int(16, 0x0f85), JmpImm32(6))]
|
||||
|
||||
|
||||
class Jbe(JmpType):
|
||||
encoding = [(RawBits.from_int(8, 0x76), JmpImm8(2)),
|
||||
(RawBits.from_int(16, 0x0f86), JmpImm32(6))]
|
||||
@@ -574,6 +574,12 @@ class Mov(Instruction):
|
||||
encoding = [(RawBits.from_int(8, 0x89), ModRM([ModRM_REG__REG, ModRM_REG__MEM])),
|
||||
(RawBits.from_int(5, 0xb8 >> 3), X86RegisterSelector(), Imm32())]
|
||||
|
||||
class Movsb(Instruction):
|
||||
encoding = [(RawBits.from_int(8, 0xa4),)]
|
||||
|
||||
class Movsd(Instruction):
|
||||
encoding = [(RawBits.from_int(8, 0xa5),)]
|
||||
|
||||
class Lea(Instruction):
|
||||
encoding = [(RawBits.from_int(8, 0x8d), ModRM([ModRM_REG__MEM], accept_reverse=False, has_direction_bit=False))]
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@ def disas(x):
|
||||
|
||||
|
||||
class TestInstr(object):
|
||||
def __init__(self, instr_to_test):
|
||||
def __init__(self, instr_to_test, expected_result=None):
|
||||
self.instr_to_test = instr_to_test
|
||||
self.expected_result = expected_result
|
||||
|
||||
def __call__(self, *args):
|
||||
res = bytes(self.instr_to_test(*args).get_code())
|
||||
@@ -31,6 +32,12 @@ class TestInstr(object):
|
||||
return True
|
||||
|
||||
def compare_args(self, args, capres):
|
||||
if self.expected_result is not None:
|
||||
result = "{0} {1}".format(capres.mnemonic, capres.op_str)
|
||||
if result != self.expected_result:
|
||||
raise AssertionError("Bad expected result expect <{0}> got <{1}>".format(self.expected_result, result))
|
||||
return
|
||||
|
||||
capres_op = list(capres.operands)
|
||||
if len(args) != len(capres_op):
|
||||
raise AssertionError("Expected {0} operands got {1}".format(len(args), len(capres_op)))
|
||||
@@ -105,5 +112,8 @@ TestInstr(Call)('EAX')
|
||||
TestInstr(Call)(mem('[EAX + ECX * 8]'))
|
||||
TestInstr(Cpuid)()
|
||||
|
||||
TestInstr(Movsb, expected_result='movsb byte ptr es:[edi], byte ptr [esi]')()
|
||||
TestInstr(Movsd, expected_result='movsd dword ptr es:[edi], dword ptr [esi]')()
|
||||
|
||||
TestInstr(Xchg)('EAX', 'ESP')
|
||||
assert Xchg('EAX', 'ECX').get_code() == Xchg('ECX', 'EAX').get_code()
|
||||
|
||||
Reference in New Issue
Block a user