2 * The thunix execve system call implementaion
12 * Count how many arguments we hare
14 static inline int count(char **argv
)
24 int sys_execve(const char *file
, char **argv
)
26 int fd
= sys_open(file
, 0);
29 * The current exec plan is: load the binary file to 16M,
30 * then jump to this address.
32 * I will try to make a good global thunix memory allocation
33 * map when I get time.
35 char * exec_buf
= (char *)0x1600000;
39 int (*entry
)(int, char **);
45 * Try to read 4K at a time
47 * Note: Since we don't support demand loading now, the current exec plan is
48 * to load the whole program into
51 while ((bytes_read
= sys_read(fd
, p
, 4096)) > 0)
57 entry
= (int(*)(int, char **))(exec_buf
);
58 return entry(argc
, argv
);