Page 45 - ARM 64 Bit Assembly Language
P. 45
28 Chapter 1
Address Contents
(Base 16) (Base 2)
. . . .
Address Contents . .
(Base 16) (Base 2) 00439000 ... 00000000
. . 0043BFFC 01110010011011000110010000100001
. .
. . 0043BFF8 01101111001000000101011101101111
00439000 00000000 0043BFF4 01001000011001010110110001101100
0043BFFF 00100001 . . . .
0043BFFE 01100100 . .
0043BFFD 01101100 (B) Viewed as 32-bit big-endian words.
0043BFFC 01110010
0043BFFB 01101111
0043BFFA 01010111
0043BFF9 00100000 Address Contents
0043BFF8 01101111 (Base 16) (Base 2)
0043BFF7 01101100 . .
. .
0043BFF6 01101100 . .
0043BFF5 01100101 00439000 ... 00000000
0043BFFC 00100001011001000110110001110010
0043BFF4 01001000
0043BFF8 01101111010101110010000001101111
. .
. . 0043BFF4 01101100011011000110010101001000
. .
. .
(A) Viewed as bytes. . . . .
(C) Viewed as 32-bit little-endian words.
Figure 1.6: A section of memory can be viewed in different ways.
contain constants and static variables. The size of the .text, .data, .rodata,and .bss sec-
tions depend on how large the program is, and how much static data storage has been declared
by the programmer. The heap contains variables that are allocated dynamically, and the stack
is used to store parameters for function calls, return addresses, and local (automatic) variables.
In a high level language, storage space for a variable can be allocated in one of three ways:
statically, dynamically, and automatically. Statically allocated variables are allocated in the
.data, .rodata,or .bss section. The storage space is reserved, and usually initialized, when
the program is loaded and begins execution. The address of a statically allocated variable is
fixed at the time the program begins running, and cannot be changed. Automatically allo-
cated variables, often referred to as local variables, are stored on the stack. The stack pointer
is adjusted down to make space for the newly allocated variable. The address of an automatic
variable is always computed as an offset from the stack pointer. Dynamic variables are allo-
cated from the heap, using malloc, new, or a language-dependent equivalent. The address
of a dynamic variable is always stored in another variable, known as a pointer, which may be
an automatic or static variable, or even another dynamic variable. The six major sections of