Linux at &t Assembly__linux

Source: Internet
Author: User

1. The first operand is source and the second is destination (just the opposite of Intel).

Copy the contents of the EAX register to EBX:

MOVL    %eax,%EBX

2. Register before the name to add%

3. Add $ immediately before the number. Static C-language variables are also prefixed with $

4. The size of the operand is determined by the last character (b,w,l) of the operator. B:1 byte; W:2 bytes; L:4 bytes

5. Memory Operation:

Section:disp (base, index, scale)

Quite with Intel's

Section:[base + Index*scale + disp]

For constants that are used as scale and disp, do not prefix $

The following is a comparison of the Intel and at&t format assembly code:

+------------------------------+------------------------------------+
|       Intel Code             |      At&t Code                     |
+------------------------------+------------------------------------+
| mov     eax,1                |  MOVL    $1,%eax                   |   
|-mov     EBX,0FFH             |  MOVL    $0xff,%ebx                |   
| int     80h                  |  int     $0x80                     |   
| mov     ebx, eax             |  MOVL    %eax,%ebx                |
|-mov     eax,[ecx  | MOVL    (%ECX),%eax               | |-
mov     eax,[ebx+3]          |  MOVL    3 (%EBX),%eax              | 
| mov     eax,[ebx+20h]        |  MOVL    0x20 (%EBX),%eax           | |
add     eax,[ebx+ecx*2h]     |  Addl    (%ebx,%ecx,0x2),%eax      |
|-Lea     EAX,[EBX+ECX]        |  Leal    (%EBX,%ECX),%eax          |
| sub     eax,[ebx+ecx*4h-20h] |  Subl    -0x20 (%ebx,%ecx,0x4),%eax |


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.