Question: Fill in the blanks as appropriate with a register ( e . g . x 0 or XO ) or a mnemonic ( e .
Fill in the blanks as appropriate with a register eg x or XO or a mnemonic eg b or a
number eg #
long long int procedureAlong long int arg long long int arg long long int arg
long long int var;
var procedureBarg;
var varargoperatornameargoperatornamearg;
return var;
We will convert this code to ARM. Assume var is in X
first we will prepare a stack frame for procedureA before the call to procedureB
place arg arg arg return address, frame pointer on stack
sub sp sp
make room on the stack, how many bytes?
first we will prepare a stack frame for procedureA before the call to procedureB
place arg arg arg return address, frame pointer on stack
sub sp sp
make room on the stack, how many bytes?
stur
sp #place arg on the stack, what register?
stur
sp #place arg on the stack, what register?
stur
sp #place arg on the stack, what register?
stur
sp #place the return address on the stack, what register?
mov
put arg in the appropriate register to be the argument for
procedureB
procedureB call procedureB
procedureB call procedureB
mov load var with the value returned by procedureB
sp #restore arg from stack
sp #restore arg from stack
Idur
restore arg from stack
Idur
sp #restore the return address from stack
Idur X sp #restore frame pointer from stack
addi
Imove stack pointer
add varvararg
add varvararg
add varvararg
mov
xmove var to the appropriate register with for return from
procedureA
br
Nreturn
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
