subject

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

struct lnode {
struct lnode *next; // points to next node address

char *str; // points to 16-character string

};

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:
movslq %esi, %rsi
movslq %edi, %rdi
movslq %edx, %rax
imulq $343 %rdi, %rdi
leaq (%rsi,%rsi,2), %rdx
salq $4, %rdx
addq %rsi, %rdx
addq %rdi, %rdx
addq %rax, %rdx
leaq A(%rip), %rax
salq $4, %rdx
addq %rax, %rdx
movl $268912, %eax
movq %rcx, (%rdx)
movq %r8, 8(%rdx)
ret
Use your reverse engineering skills to determine the values of k, l and m, based on the assembly code. Show your work and the steps required to determine k, l and m on the next page as answer 2.2. You may attach additional pages as needed. Place the discovered values for k, l and m in 2.1

I know that the maximum size of the array is 268912 and since its a struct its gonna be 16.

K*l*M*16 = 268912 and if dive 268 912 will get 16807. But I really dont know how to find K, L and M.

There's no other information that I can be added..This is the full question will all of the information.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:50, brennarfa
17. implement the jvm dload instruction for the mic-2. it has a 1-byte index and pushes the local variable at this position onto the stack. then it pushes the next higher word onto the stack as well
Answers: 2
image
Computers and Technology, 22.06.2019 21:30, mjweed2456
Nathan wants to create multiple worksheet containing common formatting styles for his team members. which file extension him to save these worksheets? nathan to create multiple worksheets with common styles. he needs to save them with the extension.
Answers: 1
image
Computers and Technology, 23.06.2019 05:30, savyblue1724707
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
image
Computers and Technology, 23.06.2019 06:00, ashleyd198308
Respond to the following in three to five sentences. select the workplace skill, habit, or attitude described in this chapter that you believe is most important for being a successful employee.
Answers: 1
You know the right answer?
Consider the following source code, where k, l and m are constants declared with #define. The struct...

Questions in other subjects:

Konu
History, 16.03.2022 07:10