At&t and Intel assembly formats

Source: Internet
Author: User

1. In intel format, most of them use upper-case letters (both in lower case) and lower-case letters in at&t format.

2. In at&t format, Register names must be prefixed with "%", which is not required in intel.

3. The original operation of the command is different from that of the destination operand. For example, if the eax value is passed into the EBX command, in Intel, the target is in the front, and the original operand is in the back (mov EBX, eax), while at&t is in the opposite way (mov % eax, EBX ). One of their ideas is: EBX = eax, and the other is: % eax-> % EBX.

4. The operands of the access command are different in size: at&t is B (8 bits), w (16 bits), and L (32 bits ). The intel format is to add byte PTR (word PTR, dword ptr) before the memory operand ). For example, to direct the 8-Bit Memory Unit pointed to by foo to the Register Al:MoV Al, byte PTR Foo (Intel format), movb Foo, % Al (at&t format)

5. In at&t format, "$" must be added before the direct operand, but not in Intel format. For example:Push 4 (Intel format), pushl $4 (at&t format ).

6. In at&t format, the absolute professional or call command jump/call operations must be added"*".

7. Differences between the operation codes for remote transfer and invocation commands: at&t format(Lcall $ section, $ offset, ljmp $ section, $ offset), In Intel format(Call far section: Offset, JMP far section: Offset).

8. Indirect addressing format:

Section: [base + Index * scale + disp] (Intel format)

Section: disp (base, index, scale) (at&t format)

This addressing method is often used to access a field in a specific element in an array of data structures. Base is the actual address of the array, scale is the size of each array element, and index is the subscript, if the array element is a data structure, DISP is the displacement of a specific field.

For example, if index is eax, scale is 4, and disp is FOO:

[Foo + eax * 4] (Intel format), Foo (, % eax, 4) (at&t format ).Note that when at&t only contains base, the comma can be omitted.

 

Read the full text

Category:View comments in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.