9. The following code cod for a c procedure: e sequence occurs near the beginnin
ID: 3586450 • Letter: 9
Question
Explanation / Answer
As we know a processor register is one of a small set of data holding places that are part of the computer processor. A register may hold an instruction, a storage address, or any kind of data (such as a bit sequence or individual characters)
While executing any code, compilers make use of a bunch registers for faster operation such as RAX, RCX, RDX, R8, R9, R10, R11, RBX, RBP, RDI, RSI, R12, R13, R14, R15 etc.
The registers RAX, RCX, RDX, R8, R9, R10, R11 are considered volatile and must be considered destroyed on function calls.
Whereas the registers RBX, RBP, RDI, RSI, R12, R13, R14, and R15 are considered nonvolatile and must be saved and restored by a function that uses them because these belong to the calling function.
Hence in above example Registers %rbx , %r12 and %r13 “belong” to the calling function and the called function is required to preserve their values. In other words, a called function must preserve these registers’ values for its caller. Remaining registers “belong” to the called function and if a calling function wants to preserve such a register value across a function call, it must save the value in its local stack frame.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.