flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [bug] EIP-relative addressing cannot get assembled

Author
Thread Post new topic Reply to topic
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen 01 Oct 2006, 20:33
While going back from Kraków with vid, playing with fasm, I noticed that fasm doesn't support EIP-relative addressing.

If I try to assemble the following,
Code:
mov cl,[eip]    

I get
Quote:
error: undefined symbol

It should get assembled to:
Code:
DB 0x67, 0x8A, 0x0D, 0x00, 0x00, 0x00, 0x00    


This addressing is not well documented and it is never referred as "EIP-relative" addressing, but in fact, it is. There are two quotes from the manuls:
AMD wrote:

RIP-relative addressing is enabled by 64-bit mode, not by a 64-
bit address-size. Conversely, use of the address-size prefix
(“Address-Size Override Prefix” on page 6) does not disable
RIP-relative addressing. The effect of the address-size prefix is
to truncate and zero-extend the computed effective address to
32 bits, like any other addressing mode.

Intel wrote:
RIP-relative addressing is enabled by 64-bit mode, not by a 64-bit address-size. The use of the
address-size prefix does not disable RIP-relative addressing. The effect of the address-size
prefix is to truncate and zero-extend the computed effective address to 32 bits.
Post 01 Oct 2006, 20:33
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 01 Oct 2006, 21:33
Added. Wink
Post 01 Oct 2006, 21:33
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen 01 Oct 2006, 21:51
Oh how quick you are Smile
Post 01 Oct 2006, 21:51
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 01 Oct 2006, 22:12
we should have found this earlier... i wanted some real-time streamed FASM coding Smile
Post 01 Oct 2006, 22:12
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.