简体   繁体   中英

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).

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:

%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 . 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 .

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