Stacks and Functions Flashcards
A type of data structure where items are ADDED AND THEN REMOVED IN REVERSE ORDER.
Stack
Often referred to as Last-In, First-Out (LIFO)
Stack
Heavily used in programming for the storage of information during PROCEDURE OR FUNCTION CALLS.
Stack
Adding an item to a stack is referred to as a?
Push Operattion
Removing an item from a stack is referred to as a?
Pop Operation
The stack is implemented in reverse in memory, stack is implemented growing ___________ in memory.
Growing downward.
Register used to point to the current top of stack in memory.
RSP register.
When using stack operations (push and pop), the stack pointer register is _________ during their operation.
Adjusted
The RSP register is ___________ by _ during push operation.
8
During the push operation, the operand is _________ to the stack at [RSP]
copied.
The RSP register is ______ by _ during the pop operation.
increased by 8
Functions must be _________ before it can be used.
Written (located in the code segment)
A function may be defined _________.
only once
True or False: There is a specific order required for how functions are defined.
False. There is no specific order
True or False: Functions cannot be nested.
True
Function calls involve two main actions:
Linkage
Argument Transmission
This action is when the function must be able to return to the correct place in which it was originally called.
Linkage
This action is when the function must be able to access parameters to operate on or to return results.
Argument Transmission
To instructions that handle the linkage:
call <funcName>
ret</funcName>
In functions, the call operation works by saving the ______ of where to return to when the function completes (ret).
Address
The call operation is accomplished by placing contents of the RIP register on ___________.
the stack
The RIP register points to the _________________ to be executed.
next instruction
The ret instruction pops the _____________________________ into the _______________ (thus the appropriate return address is restored).
current top of the stack (RSP), RIP register
Refers to sending information to a function and obtaining a result as appropriate for the specific function.
Argument Transmission