Assembly Part 3 Flashcards
We must use the ____ _____ ______ used by x86-64 in a C programming environment
Register save conventions
%rax is used for ______ _____
Return values
%rsp must be _____ when control is returned to caller function
Restoed
If the ____ function wishes to use following register (rax,rbp, r12, r15), the ____ must save/then restore their original values before returning control to caller
Callee
Callee saved registers
Rbp, rbp, r12, r15
All other registers must be saved by the ____ if the ____ wishes to preserve their values
Caller
Caller saved registers
If register contains data needed by Caller after Calle function returns, caller function must reserve them by pushing them on the sack prior to calling the callee function
Callee saved registers
If the Callee function wishes to use these registers, the callee function must push them to the stack prior to using them. Callee must assume the data is these registers is important to the caller function. Calle function must pop these registers back prior to returning to caller. Caller then pops them from stack AFTER callee returns
The first 6 parameters are passed form Caller to Callee in register _____, ____, ___, ___, ___, ___
Rdi, rsi, rdx, rcx, r8, r9
For parameter passing
Caller must assume that Calle function will ____ values in those registers period to return
If caller needs any of the parameters after the call, must push register to stack prior to call and ____ after call
Trash, pop
If the ____ function returns a value to ____, it is returned to register _____
Callee, caller, %rax
____ functions make no calls to any other function
Leaf
If we want to make calls to other functions, we must save and restore and of the parameter registers as well as %r10, %r11 __________ each call if we still want to use the values they contained prior to the call
Before and after
If we use %rbx, %rbp, %r12-%r15 for out funrction’s work, we only save them one at a time (_______) and restore them one at a time (______) of our function
At the beginning, at the end
When a function taking variable arguments is called, %rax must be set to the total number of _____ _______ passed to the function in vector register
Floating-point parameters