From e7b9569041521da7e0b67c30af7179c0af1e3738 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Thu, 27 Nov 2014 01:44:25 +0100 Subject: struggling with new multitasking --- kernel/syscalls.c | 88 +++++++------------------------------------------------ 1 file changed, 11 insertions(+), 77 deletions(-) (limited to 'kernel/syscalls.c') diff --git a/kernel/syscalls.c b/kernel/syscalls.c index 765316b..585950d 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -72,7 +72,7 @@ typedef struct { } Elf32_Phdr; -static uint32_t alloc=0x900000; +static uint32_t alloc; int syscall_unhandled(int nr) { @@ -102,10 +102,9 @@ int syscall_write(int file, char *buf, int len) if(file!=1&&file!=2) panic(FOOLOS_MODULE_NAME,"unhandled syscall"); - // ALL output to stdout + //stderr and stdout go to console for(int i=0;ie_phnum;phidx++) { @@ -372,7 +307,6 @@ int syscall_execve(char *name, char **argv, char **env) asm("ret"); // this is never reached! - } @@ -413,16 +347,13 @@ int syscall_isatty(int file,int none1,int none2) uint32_t syscall_sbrk(int incr, int none1, int none2) { - uint32_t oldalloc=alloc; alloc+=incr; #ifdef LOG_SYSCALLS log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"sbrk (incr=%d) = 0x%08X", incr,oldalloc); #endif - return oldalloc; - } @@ -432,6 +363,9 @@ int syscall_exit(int ret, char **env, int none2) log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"exit (ret=%d) (env=0x%08X)", ret, env); #endif + panic(FOOLOS_MODULE_NAME,"exit not supported yet" ); + + /* int i=0; while(env[i]!=NULL) { @@ -442,11 +376,11 @@ int syscall_exit(int ret, char **env, int none2) asm("mov $0x05bff,%esp"); // set stack pointer static char *argv[]={"shell","--silent",NULL}; syscall_execve("/bin/foolshell",argv,env); // start shell + */ } // stat, fstat, lstat - int syscall_stat(const char *path, struct stat *st,int none) { #ifdef LOG_SYSCALLS -- cgit v1.2.3