Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following assembly code includes a call to the function \"funFunc\" and the

ID: 3852669 • Letter: T

Question

The following assembly code includes a call to the function "funFunc" and the content of that same function. a. Comment each line as to what it is doing. The comment should be in plain English as shown. b. Give a description as to what the function does. Include any pertinent details. c. What is the return address of "funFunc" ___ d. On the last page, show the state of the stack inside funFunc at the point indicated. e. Indicate how many bytes are in each instruction? 004014FF push 0FFFF8000h push -32768, the 2nd parameter of "funFunc" 00401601 push 0FFFFFFFFh ____ 00401603 call funFunc _____ 00401608 add esp, 8 _____ 0040160B mov [ebp-4], ax

Explanation / Answer

Answer :

(a)

004014FF      PUSH 0FFFF8000h ; Preserving the data or value of memory location 0FFFF8000h

00401601     PUSH   0FFFFFFFFh ; Preserving the value or data of memory location 0FFFFFFFFh

00401603    CALL    funFunc          ; funFunc method is called which will return a value to the certain   

memory location here 0FFFFFFFFh

00401608    ADD    esp , 8               ; To retrieve the stack again instead of POP operation , use ADD esp,8

because stack pointer was pushed twice i.e 4 byte for each push

0040160B   MOV   [ebp-4] , ax      ; The value of register ax is moved to base pointer of stack frame by

Subtracting 4 from base pointer

(b)

funFunc has two parameter holding value of memory 0FFFF8000h , 0FFFFFFFFh respectively , does some specified work using two parameters.

Let’s take funFunc(1,2); where 0FFFFFFFF holds 1 and 0FFFF8000 holds 2

This implies as the equivalent call in assembly:

push 0FFFF8000

push 0FFFFFFFF

call funFunc

add esp, 8

(c)

Return address of funFunc is 0FFFFFFFF

(d)

On the last page , state of the stack at inside funFunc :

funFunc method is called which will return a value to the certain memory location here 0FFFFFFFFh having two parameters holding value of memory location 0FFFF8000h , 0FFFFFFFFh respectively , does some specified work using two parameters. After that instead of POP operation , doing ADD esp,8 to retrieve the stack again.

(e)

Each instruction has 4 bytes each.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote