Declaring Pointers for Different Addressing Types
Learn how pointers are used to address memory cells and registers, as well as addressing different memory granularity in assembly language.
We'll cover the following
Pointers revisited
The pointer is a memory cell or a register that contains the address of another memory cell. Memory pointers have their own addresses because they are memory cells too. In -bit Linux, pointers are -bit, and in -bit Linux, pointers are -bit.
Addressing types
Memory cells can contain one byte, halfword, word, or doubleword. Therefore, a pointer can point to a byte, a halfword, a word, a doubleword, or a quadword. GDB disassembly output displays the suffix l
in instructions involving pointers to -bit (doubleword size) values.
Here are some illustrated examples:
movb $0xFF, (%rax)
The layout of memory before the movb
instruction execution is shown in the figure below:
Get hands-on with 1400+ tech skills courses.