简体   繁体   中英

Assembly immediate values

I am new to assembly language and a bit confused about what is considered an "immediate value" in AT&T syntax. 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?

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. This is not considered an immediate value .

An example of immediate value would be something like 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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