Question: Within the following program, specify caller / callee saved registers that should be pushed / popped: . file option 1 . s # Assembler
Within the following program, specify callercallee saved registers that should be pushedpopped:
file "options
# Assembler directives to allocate storage for static array
section rodata
printfline:
string "The sum of the array is i
printfline:
string "Element d has value d
data
align
array:
quad
quad
quad
quad
globl main
type main, @function
text
main:
push rbp # save caller's rbp
movq rsprbp# copy rsp to rbp so our stack frame is ready to use
pushq rsi
movq $array, rsi#set rsi to point to array
no statement needed
movq $rdi# count
call sum
pushq rsi
movq rax, rsi#move result into nd parameter
no statement needed
movq $printfline, rdi#move string literal to st parameter
pushq rax
movq $rax
call printf
no statement needed
popq rdi
no statement needed
leave
ret
size main, main
globl sum
type sum, @function
sum:
pushq rbp #save callers rbp
movq rsprbp#set functions frame pointer
# register rdi contains size
# register rsi contains address to array
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
