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

rasm2 giving me different output for x64 #9933

Closed
iCyb3r opened this issue Apr 20, 2018 · 4 comments
Closed

rasm2 giving me different output for x64 #9933

iCyb3r opened this issue Apr 20, 2018 · 4 comments
Labels
RAsm-Assembler test-required x86 Intel/AMD x86 architecture support issues

Comments

@iCyb3r
Copy link

iCyb3r commented Apr 20, 2018

Work environment

Questions Answers
OS/arch/bits (mandatory) Windows x86_64
File format of the file you reverse (mandatory) cli
Architecture/bits of the file (mandatory) x86/64
r2 -v full output, not truncated (mandatory) radare2 2.6.0-git 1 @ windows-x86-64 git. commit: 562bd8f build: Tue 04/10/2018__ 8:26:07.70

Expected behavior

C:\>rasm2 -a x86 -b 64 "mov dword [rbp - 0x74], 0x3f800000"  
c7458c0000803f

AND

C:\>rasm2 -a x86 -b 64 "mov qword [rbp - 0x180], rcx"  
48898d80feffff  

Actual behavior

C:\>rasm2 -a x86 -b 64 "mov dword [rbp - 0x74], 0x3f800000"  
41c67400

AND

C:\>rasm2 -a x86 -b 64 "mov qword [rbp - 0x180], rcx"  
49898d80feffff  

Steps to reproduce the behavior

The first issue only represent itself on Windows, on Ubuntu it gives me a good result (same r2 version on both), although disassembling works as expected on both.
The second issue gives me the expected opcode when removing the bits flag and replace the registers with x86 alternatives i.e.

C:\>rasm2 -a x86 "mov dword [ebp - 0x74], 0x3f800000"  
c7458c0000803f
@ITAYC0HEN
Copy link
Contributor

@PaoloMonti42, is this issue fixed now?

@Maijin
Copy link
Contributor

Maijin commented Jun 23, 2018

Greetings,

x86.nz (x86 handmade assembler) is one of the many x86 assemblers available in radare2 and is updated frequently. Please add a test case so we can fix x86.nz in https://github.com/radare/radare2-regressions/tree/master/new/db/asm (See https://github.com/radare/radare2-regressions/blob/master/new/README.md) You can do so with github web editor without even cloning the repo.

You can contribute to x86.nz by completing the following file https://github.com/radare/radare2/blob/master/libr/asm/p/asm_x86_nz.c.
You can also use keystone(http://keystone-engine.org) within radare2/rasm2 by installing the radare2 plugin via r2pm :

	r2pm -i keystone-lib
	r2pm -i keystone
then
	rasm2 -a x86.ks…
or in radare2 session
	e asm.assembler = x86.ks

Others x86 assemblers are also available trough r2pm or master (see rasm2 -L list):

a___  16 32 64   x86.as      LGPL3   Intel X86 GNU Assembler
a___  16 32 64   x86.nasm    LGPL3   X86 nasm assembler
a___  16 32 64   x86.nz      LGPL3   x86 handmade assembler
ad__  32         x86.olly    GPL2    OllyDBG X86 disassembler

@PaoloMonti42
Copy link
Contributor

@ITAYC0HEN, Yes, my fix #10177 solved this specific issue as well.

@ITAYC0HEN
Copy link
Contributor

K, thanks!
@Maijin, can we close?

@Maijin Maijin closed this as completed Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RAsm-Assembler test-required x86 Intel/AMD x86 architecture support issues
Projects
None yet
Development

No branches or pull requests

5 participants