Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following source code, where R, S, and T are constants declared with #define: Long A[R][S][T]; long store_ele(long I, long j, long k, long

image text in transcribed

Consider the following source code, where R, S, and T are constants declared with #define: Long A[R][S][T]; long store_ele(long I, long j, long k, long *dest) { *dest = A[R][S][T]; return sizeof(A); } In compiling this program, GCC generates the following assembly code: long store_ele(long I, long j, long k, long *dest) store_ele: leaq (%rsi, %rsi, 2), %rax leaq (%rsi, %rsi, 4), %rax movq %rdi, %rsi salq dollar6, %rsi addq %rsi, %rdi addq %rax, %rdi addq %rdi, %rdx movq A(,%rdx, 8), %rax movq %rax, (%rcx) mov1 dollar3640, %eax ret Extend Equation 3.1 from two dimensions to three to provide a formula for the location of array element A[i][j][k]. Use your reverse engineering skills to determine the values of R, S, and T based on the assembly code. Consider the following source code, where R, S, and T are constants declared with #define: Long A[R][S][T]; long store_ele(long I, long j, long k, long *dest) { *dest = A[R][S][T]; return sizeof(A); } In compiling this program, GCC generates the following assembly code: long store_ele(long I, long j, long k, long *dest) store_ele: leaq (%rsi, %rsi, 2), %rax leaq (%rsi, %rsi, 4), %rax movq %rdi, %rsi salq dollar6, %rsi addq %rsi, %rdi addq %rax, %rdi addq %rdi, %rdx movq A(,%rdx, 8), %rax movq %rax, (%rcx) mov1 dollar3640, %eax ret Extend Equation 3.1 from two dimensions to three to provide a formula for the location of array element A[i][j][k]. Use your reverse engineering skills to determine the values of R, S, and T based on the assembly code

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions