QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2634|回复: 3

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

[复制链接]
发表于 2003-2-18 21:26:18 | 显示全部楼层 |阅读模式
[code:1]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).[/code:1]
发表于 2003-4-6 00:24:13 | 显示全部楼层
指令和intel的一样,语法是有点区别,看看这个吧
http://www.linux.org/docs/ldp/howto/Assembly-HOWTO/gas.html
回复

使用道具 举报

发表于 2003-5-28 18:18:25 | 显示全部楼层
http://linuxassembly.org/resources.html
回复

使用道具 举报

发表于 2003-5-28 23:42:57 | 显示全部楼层
http://sf.linuxforum.net/projects/gas2chinese/
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-16 12:00 , Processed in 0.048022 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表