6 /* 32-bit syscall numbers */
12 #define __NR_waitpid 7
13 #define __NR_execve 11
15 /* 32-bit system call conventions
27 int FD, bytes_written, status, exec_ret;
28 int flags = O_RDWR|O_CREAT;
29 int mode = S_IRUSR|S_IWUSR|S_IXUSR;
35 #include "generated.h"
38 /* open("FILENAME, O_RDWR | O_CREAT, */
39 asm volatile ("pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
41 : "0" (__NR_open), "r" (FILE_NAME), "c" (flags), "d" (mode));
47 /* write(FD, INJECT_FILE, FILE_LENGTH) */
48 asm volatile ("pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
49 : "=a" (bytes_written)
50 : "0" (__NR_write), "r" (FD), "c" (inject_file), "d" (FILE_LENGTH));
57 asm volatile ("pushl %%ebx; movl %1,%%ebx; int $0x80; popl %%ebx"
58 : : "a" (__NR_close), "r" (FD));
64 asm volatile ("int $0x80" : "=a" (pid) : "0" (__NR_fork));
72 /* ret = waitpid(pid, &status, 0) */
73 asm volatile ("pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
75 : "0" (__NR_waitpid), "r" (pid), "c" (&status), "d" (0));
81 /* execve("command", "arg0" , ..., "argN" , env) */
82 asm volatile ("pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
84 : "0" (__NR_execve), "r" (CMD), "c" (args), "d" (env));
88 asm volatile ("pushl %%ebx; movl %1,%%ebx; int $0x80; popl %%ebx"
89 : : "a" (__NR_exit), "r" (127));
94 /* hypercall(f001) <=> exit(0) */
95 asm volatile ("movl $0xf001, %eax");
96 asm volatile ("vmmcall");
98 asm volatile ("pushl %%ebx; movl %1,%%ebx; int $0x80; popl %%ebx"
99 : : "a" (__NR_exit), "r" (1));