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 ...
随机推荐
- jersey+jetty实现文件上传
服务配置与启动类 import org.glassfish.jersey.servlet.ServletContainer; import javax.ws.rs.Path; import org.e ...
- 【Django】MEDIA的配置及用法
如果需要在数据库中存储图片或视频类的数据,我们可以配置MEDIA. 下面的示例将以上传一张图片的形式来说明MEDIA的配置及用法. 第一步 settings.py # media配置 MEDIA_UR ...
- 03009_SQL注入问题
1.注入问题 (1)假设有登录案例SQL语句如下: SELECT * FROM 用户表 WHERE NAME = 用户输入的用户名 AND PASSWORD = 用户输的密码; (2)此时,当用户输入 ...
- 洛谷 P3385 【模板】负环
P3385 [模板]负环 题目描述 暴力枚举/SPFA/Bellman-ford/奇怪的贪心/超神搜索 输入输出格式 输入格式: 第一行一个正整数T表示数据组数,对于每组数据: 第一行两个正整数N M ...
- 1.lombok系列1:初识lombok
转自:https://www.imooc.com/article/18156 初识lombok 官网:https://projectlombok.org/ 什么是lombok 连官网都懒得废话,只给出 ...
- using可以用于释放操作,相当于Dispose()
using可以用于释放操作,相当于Dispose()
- JavaScript 进度条重复加载
<!DOCTYPE HTML> <html> <head> <meta charset ="utf-8"> <title> ...
- SSO单点登录学习总结(2)——基于Cookie+fliter单点登录实例
1.使用Cookie解决单点登录 技术点: 1.设置Cookie的路径为setPath("/").即Tomcat的目录下都有效 2.设置Cookie的域setDomain(&quo ...
- 使用IPV6
使用IPV6 知道IPV6已经很久了,但是一直没有使用过. 我使用的IPV4网络一般是 内网-->外网-->互联网,IPV6也不外乎这样,但是对IPV6而言,必须有它的"世界&q ...
- 关于laravel框架分页报错的问题
因为laravel框架有自己的分页封装,所以与其他框架相比laravel框架的分页的实现要方便的多 只要分别在php脚本与视图中使用 $data=DB::table('index_pic')-> ...