OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:34 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: What is offset instruction in AT&T syntax?
PostPosted: Sun Apr 17, 2022 12:47 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
Hi,
Like the title, I want to know which instruction in AT&T syntax as same as "offset" instruction in Intel syntax?


Top
 Profile  
 
 Post subject: Re: What is offset instruction in AT&T syntax?
PostPosted: Sun Apr 17, 2022 1:02 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
I think you are looking for the $ prefix... "offset" is not an instruction but a statement that tells the assembler you want the address (really the segment offset) of the following expression.

For example:
Code:
mov offset label, eax # Get the address of label into eax

Becomes:
Code:
movl %eax, $label # Get the address of label into eax

I am not sure if this covers all the cases. But t might just do.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: What is offset instruction in AT&T syntax?
PostPosted: Sun Apr 17, 2022 5:24 am 
Offline
Member
Member
User avatar

Joined: Fri Sep 03, 2021 5:20 pm
Posts: 92
kzinti wrote:
I think you are looking for the $ prefix... "offset" is not an instruction but a statement that tells the assembler you want the address (really the segment offset) of the following expression.

For example:
Code:
mov offset label, eax # Get the address of label into eax

Becomes:
Code:
movl %eax, $label # Get the address of label into eax

I am not sure if this covers all the cases. But t might just do.


Didn't you mistake the order? Isn't the exact opposite? Intel syntax is mov destination, source and AT&T is mov source, destination.

_________________
Writing a bootloader in under 15 minutes: https://www.youtube.com/watch?v=0E0FKjvTA0M


Top
 Profile  
 
 Post subject: Re: What is offset instruction in AT&T syntax?
PostPosted: Sun Apr 17, 2022 9:12 am 
Offline
Member
Member

Joined: Wed Oct 20, 2021 6:00 pm
Posts: 102
Location: Paraguay
Oh, so it just basically the "$" prefix? Thank you for the answer!


Top
 Profile  
 
 Post subject: Re: What is offset instruction in AT&T syntax?
PostPosted: Sun Apr 17, 2022 10:44 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
BigBuda wrote:
Didn't you mistake the order? Isn't the exact opposite? Intel syntax is mov destination, source and AT&T is mov source, destination.

Yep, sure did. Just inverse the operands in both of my examples.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 69 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group