简体   繁体   English

内存地址的类型是否与 ATT 汇编语言中的整数类型不同?

[英]Do memory addresses have a different types from an integer type in ATT assembly language?

I know the ATT assembly language has integer types (word, double word, quad word), and floating point types (single precision, double precision).我知道 ATT 汇编语言有整数类型(字、双字、四字)和浮点类型(单精度、双精度)。

Do memory addresses have an integer type, or its own type?内存地址是整数类型还是它自己的类型?

I saw that a memory address is specified directly while an integer constant is specified with a prefix $ .我看到直接指定了内存地址,而使用前缀$指定了整数常量。 Is that because an integer and a memory address have different types?那是因为整数和内存地址有不同的类型吗?

In AT&T syntax, different operands are indicated by different syntaxes:在 AT&T 语法中,不同的操作数由不同的语法表示:

%eax                register operand
(%eax)              indirect operand
foo                 direct operand
$foo                immediate operand
foo(%eax)           indexed operand
foo(%eax,%ebx,4)    scale, index, base operand

So the difference between foo and $foo is that the former refers to the memory at address foo whereas the latter refers to the address of foo .所以foo$foo之间的区别在于,前者指的是地址foo处的内存,而后者指的是foo的地址。 As an example, the difference between例如,两者之间的区别

mov 0x1234, %eax

and

mov $0x1234, %eax

is that the former loads the value at address 0x1234 into %eax while the latter loads the value 0x1234 .是前者将地址0x1234处的值加载到%eax而后者加载值0x1234

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

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