Re: RIP relative adresses




"Wolfgang Kern" <nowhere@xxxxxxxxxxx> wrote in message
news:f0uclv$9k4$5@xxxxxxxxxxxxxxxxxxxxxxxx

"cr88192" wrote:

just figured, maybe a few people can offer comments here:
some assemblers apparently make RIP-relative addressing the default in
long-mode, and others making absolute the default.

for example, in many assemblers:
mov rax, [foo]

...

foo dq 0x0123456789ABCDEF

handles this by making 'foo' by default accessed via a RIP-relative
address.

I'd consider this as a wrong interpretation.

RIP adressing is a special mode,
even the 05/0d defaults to RIP on certain instructions,

So any mov rax,[mem] should result in:

A1 xx xx xx xx xx xx xx xx ;absolute 64 bit


temporarily forgot about that form...


while only mov anyreg,[rip] should produce

8B "05/0D"... ;which then act with RIP-realative addressing

I think your way is the correct one.


ok.

well, there are 2 major ways to do it:
rel is the default;
abs is the default.

did a slight tweak, for now, rel is the default, abs is explicit.
of course, if it really mattered, could just make it a settable flag.

__
wolfgang





.



Relevant Pages

  • Re: RIP relative adresses
    ... and others making absolute the default. ... foo dq 0x0123456789ABCDEF ... So any mov rax,should result in: ...
    (alt.lang.asm)
  • RFC: RIP relative adresses
    ... and others making absolute the default. ... for example, in many assemblers: ... mov rax, ... foo dq 0x0123456789ABCDEF ...
    (alt.lang.asm)