From: Wolfgang Kern on

"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

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.

__
wolfgang



From: cr88192 on

"Wolfgang Kern" <nowhere(a)nevernet.at> wrote in message
news:f0uclv$9k4$5(a)newsreader2.utanet.at...
>
> "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
>
>
>


 | 
Pages: 1
Prev: Is hex an ascii thing?
Next: URGENT