Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for xmmword ref during dissasm. #124

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading