Re: Is there a way to load a `RIP` register relative address in inline asm?

2019-06-18 Thread Stefanos Baziotis via Digitalmars-d-learn

On Tuesday, 18 June 2019 at 17:10:50 UTC, Adam D. Ruppe wrote:

On Tuesday, 18 June 2019 at 17:09:48 UTC, Adam D. Ruppe wrote:

pop EAX;


errr you can see my 32 bit bias here (forgive me, I'm old), but 
you know what i mean :)


Thank you, quite clever.
There is also the "$" symbol that is related: 
https://dlang.org/spec/iasm.html#special_symbols


Re: Is there a way to load a `RIP` register relative address in inline asm?

2019-06-18 Thread Adam D. Ruppe via Digitalmars-d-learn

On Tuesday, 18 June 2019 at 17:09:48 UTC, Adam D. Ruppe wrote:

pop EAX;


errr you can see my 32 bit bias here (forgive me, I'm old), but 
you know what i mean :)


Re: Is there a way to load a `RIP` register relative address in inline asm?

2019-06-18 Thread Adam D. Ruppe via Digitalmars-d-learn

On Tuesday, 18 June 2019 at 16:56:18 UTC, Stefanos Baziotis wrote:

I can't do for example:

lea RAX, [RIP+something];

Generally, RIP does not seem to be available.


The general trick in x86 assembly for this is

call next;
next:
pop EAX;


The call instruction pushes RIP to the stack (for a future ret 
instruction) but if you put it right where you are, you can 
simply pop it right back off the stack into another register.


Is there a way to load a `RIP` register relative address in inline asm?

2019-06-18 Thread Stefanos Baziotis via Digitalmars-d-learn

I can't do for example:

lea RAX, [RIP+something];

Generally, RIP does not seem to be available.