Where would arguments of stdin which were read into two variables string1 and st
ID: 652642 • Letter: W
Question
Where would arguments of stdin which were read into two variables string1 and string2 (which were read in by C main function) be stored in x86 if i was calling a x86 function to compare them. On top the my c file i have
extern int stringgt(char *s1, char *s2);
then i have the main which reads in two strings from stdin and stores them into string 1 and string 2 then i set int val = stringgt(str, str1) so i pass in into x86 now my question is how do i store those two arguments in variables in x86 using stacks what i have so far in my x86 is
SECTION .data
SECTION .bss
global stringgt
SECTION .text
stringgt:
push ebp
move ebp, esp
push eax
push ebx
Now i have no idea what if what im doing above is close to right but if someone
could tell me where the arguments/two strings are stored in x86 or if im even storing them?
Thank You
Explanation / Answer
extern int stringgt(char *s1, char *s2)
{
........
//.....some code
}
push s1 ;
push s2 ;
call stringggt;
push ebp ;
mov ebp, esp ;
sub esp, 4 ;
// ...some code
add esp, 4 ;
mov esp, ebp ;
pop eb
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.