1/13
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Explain the difference between a macro and a function.
Macros copy past code and uses more space = less time. Functions reuse code and is only defined once = saves space and slower/more time.
Why or when should we use one over the other? (Macros v.s. Functions)
Functions is more portable and macros are limited to the file they are defined in.
Macros is good for _________
Low use procedure
Functions is good for _______
High use procedure
Why do we have a standard calling convention?
For portability and gives protection to data
What does it mean for a register to be preserved?
Save registers save the values before and after the function is called
Which registers do the first 6 integer arguments go in?
rdi, rsi, rdx, rcx, r8, r9
What are the integer registers?
RAX, RBX, RCX, RDX, RSI, RDI, RBP, RSP, R8, R9, R10, R11, R12, R13, R14, R15
What are the integer registers used for?
Integer arithmetic, addressing,indexing, and passing first 6 integer arguments
Where are arguments 7+ stored and how?
Arguments 7+ are placed on the stack because they are pushed right to left in a 8 byte slot for each one.
What is the integer register that gets the return value from a function?
RAX
What is the floating point register that gets the return value from a function?
xmm0
Explain in detail the 2 instructions that are required to implement linkage for functions.
call - push rip, jump to function definition
ret - pop rip