GAS Syntax
GAS or GNU as syntax is a different form of syntax for assembly language files, known also as AT&T syntax after the original style. It is commonly used by other versions of GAS for other architectures (i.e. non-x86). This guide is not a complete reference, but merely an overview.
GAS syntax can appear foreign to someone who is familiar with Intel syntax.
- Registers are prefixed by a % sign, thus eax becomes %eax
- Operands are reversed, so mov eax, ecx (move ecx into eax) becomes movl %ecx, %eax. Note the "l". This is discussed in item 4.
- Constants are prefixed with a "$", so mov eax, 50 becomes movl $50, %eax. Constants are decimal by default; hexadecimal constants are additionally prefixed with 0x, e.g. "$0x50".
- Opcodes do not have implied sizes nor does it specify the size as a separate word. For example, a 32 bit move with Intel syntax requires the "dword" specifier when it is ambigious, while GAS syntax uses suffixes. See below.
- Memory references through register are in the form of "displacement(base register, offset register, scalar)". Thus the memory reference [eax + 4 + edx*2] is written as 4(%eax, %edx, 2). Note that parentheses are used, NOT square brackets.
- Symbol names require a "$" to load the address, and no prefix to access contents. Thus the Intel/NASM syntax memory reference mov dword eax, [symbol] is the same movl symbol, %eax. To load the address of "symbol", then Intel/NASM syntax uses mov eax, symbol, while GAS uses movl $symbol, %eax.
- b -- 8 bit byte. Ex: movb $0x40, %al, move constant 0x40 into register al.
- w -- 16 bit word. Ex: movw %ax, %bx, move register ax into bx.
- l -- 32 bit long. Ex: movl %ecx, %eax, move register ecx into eax
- q -- 64 bit quadword. Ex: (64 bit programs only) movq %rax, %rdx, move register rax into rdx
Floating Point (x87) Suffixes
- s -- Short (single precision, 32 bits). Ex: flds (%eax), load 32 bit "float" from memory.
- l -- Long (64 bits). Ex: fldl (%eax), load 64 bit "double" from memory.
- t -- Ten-byte (80 bits). Ex: fldt (%eax), load 80 bit "long double" from memory.
SRC=https://github.com/yasm/yasm/wiki/GasSyntax
GAS Syntax的更多相关文章
- [Fw] assembly code in gas syntax
Address operand syntax There are up to 4 parameters of an address operand that are presented in the ...
- NASM mode for Emacs
NASM mode for Emacs Quick post for those Emacs users out there. The common assembler used on GNU ...
- Ubuntu Desktop 编译 ffmpeg (简略的写写)
关于ffmpeg FFmpeg是一個自由軟體,可以執行音訊和視訊多種格式的錄影.轉檔.串流功能,包含了libavcodec——這是一個用於多個專案中音訊和視訊的解碼器函式庫,以及libavformat ...
- Yasm 1.3.0 Release Notes
Yasm 1.3.0 Release Notes http://yasm.tortall.net/releases/Release1.3.0.html Target Audience Welcome ...
- YASM User Manual
This document is the user manual for the Yasm assembler. It is intended as both an introduction and ...
- 如何在Open Live Writer(OLW)中使用precode代码高亮Syntax Highlighter
早先Microsotf的Windows Live Writer(WLW)现在已经开源了,并且更名为Open Live Writer,但是现在Windows Live Writer还是可以现在,Open ...
- Linix登录报"/etc/profile: line 11: syntax error near unexpected token `$'{\r''"
同事反馈他在一测试服务器(CentOS Linux release 7.2.1511)上修改了/etc/profile文件后,使用source命令不能生效,让我帮忙看看,结果使用SecureCRT一登 ...
- [LeetCode] Gas Station 加油站问题
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...
- 获取文件的缩略图Thumbnail和通过 AQS - Advanced Query Syntax 搜索本地文件
演示如何获取文件的缩略图 FileSystem/ThumbnailAccess.xaml <Page x:Class="XamlDemo.FileSystem.ThumbnailAcc ...
随机推荐
- LuoguP3254 圆桌问题(最大流)
题目描述 假设有来自m 个不同单位的代表参加一次国际会议.每个单位的代表数分别为ri (i =1,2,……,m). 会议餐厅共有n 张餐桌,每张餐桌可容纳ci (i =1,2,……,n)个代表就餐. ...
- seq---生成随机数
seq命令用于产生从某个数到另外一个数之间的所有整数. 语法 seq [选项]... 尾数 seq [选项]... 首数 尾数 seq [选项]... 首数 增量 尾数 选项 -f, --format ...
- 关于指定dll搜索路径
原文:关于指定dll搜索路径 问题现象 当部分DLL放在子文件夹下,需要指定DLL搜索路径,否则系统将找不到文件 产生原因 系统默认搜索只会在前程序目录并不包括子目录 解决方法 1,使用App.con ...
- [C#防止反编译].NET 产品版权保护方案 (.NET源码加密保护)
[C#防止反编译].NET 产品版权保护方案 (.NET源码加密保护) 标签: .net加密产品c#dll工具 2011-03-24 21:06 27009人阅读 评论(13) 收藏 举报 分类: C ...
- IIS6/7/8 WEBserver不能訪问grf报表模板文件的问题
通过 IE不能訪问到 .grf 报表文件,这是由于 IIS6/7/8对訪问的扩展名做了限制,除了已经定义的扩展名之外.其它的扩展名都不能訪问.这跟 IIS5 不一样,IIS5 对全部的扩展名都不做限制 ...
- A. Keyboard Codeforces Round #271(div2)
A. Keyboard time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...
- CSS3:元素的边框、背景和大小
边框 和边框相关的属性例如以下. border-width 用于设置边框的宽度,可选择包含: 1)<长度值>:将边框宽度设为以CSS度量单位(如em.px.cm)表达的长度值. 2)< ...
- Jodd-vtor验证框架
VTor是一个编程式验证框架,适用于任意java对象的验证.它是一个快速.微型的.专注于验证的框架.也可以通过注解或者手动设置验证条件.验证条件也可以在profile中分组.VTor是可扩展的,用户很 ...
- 洛谷P1316 丢瓶盖
题目描述 陶陶是个贪玩的孩子,他在地上丢了A个瓶盖,为了简化问题,我们可以当作这A个瓶盖丢在一条直线上,现在他想从这些瓶盖里找出B个,使得距离最近的2个距离最大,他想知道,最大可以到多少呢? 输入输出 ...
- 文字记录而已!!人民币直充/兑换PayPal美金
人民币直充/兑换PayPal美金 用PAYPAL国际使用外国货币,没有信用卡是不能冲值的,到淘宝买吧,被骗的几率大一些,弄来弄去,PAYPAL被冻结. 今天朋友介绍使用 中美互动网 让它给自己的PAY ...