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 followinjg * program counter link register stack pointer arguments passed

image text in transcribed

2. Calling Convention and Stack a) List the registers in ARM architecture used for the followinjg * program counter link register stack pointer arguments passed to a function . return values from a function Let us consider the following function that takes six parameters. The line number is shown on the left side. Assume ARM's calling convention b) 1: int func (int il,int i2,int 13,int i4,int i5,int i6) ( int add12, mul34, div56; add12-i1 12; 41v56-15 / i6; return (add12 mul134+ div56); 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 add12 is allocated at a higher memory address and div56 is allocated at a lower address Register RO R1 R2 R3 R4 R5 R6 Value High Address 1024 Low Address What will be the value of registers R0 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 followinjg * program counter link register stack pointer arguments passed to a function . return values from a function Let us consider the following function that takes six parameters. The line number is shown on the left side. Assume ARM's calling convention b) 1: int func (int il,int i2,int 13,int i4,int i5,int i6) ( int add12, mul34, div56; add12-i1 12; 41v56-15 / i6; return (add12 mul134+ div56); 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 add12 is allocated at a higher memory address and div56 is allocated at a lower address Register RO R1 R2 R3 R4 R5 R6 Value High Address 1024 Low Address What will be the value of registers R0 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

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions