Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fill in the blanks as appropriate with a register (e.g. X0 or X0 ) or a mnemonic (e.g. b) or a #2) long long int

image text in transcribed
image text in transcribed
Fill in the blanks as appropriate with a register (e.g. X0 or X0 ) or a mnemonic (e.g. b) or a \#2) long long int procedureA(long long int arg1, long long int arg2, long long int arg3) \{ long long int var1; var1=procedureB(arg3);var1=var1+arg1+arg2; return var 1 ; ] We will convert this code to ARM. Assume var 1 is in X9. // first we will prepare a stack frame for procedureA before the call to procedureB //place arg1, arg2, arg3, return address, frame pointer on stack sub sp, sp, //make room on the stack, how many bytes? stur , [sp, \#32] //place arg1 on the stack, what register? stur , [sp, \#24 ]//place arg2 on the stack, what register? stur , [sp, \#16 ] //place arg3 on the stack, what register? stur [ [ sp, \#8 ] //place the return address on the stack, what register? stur 29,[ sp. \#0] // place the frame pointer on the stack mov , 2// put arg3 in the appropriate register to be the argument procedureB procedureB //call procedureB mov9,1// load 9(var1) with the value returned by procedureB Idur , [sp, \#32] //restore arg1 from stack Idur [ [sp, \#24] //restore arg2 from stack Idur , [sp, \#16] //restore arg 3 from stack Idur , [sp, \#8] // restore the return address from stack Idur X29, [ sp, \#0] //restore frame pointer from stack addi sp, sp, //move stack pointer add 9,9,1//var1=var1+arg2 add 9,9,2//var1=var1+arg3 mov , x9 //move var1 to the appropriate register with for return from procedureA br

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

Students also viewed these Databases questions