Assembly Part 7 Flashcards
Arrays store multiple data objects of______ _______
Same type
Store sequentially, often accessed as an offset from a pointer which points to _______
Beginning of array
T A[L]
Continuously allocation region of ________ bytes in memory
L*sizeof(T) in memory
Static isn’t array[30];
Static int x = array[25]
$ in assembly language with a label gives an address. Array and x must have been define in the ______ section (.data) of the program
Data
In x86-64, memory to memory moves are _____ allowed
NOT
Int data[20];
How to allocate space for this on the stack??
Subq $80, %rsp. //allocate space on the stack
Leaq (%rsp), %rax //using rax as the base register for the array. So rax stores address of first element in array
Stack clean up before return example
How to allocate space of the stack
We need to subtract the size of the array from the stack
Then we need to store the address of top of the array to some other register (Leaq (%rsp), %rax)
What happens if an array holds elements larger than 1 byte? Ex: array of structures were each structure is 20 bytes
Want to access 5th element
Movq $5, %rcx
Imulq $20, %rax, %rax
Suppose we want &arr[5]
Leaq (%rbx, %rax), %rdx