Week Four Flashcards
How would you order this four-byte sequence 928A8A57h stored in consecutive memory cells in a little-endian architecture into a big-endian architecture?
57 8A 8A 92
MSB –> LSB
How would you order this two-byte sequence C1ACh stored in consecutive memory cells in a little-endian architecture into a big-endian architecture?
AC C1h
MSB –> LSB
How would you order this four-byte sequence 50 8A 8A 92h stored in consecutive memory cells in a big-endian architecture into a little-endian architecture?
92 8A 8A 50h
LSB –> MSB
When values are received by a called subroutine/function, they are called _________.
parameters
High-level languages always pass arrays to subroutines by value.
False
What are the order of steps for creating a stack frame?
a. passed arguments are pushed on the stack
b. if there are local variables, ESP is decremented to reserve space for the variables on the stack
c. if any registers need to be saved they are pushed on the stack
d. the subroutine is called, causing the subroutine’s return address to be pushed on the stack
e. as the subroutine begins to execute, EBP is pushed on the stack
f. EBP is set equal to ESP. From this point on EBP acts as a base reference for all of the subroutine parameters.
A - D - E - F - B - C
When an argument is passed by value, a copy of the address is pushed on the stack.
False
A stack frame is?
The area of the stack set aside for passed arguments, subroutine return address, local variables, and saved registers.
Passing by reference requires dereferencing a parameter’s offset from the stack inside the called procedure.
True
A subroutine’s stack frame always contains the caller’s return address and the subroutine’s local variables.
True
What advantages do stack parameters have over register parameters?
Stack parameters reduce code clutter because registers do not have to be saved and restored.
Stack parameters are compatible with high-level languages.
Another name for a stack frame is?
Activation record
Assuming that a procedure contains no local variables, a stack frame is created in what order of actions at runtime?
arguments pushed on stack; procedure called; EBP pushed on stack; EBP set to ESP
How would you define a local variable array consisting of 50 signed words?
LOCAL wArray[50]: SWORD
Values passed to a subroutine by a calling program are called _____.
arguments