GNU汇编程序x86指令的后缀如".s"如何?在"mov.s"中工作? [英] How do GNU assembler x86 instruction suffixes like ".s" in "mov.s" work?

查看:169
本文介绍了GNU汇编程序x86指令的后缀如".s"如何?在"mov.s"中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GNU汇编程序似乎具有一些控制某些指令发出的操作码的替代形式的方法.例如

GNU assembler appears to have some means of controlling the alternative forms of the opcode being emitted for some instructions. E.g.

.intel_syntax noprefix
mov   eax, ecx
mov.s eax, ecx

使用as test.s -o test.o && objdump -d test.o -M intel处理上面的代码将产生以下反汇编:

Processing the above code with as test.s -o test.o && objdump -d test.o -M intel gives the following disassembly:

0:   89 c8                   mov    eax,ecx
2:   8b c1                   mov    eax,ecx

我们可以看到,出现了.s后缀,将89操作码切换为8b版本(并适当地更改了ModRM字节).

We can see that .s suffix appears to switch 89 opcode to the 8b version (and appropriately change the ModRM byte).

此语法在GAS中如何工作?我找不到任何相关文档.

How does this syntax work in GAS? I can't find any relevant documentation.

推荐答案

从Binutils 2.29开始,指令后缀现在为已弃用,而使用了伪前缀.您可以找到GNU汇编程序(2.29之前)中记录的较旧的后缀信息页.较早的 info as 页面说:

As of Binutils 2.29 the instruction suffixes are now deprecated in favor of pseudo-prefixes. You can find the older suffixes documented in the GNU Assembler (pre-2.29) info pages. Earlier info as pages say this:

9.15.4.1指令命名

9.15.4.1 Instruction Naming

[snip]

可以通过可选的助记符后缀指定不同的编码选项.当从一个寄存器移动到另一个寄存器时,后缀 .s 交换2个寄存器操作数进行编码.后缀 .d8 .d32 在编码时更喜欢8位或32位位移.

Different encoding options can be specified via optional mnemonic suffix. .s suffix swaps 2 register operands in encoding when moving from one register to another. .d8 or .d32 suffix prefers 8bit or 32bit displacement in encoding.

记录新的伪前缀Binutils 2.29(及更高版本) info as 页面已修改为:

Documenting the new pseudo prefixes, Binutils 2.29 (and later) info as pages were revised to read:

可以通过伪前缀指定不同的编码选项:

Different encoding options can be specified via pseudo prefixes:

  • {disp8} –首选8位位移.
  • {disp32} –希望使用32位位移.
  • {load} –更喜欢加载形式的说明.
  • {store} –更喜欢商店形式的说明.
  • {vex2} –首选2字节VEX前缀作为VEX指令.
  • {vex3} –首选3字节VEX前缀作为VEX指令.
  • {evex} –使用EVEX前缀编码.
  • {disp8} – prefer 8-bit displacement.
  • {disp32} – prefer 32-bit displacement.
  • {load} – prefer load-form instruction.
  • {store} – prefer store-form instruction.
  • {vex2} – prefer 2-byte VEX prefix for VEX instruction.
  • {vex3} – prefer 3-byte VEX prefix for VEX instruction.
  • {evex} – encode with EVEX prefix.

这篇关于GNU汇编程序x86指令的后缀如".s"如何?在"mov.s"中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆