diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-11-20 20:37:43 +0100 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-11-20 20:37:43 +0100 |
| commit | b9af856ae4a65e09b401cdbc7858c6cd4b1b0b5f (patch) | |
| tree | f4e4cc549570f42d9e6701b0db702bc9f81157e1 /kernel | |
| parent | e500989866e365027e3071cc82ddffa2fbb38288 (diff) | |
working on syscalls
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/kernel.c | 2 | ||||
| -rw-r--r-- | kernel/syscalls.c | 24 |
2 files changed, 17 insertions, 9 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index 6058480..d95772e 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -133,6 +133,8 @@ void kernel_main(uint32_t initial_stack, int mp) // For now this starts three "tasks" which are scheduled // round robin style. // + syscall_execve(15,0,0); + task_init(); // 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; /* |
