wargio / r2dec-js

radare2 plugin - converts asm to pseudo-C code.
508 stars 48 forks source link

Missing instructions for ARM64 #297

Open trufae opened 8 months ago

trufae commented 8 months ago

Some pac instructions are still not handled by r2dec, these are some of them

[0x100003ab4]> pdd | grep asm|sort -u
__asm ("ldurh w0, [x29, -0x5e]");
__asm ("ccmp w10, 0, 0, ne");
__asm ("ccmp w12, 0, 0, ne");
__asm ("madd x11, x11, x12, x8");
__asm ("cneg x0, x11, ne");

madd

Multiply-Add multiplies two register values, adds a third register value, and writes the result to the destination register.

this is iirc x11, x11, x12, x8 => x11 = (x11 * x12) + x8

cneg

Conditional Select Negation returns, in the destination register, the value of the first source register if the condition is TRUE, and otherwise returns the negated value of the second source register.

https://developer.arm.com/documentation/dui0801/h/A64-General-Instructions/CSNEG

conditional comparison

Documentation about ccmp: https://devblogs.microsoft.com/oldnewthing/20220817-00/?p=106998

ignore pac instructions (signing = nop, handle return)

fixed in my PR below

__asm ("paciza x16");
__asm ("pacibsp");
__asm ("paciza x16");
__asm ("retab");
__asm ("ldurh w0, [x29, -0x5e]");
trufae commented 8 months ago

PAC and LDURH ones are solved here https://github.com/wargio/r2dec-js/pull/301

trufae commented 8 months ago

ccmp, madd and cneg are not yet implemented. Can you reopen or do you want me to create a new one?