Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

help with assembly questions x86

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 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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

Students also viewed these Databases questions

Question

Stages of a Relationship?

Answered: 1 week ago