brendan 发表于 2003-2-18 21:26:18

有谁知道关于at&t汇编指令和语法方面比较全面的参考

Here are the major caveats about GAS syntax:


Register names are prefixed with %, so that registers are %eax, %dl and so on, instead of just eax, dl, etc. This makes it possible to include external C symbols directly in assembly source, without any risk of confusion, or any need for ugly underscore prefixes.

The order of operands is source(s) first, and destination last, as opposed to the Intel convention of destination first and sources last. Hence, what in Intel syntax is mov eax,edx (move contents of register edx into register eax) will be in GAS syntax mov %edx,%eax.

The operand size is specified as a suffix to the instruction name. The suffix is b for (8-bit) byte, w for (16-bit) word, and l for (32-bit) long. For instance, the correct syntax for the above instruction would have been movl %edx,%eax. However, gas does not require strict AT&T syntax, so the suffix is optional when size can be guessed from register operands, and else defaults to 32-bit (with a warning).

Immediate operands are marked with a $ prefix, as in addl $5,%eax (add immediate long value 5 to register %eax).

Missing operand prefix indicates that it is memory-contents; hence movl $foo,%eax puts the address of variable foo into register %eax, but movl foo,%eax puts the contents of variable foo into register %eax.

Indexing or indirection is done by enclosing the index register or indirection memory cell address in parentheses, as in testb $0x80,17(%ebp) (test the high bit of the byte value at offset 17 from the cell pointed to by %ebp).

cfchio 发表于 2003-4-6 00:24:13

指令和intel的一样,语法是有点区别,看看这个吧
http://www.linux.org/docs/ldp/howto/Assembly-HOWTO/gas.html

fist 发表于 2003-5-28 18:18:25

http://linuxassembly.org/resources.html

Anomymous 发表于 2003-5-28 23:42:57

http://sf.linuxforum.net/projects/gas2chinese/
页: [1]
查看完整版本: 有谁知道关于at&t汇编指令和语法方面比较全面的参考