ARM assembly language
Question 6 (7 points) A. Given the following scenario where you initially called the function was, what is the value of the fp at label here and the value of sp at the label here? Assume the value of the sp after the push in was is Ox 4000 i.e. when you are about to branch to there, sp is 0x4000). Express your answer in hexadecimal. there: push add here: nop add {r4-r10, fp} fp, sp, #28 // nop means no operation sp, sp, #-4 // allocate local variable space r4, r0, r1 // 14 = ro + r1 r4, [fp, #-32] // vara = 14 r5, r2, r3 // r5 = r2 + 13 r1, [fp, #-32] // r1 = varA ro, r5, r1 // result = r5 – varA sp, fp, #28 {r4-r10, fp) lr add sub sub pop bx was: // current sp is 0x4000 at this line push bi pop bx (1r) there {lr) r14 Answer sp = fp = Ox B. Given the code in the first part, what is the minimal* set of registers that must be saved by the routine “there”. Answer C. Given the code in the first part, and the “minimal” set of registers that must be saved, what should the instruction add fp, sp, #28 be changed to? Answer D. Why isn’t fp pushed and popped under the label was? Answer E. Why isn’t lr pushed and popped under the label there? Answer F. Why aren’t we pushing r11 for the label there (or are we…)? Answer Show transcribed image text Question 6 (7 points) A. Given the following scenario where you initially called the function was, what is the value of the fp at label here and the value of sp at the label here? Assume the value of the sp after the push in was is Ox 4000 i.e. when you are about to branch to there, sp is 0x4000). Express your answer in hexadecimal. there: push add here: nop add {r4-r10, fp} fp, sp, #28 // nop means no operation sp, sp, #-4 // allocate local variable space r4, r0, r1 // 14 = ro + r1 r4, [fp, #-32] // vara = 14 r5, r2, r3 // r5 = r2 + 13 r1, [fp, #-32] // r1 = varA ro, r5, r1 // result = r5 – varA sp, fp, #28 {r4-r10, fp) lr add sub sub pop bx was: // current sp is 0x4000 at this line push bi pop bx (1r) there {lr) r14 Answer sp = fp = Ox
B. Given the code in the first part, what is the minimal* set of registers that must be saved by the routine “there”. Answer C. Given the code in the first part, and the “minimal” set of registers that must be saved, what should the instruction add fp, sp, #28 be changed to? Answer D. Why isn’t fp pushed and popped under the label was? Answer E. Why isn’t lr pushed and popped under the label there? Answer F. Why aren’t we pushing r11 for the label there (or are we…)? Answer
Expert Answer
Answer to Question 6 (7 points) A. Given the following scenario where you initially called the function was, what is the value of …