简体   繁体   English

装配立即值

[英]Assembly immediate values

I am new to assembly language and a bit confused about what is considered an "immediate value" in AT&T syntax. 我是汇编语言的新手,对AT&T语法中被认为是“直接值”的东西感到有些困惑。 Specifically, I understand that "$" is used to either represent an immediate value or an address and "%" is used to represent registers, but then I come to accessing elements of "arrays": 具体来说,我理解“$”用于表示立即值或地址,“%”用于表示寄存器,但后来我访问“数组”的元素:

movl mem_location(%ebx,%ecx,4), %eax

Why doen't this number 4 have "$" before it, isn't it an immediate value? 为什么这个数字4之前没有“$”,这不是一个直接值吗?

Thank you for your time 感谢您的时间

I think you misunderstand the meaning of immediate value. 我认为你误解了直接价值的含义。 Immediate value means the value is included on the opcode. 立即值表示该值包含在操作码中。 If it refers to memory (array) or registers, it is not immediate. 如果它指的是内存(数组)或寄存器,则不是立即的。 As Jester points out, the 4 is actually a scale factor for memory addressing. 正如Jester所指出的那样, 4实际上是内存寻址的比例因子。 This is not considered an immediate value . 这不被视为直接价值

An example of immediate value would be something like mov eax, 123 . 立即价值的一个例子就像mov eax, 123

Also note that immediate value is an assembly concept (it applies to a lot of architectures), not something specific to AT&T syntax. 还要注意, 立即值是一个汇编概念(它适用于许多架构),而不是特定于AT&T语法的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM