Skip to content

Commit

Permalink
Add support for xmmword ref during dissasm. (#124)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikolaos Totosis <n0t@spamhaus.com>
  • Loading branch information
Casperinous and Nikolaos Totosis authored Jun 19, 2024
1 parent 929c3e4 commit 92be67a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 1 addition & 6 deletions malduck/disasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ class Operand:
_x86_op_mem = None
regs: Dict[str, Union[str, int]] = {}

sizes = {
1: "byte",
2: "word",
4: "dword",
8: "qword",
}
sizes = {1: "byte", 2: "word", 4: "dword", 8: "qword", 16: "xmmword"}

def __init__(self, op: X86Op, x64: bool) -> None:
self.op = op
Expand Down
6 changes: 6 additions & 0 deletions tests/test_disasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class TestDisasm(object):
b"\xe8\x00\x00\x00\x00",
# movxz eax, byte [0x400000]
b"\x0f\xb6\x05\x00\x00\x04\x00",
# movups xmmword ptr [esi+0Ch], xmm0
b"\x0f\x11\x46\x0c"
))

def setup_method(self):
Expand Down Expand Up @@ -60,6 +62,10 @@ def test_insns(self):
assert insn7.op2.reg is None
assert insn7.op2 == (None, None, None, 0x400000)

insn8 = self.insns[7]
assert insn8.op2.reg == "xmm0"
assert insn8.op1.mem == ("xmmword", "esi", None, None, 0x0C)

def test_equal(self):
assert next(disasm(b"hAAAA", 0)).mnem == "push"
assert next(disasm(b"hAAAA", 0)).op1.value == 0x41414141
Expand Down

0 comments on commit 92be67a

Please sign in to comment.