;================================================================================= ; sys_execve demonstration. ; ; Simply executes "./waitpid" while passing "foo" as argument. ; ; The LSCR Project. ;================================================================================= format ELF include '../macros.inc' include '../../include/symbols.inc' include '../../include/structs.inc' extrn error_chk section '.text' executable public _start _start: mov eax, SYS_EXECVE mov ebx, filename mov ecx, argument_ptrs xor edx, edx int 0x80 ; if sys_execve succeeds it doesn't return ccall error_chk, <"SYS_EXECVE has failed: ">, exit ; so if we came here, it has failed. exit: mov eax, SYS_EXIT xor ebx, ebx int 0x80 section '.data' writeable filename db "./waitpid",0 argument_ptrs dd argument0, argument1, 0 argument0 db "./execve",0 argument1 db "foo",0