I have trouble understanding why the command is used twice in sys_execve
: It is directly in ebx
, and a pointer to it is in ecx
.
%include 'commonlib.asm'
section .data
command db '/bin/echo', 0
arg1 db 'Hello world!', 0
callargs dd command ;used here
dd arg1
dd 0
environment dd 0
section .text
global _start
_start:
mov edx, environment
mov ecx, callargs
mov ebx, command ;used here
mov eax, 11
int 80h
call exit
exit
simply does sys_exit
.
I checked what it would do without each of them, but in both cases the program didn't work properly (it didn't print Hello world
.).
Is there a reason to this? Why is it supposed to be used twice?