diff --git a/src/sys/include/ubixos/sched.h b/src/sys/include/ubixos/sched.h index 72c8b8e..b8272af 100644 --- a/src/sys/include/ubixos/sched.h +++ b/src/sys/include/ubixos/sched.h @@ -53,6 +53,8 @@ typedef struct taskStruct { pidType id; + struct taskStruct *first; + struct taskStruct *last; struct taskStruct *prev; struct taskStruct *next; struct tssStruct tss; @@ -87,6 +89,10 @@ /*** $Log$ + Revision 1.31 2005/08/05 09:43:57 fsdfs + + code clean up, performance tuning + Revision 1.30 2004/09/11 22:21:11 reddawg oInfo.cwd is now an array no longer a pointer.. diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 4a0b242..55bb663 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -89,25 +89,24 @@ /* Modify src/sys/include/ubixos/init.h to add a startup routine */ for (i=0x0;ifreePages); - kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); kprintf("Starting OS\n"); - sysTask = kmalloc(0x2000); + sysTask = kmalloc(0x2000); if(sysTask == NULL) kprintf("OS: Unable to allocate memory\n"); diff --git a/src/sys/kernel/sched.c b/src/sys/kernel/sched.c index 2a7c050..e548e25 100644 --- a/src/sys/kernel/sched.c +++ b/src/sys/kernel/sched.c @@ -41,7 +41,6 @@ #include #include #include - #include static kTask_t *taskList = 0x0; @@ -105,7 +104,16 @@ { delTask = tmpTask; tmpTask = tmpTask->next; - sched_deleteTask(delTask->id); + //sched_deleteTask(delTask->id); + + if (delTask->prev != 0x0) + delTask->prev->next = delTask->next; + if (tmpTask->next != 0x0) + delTask->next->prev = delTask->prev; + if (taskList == delTask) + taskList = delTask->next; + + sched_addDelTask(delTask); goto schedStart; } diff --git a/src/sys/kernel/spinlock.c b/src/sys/kernel/spinlock.c index cf358e2..9d9e283 100644 --- a/src/sys/kernel/spinlock.c +++ b/src/sys/kernel/spinlock.c @@ -35,6 +35,11 @@ *lock = SPIN_LOCK_INITIALIZER; } +void spinReadLock(spinLock_t *lock) +{ + *lock = 0x2; +} + void spinUnlock(spinLock_t *lock) { *lock = 0x0; @@ -51,17 +56,17 @@ void spinLock(spinLock_t *lock) { - while (!spinTryLock(lock)) - { - while (*lock == 1) +// while (!spinTryLock(lock)) +// { + while (*lock != 0) sched_yield(); - } +// } } void spinLock_scheduler(spinLock_t *lock) { - while (!spinTryLock(lock)) - while (*lock == 1); + //while (!spinTryLock(lock)) + while (*lock != 0); } diff --git a/src/sys/kernel/systemtask.c b/src/sys/kernel/systemtask.c index ff1e317..85980f1 100644 --- a/src/sys/kernel/systemtask.c +++ b/src/sys/kernel/systemtask.c @@ -46,7 +46,6 @@ uInt32 counter = 0x0; int i = 0x0; int *x = 0x0; - kTask_t *tmpTask = 0x0; if (mpi_createMbox("system") != 0x0) { kpanic("Error: Error creating mailbox: system\n"); @@ -80,7 +79,7 @@ execThread(sdeThread,(uInt32)(kmalloc(0x2000)+0x2000),0x0); } else if (!strcmp(myMsg.data,"freePage")) { - kprintf("Free Page: %i\n",systemVitals->freePages); + kprintf("Free Page(woop): %i\n",systemVitals->freePages); } else if (!strcmp(myMsg.data,"sdeStop")) { printOff = 0x0; @@ -93,16 +92,6 @@ break; } } - tmpTask = sched_getDelTask(); - if (tmpTask != 0x0) { - vmmFreeProcessPages(tmpTask->id); - - - if (tmpTask->imageFd != 0x0) - fclose(tmpTask->imageFd); - - kfree(tmpTask); - } sched_yield(); } diff --git a/src/sys/kernel/ubthread.c b/src/sys/kernel/ubthread.c index 52ce7d3..b96a52e 100644 --- a/src/sys/kernel/ubthread.c +++ b/src/sys/kernel/ubthread.c @@ -75,6 +75,7 @@ } int ubthread_create(kTask_t **thread,const uInt32 *attr,void (* tproc)(void), void *arg) { + *thread = (void *)execThread(tproc,(kmalloc(0x2000)+0x2000),arg); return(0x0); } diff --git a/src/sys/sys/device.c b/src/sys/sys/device.c index 97deebe..62feb05 100644 --- a/src/sys/sys/device.c +++ b/src/sys/sys/device.c @@ -86,6 +86,7 @@ struct device_node *tmpDev = 0x0; spinLock(&deviceSpinLock); +spinLock_scheduler(&deviceSpinLock); for (tmpDev = devices;tmpDev;tmpDev=tmpDev->next) { if ((tmpDev->devInfo->major == major) && (tmpDev->minor == minor)) { diff --git a/src/sys/vfs/file.c b/src/sys/vfs/file.c index 857f61a..2c70ea3 100644 --- a/src/sys/vfs/file.c +++ b/src/sys/vfs/file.c @@ -47,11 +47,33 @@ /* USER */ -void sysFeof(userFileDescriptor *userFd) +typedef struct fileDescriptor { + long fd; + int size; + int status; + } FILE; + +void sysFeof(FILE *fd) { + //fd->status = feof(foo->fd); return; } +/************************************************************************ + +Function: int feof(fileDescriptor *fd) +Description: Check A File Descriptor For EOF And Return Result +Notes: + +************************************************************************/ +int feof(fileDescriptor *fd) +{ + if (fd->status == fdEof) + return(-1); + return(0); +} + + void sysFwrite(char *ptr,int size,userFileDescriptor *userFd) { if (userFd == 0x0) { tty_print(ptr,_current->term); @@ -217,20 +239,6 @@ /************************************************************************ -Function: int feof(fileDescriptor *fd) -Description: Check A File Descriptor For EOF And Return Result -Notes: - -************************************************************************/ -int feof(fileDescriptor *fd) -{ - if (fd->status == fdEof) - return(-1); - return(0); -} - -/************************************************************************ - Function: int fputc(int ch,fileDescriptor *fd) Description: This Will Write Character To FD Notes: diff --git a/src/tools/Makefile b/src/tools/Makefile index 22cad05..2a52069 100644 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -38,6 +38,7 @@ format-dsk: (cp ../sys/compile/ubix.elf ./) + (cp ../bin/cat/cat ./) (cp ../bin/init/init ./) (cp ../bin/stat/stat ./) (cp ../bin/login/login ./) @@ -53,13 +54,14 @@ (cp ../bin/ld/ld.so ./) (cp /lib/libc.so.5 ./) (cp ../bin/ttyd/ttyd ./) - (./format 50 2000 ${FD_DEVICE} ubix.elf 0 login 3754 init 3754 stat 3754 ubistry 3754 shell 3754 userdb 3754 ls 3754 motd 3754 fdisk 3754 cp 3754 clock 3754 libc_old.so 3754 ld.so 3754 ttyd 3754 ) -# (./format 50 2000 ${FD_DEVICE} ubix.elf 0 login 3754 init 3754 ubistry 3754 shell 3754 userdb 3754 motd 3754 libc_old.so 3754 ld.so 3754 test 3754 libc.so.5 3754) + (./format 50 2000 ${FD_DEVICE} ubix.elf 0 login 3754 init 3754 stat 3754 ubistry 3754 shell 3754 userdb 3754 cat 3754 ls 3754 motd 3754 fdisk 3754 cp 3754 clock 3754 libc_old.so 3754 ld.so 3754 ttyd 3754 ) + #(./format 50 2000 ${FD_DEVICE} ubix.elf 0 login 3754 init 3754 ubistry 3754 shell 3754 userdb 3754 motd 3754 libc_old.so 3754 ld.so 3754 test 3754 libc.so.5 3754) #(./format 263 204361 /dev/md1 ubix.elf 0 format 3754 fdisk 3754 ROM8X14.DPF 3754 init 3754 login 3754 shell 3754 userdb 3754 ls 3754 motd 3754 cp 3754) #(./format 1064 2000 ${FD_DEVICE} shell 3754 clock 3754) #(./format 200 2000 /dev/md1 ubix.elf 0 shell 3754 motd 3754 libc_old.so 3754) (rm -fr ubix.elf) + (rm -fr cat) (rm -fr login) (rm -fr init) (rm -fr shell)