Skip to content

[arch/x86] add blendps/mpsadbw/pblendw/pmaxsb/pminsb/pmovsxbq/pmovsxb…#1524

Merged
serpilliere merged 1 commit intocea-sec:masterfrom
w4kfu:x86_imp
Mar 26, 2026
Merged

[arch/x86] add blendps/mpsadbw/pblendw/pmaxsb/pminsb/pmovsxbq/pmovsxb…#1524
serpilliere merged 1 commit intocea-sec:masterfrom
w4kfu:x86_imp

Conversation

@w4kfu
Copy link
Copy Markdown
Contributor

@w4kfu w4kfu commented Mar 25, 2026

Hello, please find attached a pull request that add new x86 several instructions (disas and semantics).

  • blendps
  • mpsadbw
  • pblendw
  • pmaxsb
  • pminsb
  • pmovsxbq
  • pmovsxbw
  • pmulld (the semantic was already present just added the disassembly support)

Also the semantics for the familly 'pmovsx[X]' has been refactored so pmovsxbw, pmovsxbd & pmovsxbq use the same one.

Here are the test used to check at least the disassembly (semantics has only been tested on a test binary) :

import miasm
from miasm.analysis.machine import Machine

checks = [
    # blendps xmm0, xmm1, 5
    (b"\x66\x0F\x3A\x0C\xC1\x05", "BLENDPS XMM0, XMM1, 0x5"),
    # blendps xmm2, xmm3, 0xa
    (b"\x66\x0F\x3A\x0C\xD3\x0A", "BLENDPS XMM2, XMM3, 0xA"),

    # mpsadbw xmm0, xmm1, 3
    (b"\x66\x0F\x3A\x42\xC1\x03", "MPSADBW XMM0, XMM1, 0x3"),

    # pblendw xmm2, xmm3, 0x5A
    (b"\x66\x0F\x3A\x0E\xD3\x5A", "PBLENDW XMM2, XMM3, 0x5A"),

    # pmaxsb xmm4, xmm5
    (b"\x66\x0F\x38\x3C\xE5", "PMAXSB XMM4, XMM5"),

    # pminsb xmm6, xmm7
    (b"\x66\x0F\x38\x38\xF7", "PMINSB XMM6, XMM7"),

    # pmovsxbq xmm1, xmm2
    (b"\x66\x0F\x38\x22\xCA", "PMOVSXBQ XMM1, XMM2"),

    # pmovsxbw xmm3, xmm4
    (b"\x66\x0F\x38\x20\xDC", "PMOVSXBW XMM3, XMM4"),
]

machine = Machine("x86_64")

for instr_bytes, expected in checks:
    try:
        instr = machine.mn.dis(instr_bytes, 64)
        got = " ".join(str(instr).split()).upper()
        exp = " ".join(str(expected).split()).upper()
        if got != exp:
            print("\033[91m[-] {:<30} -> expected : {} ; got : {}\033[0m".format(instr_bytes.hex(" "), exp, got))
        else:
            print("\033[92m[+] {:<30} -> {}\033[0m".format(instr_bytes.hex(" "),got))
    except miasm.core.utils.Disasm_Exception:
        print("\033[91m[-] {:<30} cannot be disassembled\033[0m".format(instr_bytes.hex(" ")))

Let me know If I missed something.

@w4kfu
Copy link
Copy Markdown
Contributor Author

w4kfu commented Mar 25, 2026

Regarding the appveyor that fail.

I don't get how it could work on Windows the test with gcc :

- "%PYTHON%\\python.exe -W error test_all.py -t gcc"

Why does it has been enforced to use gcc ? (out of curiosity)

My only guess is that it could only work if mingw is installed, but I don't think that the good solution.

@serpilliere
Copy link
Copy Markdown
Contributor

@w4kfu thanks for the PR again !
Don't worry for the appveyor, I will try to port it a gha, I will look into this during the ort

@serpilliere serpilliere merged commit 24a64bb into cea-sec:master Mar 26, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants