Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with assembly x86 questions start PUSH EBP MOV EBP, ESP MOV EDX, [EBPtarg_0] MOV ESI, [EBPtarg_4] MOV EDI, 0x1A XOREAX, EAX loc 1: MOV

Help with assembly x86 questions

image text in transcribed

start PUSH EBP MOV EBP, ESP MOV EDX, [EBPtarg_0] MOV ESI, [EBPtarg_4] MOV EDI, 0x1A XOREAX, EAX loc 1: MOV ECX, byte ptz [EDX] MOV EBX, byte ptr ESI] SUB ECX, EBX SUB ECX, EAX MOV[EDX], cx SHR ECX, 0x10 AND ECX, 0x1 MOV EAX, ECX INC EDX INC ESI DEC EDI TEST EDI, EDI JNZ loc 1 loc2 : XOREAX, EAX MOV ESP, EBP POP EBP RETN 3.1) In a few sentences, explain what this function does 3.2) Write a function in C that is equivalent to the assembly above int func3(char* arg_0, char* arg_4) // Your code goes here 3.3) Let arg_0 be a pointer to the null-terminated string d1\xe2\xd1lxcf\xd1lx0a" and let arg-4 be a pointer to the null-terminated string "gwertyuiopasdfghiklzxcvbnm". What is the value of the string pointed to by arg_0 when the function completes? start PUSH EBP MOV EBP, ESP MOV EDX, [EBPtarg_0] MOV ESI, [EBPtarg_4] MOV EDI, 0x1A XOREAX, EAX loc 1: MOV ECX, byte ptz [EDX] MOV EBX, byte ptr ESI] SUB ECX, EBX SUB ECX, EAX MOV[EDX], cx SHR ECX, 0x10 AND ECX, 0x1 MOV EAX, ECX INC EDX INC ESI DEC EDI TEST EDI, EDI JNZ loc 1 loc2 : XOREAX, EAX MOV ESP, EBP POP EBP RETN 3.1) In a few sentences, explain what this function does 3.2) Write a function in C that is equivalent to the assembly above int func3(char* arg_0, char* arg_4) // Your code goes here 3.3) Let arg_0 be a pointer to the null-terminated string d1\xe2\xd1lxcf\xd1lx0a" and let arg-4 be a pointer to the null-terminated string "gwertyuiopasdfghiklzxcvbnm". What is the value of the string pointed to by arg_0 when the function completes

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 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

tAllows use of aggregation expressions within the query language.

Answered: 1 week ago