diff options
Diffstat (limited to 'kernel/syscalls.c')
| -rw-r--r-- | kernel/syscalls.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/kernel/syscalls.c b/kernel/syscalls.c index aa27ed8..23c88a7 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -391,6 +391,8 @@ int copy_args(char **in, char **out) // int execve(const char *filename, char *const argv[], char *const envp[]); int syscall_execve(const char *name, char *const argv[], char *const env[], int pid) { + uint32_t alloc; + uint32_t entry_global=load_elf(name,&alloc); fixme("not overwrite yourself?"); int arg_count=0; @@ -404,9 +406,6 @@ int syscall_execve(const char *name, char *const argv[], char *const env[], int if(env!=NULL)copy_args(env,env1); else env1=NULL; - uint32_t alloc; - uint32_t entry_global=load_elf(name,&alloc); - if(!entry_global){ set_errno(ENOENT); return -1; @@ -416,8 +415,8 @@ int syscall_execve(const char *name, char *const argv[], char *const env[], int *--stack=argv1; *--stack=arg_count; *--stack=env1; - task_reset(pid,entry_global,stack,alloc); task_set_name(pid,name); + task_reset(pid,entry_global,stack,alloc); return 0; } @@ -618,14 +617,17 @@ uint32_t syscall_gui_win(uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid) uint32_t fdn=nextfd(pid); fds[pid][fdn]=fd_from_ringbuffer(); tty[pid]=fdn; - invl[pid]=ringbuffer_init(4); + invl[pid]=ringbuffer_init(1); task_add_win(pid,&invl[pid]); return 1; } -/** Generics */ +/** Generics . prep before we reenable interrupts*/ uint32_t syscall_generic_prep(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid) { +#ifdef LOG_SYSCALLS + klog("prep syscall [%s] for pid:%d",syscall_get_name(nr),pid); +#endif struct timeval *tv=p2; switch(nr){ @@ -647,9 +649,12 @@ uint32_t syscall_generic_prep(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, return 1; } -/** Generics */ -uint32_t syscall_generic_test(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid) +/** Generics. test if we can continue.. reschedule otherwise */ +volatile uint32_t syscall_generic_test(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid) { +#ifdef LOG_SYSCALLS + klog("testing syscall [%s] for pid:%d",syscall_get_name(nr),pid); +#endif switch(nr){ case SYSCALL_WAIT : return !task_runs(p1); @@ -664,7 +669,7 @@ uint32_t syscall_generic_test(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, return 1;//other syscalls never block for now. } -/** Generics */ +/** Generics. finally do the work! */ uint32_t syscall_generic(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid) { |
