-
Notifications
You must be signed in to change notification settings - Fork 238
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
Use relative addressing in 64-bit assembler #209
Comments
What version are you using? |
1.13.0.0 with my little edits according to your answer here #191 |
Try the latest version. |
Now I am getting the error:
|
It's assumed to be an absolute address so that's why you get an error. Those instructions only take a signed 32-bit address and your address doesn't fit in an i32. The current code uses A workaround is to put the address in a 64-bit register first, |
So won't be able to make relative addressing in Iсed? :( |
Another workaround, until I add this feature, is to just add it manually like so: asm.AddInstruction(Instruction.Create(Code.Mov_rm64_r64, new MemoryOperand(Register.RIP, 0x1234_5678_9ABC_DEF0), Register.RBX)); |
Thank you so much for your help! I found the same way with cmp instruction, everything works fine now:
Could you add the same feature for cmp instructions in the future? That would be cool |
Is it possible to add an opcode Mov_r8_rm64?
P. S. Found the opcode Mov_r8_rm8, it does the same thing, sorry for the unnecessary trouble |
It will work with any instruction that can use a memory operand (and has a modrm byte). #212 I'll close this since it seems everything is working now. |
How can I use relative addressing in 64-bit assembler?
I have some code:
As a result, it turns out like this:
That is, absolute addressing is used here, and the address is "truncated" to 32-bit.
But in another assembler it turns out like this:
Can I use relative addressing in Iced? Is it possible to make it so that instead of bytes of the CMP instruction 80 3C 25, bytes 80 3D are used, as in another assembler?
The text was updated successfully, but these errors were encountered: