Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Calling Convention and Stack a) List the registers in ARM architecture used for the following: program counter link register stack pointer arguments passed to

image text in transcribed

2. Calling Convention and Stack a) List the registers in ARM architecture used for the following: program counter link register stack pointer arguments passed to a function return values from a function b) Let us consider the following function that takes six parameters. The line number is shown on the left side. Assume ARM's calling convention. 1: int func(int il, int i2, int i3, int i4, int i5, int i6) { int add12, mul34, div56; add12 = il + i2; mul34 = i3 * i 4; div56 = i5 / i6; return (add12 + mul34 + div56); 9: 12: } Given the initial state for registers (RO-R6) and the stack at the beginning of the function shown below, draw the stack right after the execution of Line 7. Assume that the function allocates space for each local variable in the stack. The value of each local variable will be stored in the stack. Assume that addi2 is allocated at a higher memory address and div56 is allocated at a lower address. Register Value High Address RO RI 3 SP R2 R3 R4 R5 R6 128 1024 Low Address What will be the value of registers RO to R6 at the end of the function? Assume that the function does not change the registers holding input parameters except for returning the result at the end. R4, R5, and R6 are used as temporary registers and hold values for add12, mul34, and div56 when calculating the return value. 2. Calling Convention and Stack a) List the registers in ARM architecture used for the following: program counter link register stack pointer arguments passed to a function return values from a function b) Let us consider the following function that takes six parameters. The line number is shown on the left side. Assume ARM's calling convention. 1: int func(int il, int i2, int i3, int i4, int i5, int i6) { int add12, mul34, div56; add12 = il + i2; mul34 = i3 * i 4; div56 = i5 / i6; return (add12 + mul34 + div56); 9: 12: } Given the initial state for registers (RO-R6) and the stack at the beginning of the function shown below, draw the stack right after the execution of Line 7. Assume that the function allocates space for each local variable in the stack. The value of each local variable will be stored in the stack. Assume that addi2 is allocated at a higher memory address and div56 is allocated at a lower address. Register Value High Address RO RI 3 SP R2 R3 R4 R5 R6 128 1024 Low Address What will be the value of registers RO to R6 at the end of the function? Assume that the function does not change the registers holding input parameters except for returning the result at the end. R4, R5, and R6 are used as temporary registers and hold values for add12, mul34, and div56 when calculating the return value

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_2

Step: 3

blur-text-image_3

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

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

3642412203, 978-3642412202

More Books

Students also viewed these Databases questions

Question

Briefly describe the steps involved in tax research.

Answered: 1 week ago