Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Submit a pdf (filename format: HomeworkXX_lastname.pdf) to Canvas. (No ZIP or doc files accepted) (15 Points) Consider the following 5 x86-64 assembly code snippets.

Submit a pdf (filename format: HomeworkXX_lastname.pdf) to Canvas. (No ZIP or doc files accepted) (15 Points)

Submit a pdf (filename format: HomeworkXX_lastname.pdf) to Canvas. (No ZIP or doc files accepted) (15 Points) Consider the following 5 x86-64 assembly code snippets. Each of those snippets is generated by a particular version of GCC with particular settings of the command-line options. For each part: (1) Briefly explain each assembly instruction inside the snippet and its effect. (2) What is the content of the rax register (in hexadecimal) right after this entire code snippet is executed? Assume that the initial value stored in rax prior to executing each of the following code snippets is 0. (3) This assembly code snippet was part of assembly code that was generated by compiling C code with the following form: foo() { } var1 = var2 = ( ; // the numerical value assigned to var1 here must be in decimal ) varl; Assuming this is the only code inside the dummy function foo, fill in all missing parts of the C code inside this function. 1) movb $-16, -5(%rbp) movzbl -5(%rbp), %eax movl %eax, -4(%rbp) 2) movb $0x88, -3(%rbp) movsbw -3(%rbp), %ax movw %ax, -2(%rbp) 3) movw $0x7FFF, -6(%rbp) movswl -6(%rbp), %eax movl %eax, -4(%rbp) 4) movb $0x9C, -9(%rbp) movsbq -9(%rbp), %rax movq %rax, -8(%rbp) 5) movl $-2,-8(%rbp) movl -8(%rbp), %eax movl %eax, -4(%rbp)

Step by Step Solution

3.47 Rating (150 Votes )

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

Intermediate Accounting

Authors: J. David Spiceland, James Sepe, Mark Nelson, Wayne Thomas

10th edition

1260481956, 1260310175, 978-1260481952

More Books

Students also viewed these Programming questions