【问题标题】:Intel syntax is [eax+ebx], what is AT&T syntax equivalent?Intel 语法是 [eax+ebx],什么是 AT&T 语法等价物?
【发布时间】:2012-03-03 21:44:11
【问题描述】:

strlen in assembly的问题 是关于汇编中的strlen,但这似乎是用AT&T语法编写的,不幸的是我的汇编程序不支持。

我只是好奇你如何将语法 [eax + ebx] 翻译成 intel 的语法?

所以

4(%eax)     # offset 4

等价于

[eax + 4]

假设偏移值存储在 %ebx 中。

的等价物是什么
[eax + ebx]

?

%ebx(%eax)     # doesn't work!

谢谢,

【问题讨论】:

    标签: assembly x86 intel


    【解决方案1】:

    [eax+ebx] 应该翻译成(%eax,%ebx)

    AT&T 语法中内存地址的完整语法是:

    offset(%reg1,%reg2,scale)
    

    相当于:

    [reg1 + reg2*scale + offset]
    

    offsetscale 是常数值,scale 必须是 1、2、4 或 8。默认值为 0 表示偏移,1 表示比例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-24
      • 2010-12-09
      • 1970-01-01
      • 2021-03-28
      • 2014-03-25
      • 1970-01-01
      相关资源
      最近更新 更多