Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following source code, where k,l and m are constants declared with #define. The struct lnode is as defined as: struct lnode { char

Consider the following source code, where k,l and m are constants declared with #define. The struct lnode is as defined as:

struct lnode { char *str; // points to 32-character string struct lnode *next; // points to next node address struct lnode *prev; // points to prev node address };

You will need to determine the values for k, l and m, which are the dimensions of a 3-D array named A.

struct lnode A[k][l][m]; int store_ele(int h, int i, int j, struct lnode dest) { A[h][i][j] = dest; return sizeof(A); }

On compiling this program (with gcc -O2 -S -fno-asynchronous-unwind-tables) ,gcc generates the following assembly code for the store_ele function:

store_ele: endbr64 movslq %edi, %rdi movslq %edx, %rdx movslq %esi, %rsi movdqu 8(%rsp), %xmm0 movq %rdi, %rax leaq (%rdx,%rdx,2), %rdx salq $6, %rax subq %rdi, %rax salq $4, %rax leaq (%rax,%rdx,8), %rax leaq (%rsi,%rsi,4), %rdx leaq (%rsi,%rdx,4), %rdx leaq (%rax,%rdx,8), %rdx leaq A(%rip), %rax addq %rdx, %rax movq 24(%rsp), %rdx movups %xmm0, (%rax) movq %rdx, 16(%rax) movl $15120, %eax ret

Use your reverse engineering skills to determine the values of k,l and m, based on the assembly code. (Hint: The movdqu and movups instructions are dealing with the updating of the array element, not determining the location of the element being updated) Show your work for finding out these values in (HW6-show your work, worth 20 points)

1.k

2.l

3.m

4.upload your work for determining k, l, m

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago