Let's say that I want to read from absolute address gs:$30
in 64bit mode, so the asm code looks something like:
asm
mov rax, gs:[$30]
end;
...and compiler translate this code to...
65 48 8B 05 30 00 00 00 mov rax,gs:[rel $00000030]
But I don't want to use relative address (rip + $30)
. I want the compiler to use absolute address and compile in this way:
65 48 8B 04 25 30 00 00 00 mov rax,gs:[+$0030]
(It is the same, if I use gs:
prefix or not!)
How do I do this?
EDIT:
I know for work-around. I ask if exist any comand to tell compiler to address location as absolute instead relative.
EDIT
So far so good... :)
drhirsch helped me to find the command, and now the compiler translates:
mov rax, gs:[abs qword ptr $30]
or
mov rax, gs:[abs $30]
to this:
6548A13000000000000000 mov rax,[qword $0000000000000030]
Which is almost ok :) Because I want short 32bit opcode (look upper opcodes) instlonger long 64bit opcode.
Is there any way to tell compiler to use short 32 bit address opcode instead long?
mov RAX,$30; mov RAX,gs:[RAX]
– Derringdomov rax, gs:[abs dword ptr $30]
ormov rax, gs:[abs dword $30]
. 676548A130000000=8 bytes. – Tichonn[DCC Error] Project1.dpr(20): E2105 Inline assembler syntax error
– Flyer