Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Help with assembly questions start: PUSH EBP MOV EBP, ESP MOV ECX, [EBPtarg_0] MOV ESI, [EBP+arg-4 ] MOV[EBP+var1], 0 UMP loc 2 loc 1 MOV

Help with assembly questions

image text in transcribed

start: PUSH EBP MOV EBP, ESP MOV ECX, [EBPtarg_0] MOV ESI, [EBP+arg-4 ] MOV[EBP+var1], 0 UMP loc 2 loc 1 MOV EAX, [EBP+ar 1] ADDEAX, ECX MOV EDX, byte ptr [EAX] XOREDX, ESI MOV [EAX], DL ADD [EBP+var_1], 0x1 loc 2: MOV EAX, [EBP+var 1] CMP byte ptr [ECX EAX], 0 JNZloc 1 MOV ESP, EBP POP EBP RETN 2.1)In a few sentences, explain what this function does 2.2)Write a function in C that is equivalent to the assembly above int func2(char arg_0, int arg_4) // Your code goes here 2.3) Let arg_0 be a pointer to the null-terminated string xa1 xd7 xd7 xae xff xe5 xfcle4 xa0xc5\xdblxe1" and let arg_4 be the integer 0x96 What is the value of the string pointed to by arg 0 when the function completes? What value does the function return? start: PUSH EBP MOV EBP, ESP MOV ECX, [EBPtarg_0] MOV ESI, [EBP+arg-4 ] MOV[EBP+var1], 0 UMP loc 2 loc 1 MOV EAX, [EBP+ar 1] ADDEAX, ECX MOV EDX, byte ptr [EAX] XOREDX, ESI MOV [EAX], DL ADD [EBP+var_1], 0x1 loc 2: MOV EAX, [EBP+var 1] CMP byte ptr [ECX EAX], 0 JNZloc 1 MOV ESP, EBP POP EBP RETN 2.1)In a few sentences, explain what this function does 2.2)Write a function in C that is equivalent to the assembly above int func2(char arg_0, int arg_4) // Your code goes here 2.3) Let arg_0 be a pointer to the null-terminated string xa1 xd7 xd7 xae xff xe5 xfcle4 xa0xc5\xdblxe1" and let arg_4 be the integer 0x96 What is the value of the string pointed to by arg 0 when the function completes? What value does the function return

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions