radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.25k stars 2.96k forks source link

x86.nz does not assemble "inc/dec size ptr [reg]" instructions #10053

Open PaoloMonti42 opened 6 years ago

PaoloMonti42 commented 6 years ago
$ rasm2 -b 64 -s intel -a x86.as 'inc byte ptr [rcx]'
fe01
$ rasm2 -b 64 -s intel -a x86.as 'inc word ptr [rcx]'
66ff01
$ rasm2 -b 64 -s intel -a x86.as 'inc dword ptr [ecx]'
67ff01
$ rasm2 -b 64 -s intel -a x86.as 'inc qword ptr [ecx]'
6748ff01
...

Enabling this functionality would require a rework of the current opcode parsing in this file.

The problem is that op->operand[0].type is only one single variable, while to keep track of sizes in, e.g., "inc dword ptr [rcx]" we would require at least two. At the moment the information about the size is overwritten by parseReg().

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. Considering a lot has changed since its creation, we kindly ask you to check again if the issue you reported is still relevant in the current version of radare2. If it is, update this issue with a comment, otherwise it will be automatically closed if no further activity occurs. Thank you for your contributions.

trufae commented 4 years ago

This issue is not yet fixed. thats handy for r2wars

$ rasm2 -b 64 'inc qword ptr [ecx]'
48ff01
$ rasm2 -d 48ff01
dec eax
inc dword [ecx]
$