help understanding this assembly code
by Portal from LinuxQuestions.org on (#4TXVE)
I have the following assembly code:
Code:Dump of assembler code for function phase_1:
0x08048b50 <+0>: sub $0x1c,%esp
0x08048b53 <+3>: movl $0x804a2e8,0x4(%esp)
0x08048b5b <+11>: mov 0x20(%esp),%eax
0x08048b5f <+15>: mov %eax,(%esp)
0x08048b62 <+18>: call 0x804903a <strings_not_equal>
0x08048b67 <+23>: test %eax,%eax
0x08048b69 <+25>: je 0x8048b70 <phase_1+32>
0x08048b6b <+27>: call 0x80492dd <explode_bomb>
0x08048b70 <+32>: add $0x1c,%esp
0x08048b73 <+35>: retThe phase_1 function takes a string as the only input. The strings_not_equal takes two strings and compares them. Where is phase_1 getting its parameter? I don't see the edi register used everywhere... Is it using the eax register for the input string? Also, why is the stack pointer subtracted by 0x1c (28 bytes) when only four bytes of space is used in movl $0x804a2e8,0x4(%esp)? Is 0x4(%esp) used as a parameter for strings_not_equal? I am so confused...


Code:Dump of assembler code for function phase_1:
0x08048b50 <+0>: sub $0x1c,%esp
0x08048b53 <+3>: movl $0x804a2e8,0x4(%esp)
0x08048b5b <+11>: mov 0x20(%esp),%eax
0x08048b5f <+15>: mov %eax,(%esp)
0x08048b62 <+18>: call 0x804903a <strings_not_equal>
0x08048b67 <+23>: test %eax,%eax
0x08048b69 <+25>: je 0x8048b70 <phase_1+32>
0x08048b6b <+27>: call 0x80492dd <explode_bomb>
0x08048b70 <+32>: add $0x1c,%esp
0x08048b73 <+35>: retThe phase_1 function takes a string as the only input. The strings_not_equal takes two strings and compares them. Where is phase_1 getting its parameter? I don't see the edi register used everywhere... Is it using the eax register for the input string? Also, why is the stack pointer subtracted by 0x1c (28 bytes) when only four bytes of space is used in movl $0x804a2e8,0x4(%esp)? Is 0x4(%esp) used as a parameter for strings_not_equal? I am so confused...