Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The C code given below produces the following x86 assembly. Draw the stack frames for each of the following, showing the relevant stack contents

image text in transcribed

1. The C code given below produces the following x86 assembly. Draw the stack frames for each of the following, showing the relevant stack contents and the addresses (Do not run gdb. Just study the assembled code and write the addresses in relation to ebp, for example, ebp, ebp -4, etc.) a) Stack frame of main at calll_f b) Stack frame of function f at calllg c) Stack frame of function g after movi-41%ebp), %eax int gCint x) return x+3; int fCint x) return g(x);j int mainO return f(8);] pushl %ebp movl %esp, %ebp pushl %eax movi 80%ebp), %eax movl %eax,-4(%ebp) movl -4(%ebp), %eax addi S3,%eax addl S4, %esp popl %ebp retl pushl %ebp movl %esp, %ebp subi S8,%esp movl 80%ebp),%eax movl %eax,-4(%ebp) movl -4(%ebp), %eax movi Sieax, (%esp) calll g addl $8, %esp popl %ebp retl pushl %ebp movl %esp, %ebp subi S24, %esp movl $8,%eax movi $0.-4(%ebp) movi s8,(%esp) movi Sieax,-84%ebp) calll f addi s24, %esp popl %ebp retl 1. The C code given below produces the following x86 assembly. Draw the stack frames for each of the following, showing the relevant stack contents and the addresses (Do not run gdb. Just study the assembled code and write the addresses in relation to ebp, for example, ebp, ebp -4, etc.) a) Stack frame of main at calll_f b) Stack frame of function f at calllg c) Stack frame of function g after movi-41%ebp), %eax int gCint x) return x+3; int fCint x) return g(x);j int mainO return f(8);] pushl %ebp movl %esp, %ebp pushl %eax movi 80%ebp), %eax movl %eax,-4(%ebp) movl -4(%ebp), %eax addi S3,%eax addl S4, %esp popl %ebp retl pushl %ebp movl %esp, %ebp subi S8,%esp movl 80%ebp),%eax movl %eax,-4(%ebp) movl -4(%ebp), %eax movi Sieax, (%esp) calll g addl $8, %esp popl %ebp retl pushl %ebp movl %esp, %ebp subi S24, %esp movl $8,%eax movi $0.-4(%ebp) movi s8,(%esp) movi Sieax,-84%ebp) calll f addi s24, %esp popl %ebp retl

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

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions

Question

=+1. How does or how might the key public affect your organization?

Answered: 1 week ago

Question

Supply the missing reagents

Answered: 1 week ago

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago

Question

4. Explain the strengths and weaknesses of each approach.

Answered: 1 week ago