diff --git a/src/sys/include/sys/gen_calls.h b/src/sys/include/sys/gen_calls.h index 035c5ab..0dc7a7e 100644 --- a/src/sys/include/sys/gen_calls.h +++ b/src/sys/include/sys/gen_calls.h @@ -30,13 +30,11 @@ #ifndef _GEN_CALLS_H #define _GEN_CALLS_H +#include #include -struct thread { - int a; - }; - int sys_write(struct thread *, struct write_args *); +int getpid(struct thread *, struct getpid_args *); #endif diff --git a/src/sys/include/sys/sysproto.h b/src/sys/include/sys/sysproto.h index fa7717a..abb36b4 100644 --- a/src/sys/include/sys/sysproto.h +++ b/src/sys/include/sys/sysproto.h @@ -50,6 +50,20 @@ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; }; +struct sysctl_args { + char name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)]; + char namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)]; + char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)]; + char oldlenp_l_[PADL_(size_t *)]; size_t * oldlenp; char oldlenp_r_[PADR_(size_t *)]; + char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)]; + char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)]; +}; + +struct getpid_args { + register_t dummy; +}; + + #endif diff --git a/src/sys/include/ubixos/sched.h b/src/sys/include/ubixos/sched.h index 5d44472..4ed9beb 100644 --- a/src/sys/include/ubixos/sched.h +++ b/src/sys/include/ubixos/sched.h @@ -35,6 +35,7 @@ #include #include #include +#include typedef enum { PLACEHOLDER=-2,DEAD=-1,NEW=0,READY=1,RUNNING=2,IDLE=3,FORK=4,WAIT=5 } tState; @@ -63,6 +64,7 @@ uInt32 uid; uInt16 usedMath; tty_term *term; + struct thread td; } kTask_t; @@ -86,6 +88,9 @@ /*** $Log$ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + Revision 1.2 2005/10/12 00:13:37 reddawg Removed diff --git a/src/sys/include/ubixos/syscalls_new.h b/src/sys/include/ubixos/syscalls_new.h index cb491d0..569b446 100644 --- a/src/sys/include/ubixos/syscalls_new.h +++ b/src/sys/include/ubixos/syscalls_new.h @@ -31,13 +31,15 @@ #define _SYSCALLS_NEW_H #include + #define invalid_call 0x0 functionPTR systemCalls_new[] = { - sysExit, /** 1 **/ - invalid_call, /** 2 **/ - invalid_call, /** 3 **/ - sys_write, /** 4 **/ + invalid_call, /** 0 **/ + sysExit, /** 1 **/ + invalid_call, /** 2 **/ + invalid_call, /** 3 **/ + sys_write, /** 4 **/ invalid_call, /** 5 **/ invalid_call, /** 6 **/ invalid_call, /** 7 **/ @@ -53,7 +55,7 @@ invalid_call, /** 17 **/ invalid_call, /** 18 **/ invalid_call, /** 19 **/ - invalid_call, /** 20 **/ + getpid, /** 20 **/ invalid_call, /** 21 **/ invalid_call, /** 22 **/ invalid_call, /** 23 **/ @@ -235,7 +237,7 @@ invalid_call, /** 199 **/ invalid_call, /** 200 **/ invalid_call, /** 201 **/ - invalid_call, /** 202 **/ + __sysctl, /** 202 **/ invalid_call, /** 203 **/ invalid_call, /** 204 **/ invalid_call, /** 205 **/ diff --git a/src/sys/kernel/Makefile b/src/sys/kernel/Makefile index 275d579..aa6e2cc 100644 --- a/src/sys/kernel/Makefile +++ b/src/sys/kernel/Makefile @@ -6,7 +6,7 @@ include ../Makefile.inc # Objects -OBJS = gen_calls.o schedyield.o tty.o sys_call_new.o sys_call.o endtask.o spinlock.o bioscall.o ld.o time.o fork.o syscall.o elf.o systemtask.o exec.o sched.o kpanic.o vitals.o ubthread.o timer.o +OBJS = kernsysctl.o gen_calls.o schedyield.o tty.o sys_call_new.o sys_call.o endtask.o spinlock.o bioscall.o ld.o time.o fork.o syscall.o elf.o systemtask.o exec.o sched.o kpanic.o vitals.o ubthread.o timer.o # ap-boot.o smp.o all: $(OBJS) diff --git a/src/sys/kernel/gen_calls.c b/src/sys/kernel/gen_calls.c index 97422dd..cc74fae 100644 --- a/src/sys/kernel/gen_calls.c +++ b/src/sys/kernel/gen_calls.c @@ -28,12 +28,25 @@ *****************************************************************************************/ #include +#include #include +#include #include #include +int getpid(struct thread *td, struct getpid_args *uap) { + td->td_retval[0] = _current->id; + return (0); + } + + int sys_write(struct thread *td, struct write_args *uap) { - kprintf("%s",uap->buf); + if (uap->fd == 2) { + kprintf("stderr: %s",uap->buf); + } + else { + kprintf("(%i) %s",uap->fd,uap->buf); + } return(0x0); } diff --git a/src/sys/kernel/sys_call_new.S b/src/sys/kernel/sys_call_new.S index 5066a6a..7bf7c34 100644 --- a/src/sys/kernel/sys_call_new.S +++ b/src/sys/kernel/sys_call_new.S @@ -40,13 +40,10 @@ pushl %es pushl %fs /* switch to kernel segments */ - /* - movl $KDSEL,%eax + movl $0x10,%eax movl %eax,%ds movl %eax,%es - movl $KPSEL,%eax movl %eax,%fs - */ //FAKE_MCOUNT(TF_EIP(%esp)) call syscall //MEXITCOUNT diff --git a/src/sys/kernel/syscall.c b/src/sys/kernel/syscall.c index 778cd54..2c34089 100644 --- a/src/sys/kernel/syscall.c +++ b/src/sys/kernel/syscall.c @@ -29,7 +29,6 @@ #include #include -#include #include #include #include @@ -38,14 +37,16 @@ #include #include #include +#include #include #include #include #include #include #include -//#include +/* #include */ #include +#include typedef char * caddr_t; @@ -252,19 +253,22 @@ void syscall(struct trapframe frame) { caddr_t params; - struct thread *td = 0x0; + struct thread *td = &_current->td; int args[8]; if (frame.tf_eax > totalCalls_new) { kprintf("Invalid Call: [%i]\n",frame.tf_eax); } - else if (systemCalls_new[frame.tf_eax] == 0x0) { - kprintf("Invalid Call: [%i]\n",frame.tf_eax); + else if ((uInt32)systemCalls_new[frame.tf_eax] == 0x0) { + kprintf("Invalid Call: [%i][0x%X]\n",frame.tf_eax,(uInt32)systemCalls_new[frame.tf_eax]); + td->td_retval[0] = -1; } else { params = (caddr_t)frame.tf_esp + sizeof(int); //copyin(params, (caddr_t)args, (u_int)(8 * sizeof(int))); memcpy(args,params,8); systemCalls_new[frame.tf_eax](td,args); + frame.tf_eax = td->td_retval[0]; + frame.tf_edx = td->td_retval[1]; } }