diff options
Diffstat (limited to 'kernel/syscalls.c')
| -rw-r--r-- | kernel/syscalls.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/kernel/syscalls.c b/kernel/syscalls.c index 1de5d3a..b0a4ba1 100644 --- a/kernel/syscalls.c +++ b/kernel/syscalls.c @@ -10,7 +10,7 @@ static int preread; -static int alloc=0x600000; // TODO: implement properly sbrk!!! +static int alloc=0xa00000; // TODO: implement properly sbrk!!! int syscall_write(int file, char *buf, int len) { @@ -35,8 +35,8 @@ int syscall_read(int file, char *buf, int len) log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"read(file=%d, buf=0x%08X, len=%d)", file,buf,len); #endif - // stdin - if(file==1) + // stdin TODO: other descroptiors! + if(file==1||file!=1) { char c; @@ -74,9 +74,12 @@ int syscall_execve(char *name, char **argv, char **env) log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"execve (name=0x%08X, argvs=0x%08X, env=0x%08X)", name,argv,env); #endif + ext2_inode_content(EXT2_RAM_ADDRESS,name,0x800000,0x100000); // autorun "user-space" prog + asm("push $10");//argv TODO: addresse + asm("push $20"); //argc TODO: real number of params! asm("push $0x800000"); asm("ret"); } @@ -84,10 +87,10 @@ int syscall_execve(char *name, char **argv, char **env) int syscall_open(char *name, int flags, int len) { #ifdef LOG_SYSCALLS - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"open (name=0x%08X, flags=%d, len=%d)", name,flags,len); + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"open (name=0x%08X(\"%s\"), flags=%d, len=%d)",name, name,flags,len); #endif - return 1; + return 99; } @@ -133,14 +136,17 @@ int syscall_lseek(int file,int ptr,int dir) return preread; } -caddr_t syscall_sbrk(int incr, int none1, int none2) +uint32_t syscall_sbrk(int incr, int none1, int none2) { - #ifdef LOG_SYSCALLS - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"sbrk (incr=%d)", incr); - #endif + if(incr==0)alloc=0xa00000; // TODO: implement properly sbrk!!! int oldalloc=alloc; alloc+=incr; + + #ifdef LOG_SYSCALLS + log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"sbrk (incr=%d) = 0x%08X", incr,oldalloc); + #endif + return oldalloc; /* |
