Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following code gives an example of a C program that calls a func void adder(int a, int *b) *b = a + *b;} void

image text in transcribed
image text in transcribed
image text in transcribed
The following code gives an example of a C program that calls a func void adder(int a, int *b) *b = a + *b;} void main (void) int x = 3, y = 4; adder(x, &y); This 68000 program creates the following output from a compiler. The pa of the instructions that are not obvious. *1 void adder (int a, int *b) Parameter a is at 8 (FP) Parameter b is at 10 (FP) adder LINK FP, #0 +2 { *3 *b = a + *b; *2 { *3 *b = a + *b; NOVEA.L 10 (FP), A4 MOVE (A4), D1 ADD MOVE } 8(FP), D1 D1, (A4) *4 *6 void main(void) Variable x is at -2 (FP) Variable y is at -4 (FP) main LINK FP,#-4 +7 { *8 int x = 3, y = 4; MOVE #3,-2 (FP) MOVE #4,-4 (FP) *9 adder (x, &y); PEA 4 (FP) MOVE #3,- (A7) JSR adder * 10 * 11 } UNLK FP RTS Draw the state of the stack immediately after function adder is called in function main (ie, the return address is on the top of the stack but no code in adder has yet been executed), Carefully label all items on the stack and give their location with respect to the current value of the frame pointer. Draw a sequence of diagrams (ie, memory maps) showing what happens to the stack as function adder is executed. Explain the action of each instruction that modifies the state of the stack. Show how parameters are passed to and from the function and how stack-based values are accessed

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

List the ways that perception is an active mental process.

Answered: 1 week ago

Question

What are the purposes of collection messages? (Objective 5)

Answered: 1 week ago