Skip to content

Conversation

@nullableVoidPtr
Copy link
Contributor

@nullableVoidPtr nullableVoidPtr commented Feb 17, 2025

Currently a work in progress, unpolished, and needs a lot of testing against APX corpus binaries:

  • EGPRs
  • JMPABS
  • Push/Pop (untested)
    • PUSH2
    • PUSHP
    • POP2
    • POPP
  • CCMPSCC
  • CFCMOVCC
  • CTESTSCC
  • SETCC
  • Zero Upper
    • IMUL (untested)
    • SETCC (unimplemented)
  • New Data Destination

Resolves #5246

@xusheng6
Copy link
Member

@nullableVoidPtr thx for your work! Please let me know when you think the code is ready for reviewer!

@galenbwill galenbwill self-assigned this May 7, 2025
@galenbwill galenbwill added Arch: x86 Issues with the x86/x64 architecture plugin Type: Enhancement Component: Architecture Issue needs changes to an architecture plugin Impact: Low Issue is a papercut or has a good, supported workaround Effort: Medium Issues require < 1 month of work State: Blocked (Customer) Issue is blocked on waiting for a response from a customer labels May 7, 2025
@galenbwill galenbwill added this to the Future milestone May 7, 2025
@galenbwill galenbwill changed the title [arch/x86] Intel APX support [arch/x86] [WIP] Intel APX support May 7, 2025
@galenbwill galenbwill removed their assignment Aug 6, 2025
@psifertex psifertex marked this pull request as draft October 23, 2025 20:20
@@ -3435,6 +3462,23 @@ class X64Architecture: public X86CommonArchitecture
case XED_REG_R14W: return RegisterInfo(XED_REG_R14, 0, 2);
case XED_REG_R15W: return RegisterInfo(XED_REG_R15, 0, 2);

case XED_REG_R16W: return RegisterInfo(XED_REG_R16, 0, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return RegisterInfo(XED_REG_R16, 0, 1); -> return RegisterInfo(XED_REG_R16, 0, 2);

@@ -3472,6 +3516,23 @@ class X64Architecture: public X86CommonArchitecture
case XED_REG_R14D: return RegisterInfo(XED_REG_R14, 0, 4, true);
case XED_REG_R15D: return RegisterInfo(XED_REG_R15, 0, 4, true);

case XED_REG_R16D: return RegisterInfo(XED_REG_R16, 0, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return RegisterInfo(XED_REG_R16, 0, 1); -> return RegisterInfo(XED_REG_R16, 0, 4, true);

@@ -3518,6 +3579,23 @@ class X64Architecture: public X86CommonArchitecture
case XED_REG_R13: return RegisterInfo(XED_REG_R13, 0, 8);
case XED_REG_R14: return RegisterInfo(XED_REG_R14, 0, 8);
case XED_REG_R15: return RegisterInfo(XED_REG_R15, 0, 8);
case XED_REG_R16: return RegisterInfo(XED_REG_R16, 0, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return RegisterInfo(XED_REG_R16, 0, 1); -> return RegisterInfo(XED_REG_R16, 0, 8);

@@ -1870,6 +2265,10 @@ bool GetLowLevelILForInstruction(Architecture* arch, const uint64_t addr, LowLev
il.AddInstruction(il.Jump(ReadILOperand(il, xedd, addr, 0, 0)));
return false;

case XED_ICLASS_JMPABS:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just be able to reuse existing case XED_ICLASS_JMP

@emesare
Copy link
Member

emesare commented Dec 1, 2025

The push / pop lifting looks fine on the binary https://github.com/user-attachments/files/23866882/apxbin.zip

@emesare
Copy link
Member

emesare commented Dec 1, 2025

image

CCMP also looks correct, the conditional CMP block and the DFV write block look fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: x86 Issues with the x86/x64 architecture plugin Component: Architecture Issue needs changes to an architecture plugin Effort: Medium Issues require < 1 month of work Impact: Low Issue is a papercut or has a good, supported workaround State: Blocked (Customer) Issue is blocked on waiting for a response from a customer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Intel APX

5 participants