diff --git a/src/bin/clock/Makefile b/src/bin/clock/Makefile index d123621..4c30541 100644 --- a/src/bin/clock/Makefile +++ b/src/bin/clock/Makefile @@ -25,7 +25,7 @@ # Link The Binary $(BINARY) : $(OBJS) $(CC) $(CFLAGS) -o $@ $(STARTUP) $(LIBRARIES) $(OBJS) - strip $(BINARY) +# strip $(BINARY) # Compile the source files .cpp.o: diff --git a/src/lib/ubix/startup.S b/src/lib/ubix/startup.S index 7888e7f..6bbe8f8 100644 --- a/src/lib/ubix/startup.S +++ b/src/lib/ubix/startup.S @@ -41,11 +41,15 @@ call main push %eax call exit +.data __progname: .long 0 /*** $Log$ + Revision 1.2 2004/06/18 14:15:47 reddawg + This may hopefully remove some segfault issues that we experience. + Revision 1.1 2004/06/18 13:21:34 reddawg Making this more compiler safe diff --git a/src/sys/include/ubixos/sched.h b/src/sys/include/ubixos/sched.h index 1c92c9f..779c0a9 100644 --- a/src/sys/include/ubixos/sched.h +++ b/src/sys/include/ubixos/sched.h @@ -41,7 +41,7 @@ #include -typedef enum { PLACEHOLDER=-2,DEAD=-1,NEW=0,READY=1,RUNNING=2,IDLE=3,FORK=4 } tState; +typedef enum { PLACEHOLDER=-2,DEAD=-1,NEW=0,READY=1,RUNNING=2,IDLE=3,FORK=4,WAIT=5 } tState; struct osInfo { uInt8 timer; @@ -102,6 +102,9 @@ /*** $Log$ + Revision 1.19 2004/08/06 22:43:04 reddawg + ok + Revision 1.18 2004/08/06 22:32:16 reddawg Ubix Works Again diff --git a/src/sys/include/ubixos/tty.h b/src/sys/include/ubixos/tty.h index 2ea2255..d2f2e97 100644 --- a/src/sys/include/ubixos/tty.h +++ b/src/sys/include/ubixos/tty.h @@ -40,6 +40,7 @@ uInt8 tty_colour; uInt16 tty_x; uInt16 tty_y; + pidType owner; } tty_term; int tty_init(); @@ -53,6 +54,9 @@ /*** $Log$ + Revision 1.5 2004/08/09 05:40:31 reddawg + tty: removed current and made a foreground + Revision 1.4 2004/08/06 22:32:16 reddawg Ubix Works Again diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 11712c7..250dfbd 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -104,9 +104,9 @@ */ execThread(systemTask,(uInt32)(kmalloc(0x2000)+0x2000),0x0); - execFile("sys:/init",0x0,0x0,0x0); + //execFile("sys:/init",0x0,0x0,0x0); + execFile("sys:/login",0x0,0x0,0x1); - execFile("sys:/login",0x0,0x0,0x2); execFile("sys:/login",0x0,0x0,0x3); execFile("sys:/login",0x0,0x0,0x4); @@ -121,6 +121,9 @@ /*** $Log$ + Revision 1.69 2004/08/06 22:43:04 reddawg + ok + Revision 1.68 2004/08/04 08:17:57 reddawg tty: we have primative ttys try f1-f5 so it is easier to use and debug ubixos diff --git a/src/sys/isa/atkbd.c b/src/sys/isa/atkbd.c index f15b737..bbe59e1 100644 --- a/src/sys/isa/atkbd.c +++ b/src/sys/isa/atkbd.c @@ -288,7 +288,10 @@ uInt8 retKey = 0x0; uInt32 i = 0x0; - while (stdinSize == 0); + if (stdinSize == 0x0) + return(0x0); + //while (stdinSize == 0); + retKey = stdinBuffer[0]; stdinSize--; @@ -301,6 +304,9 @@ /*** $Log$ + Revision 1.21 2004/08/06 22:32:16 reddawg + Ubix Works Again + Revision 1.19 2004/08/03 18:31:19 reddawg virtual terms diff --git a/src/sys/kernel/endtask.c b/src/sys/kernel/endtask.c index 963d975..91d8662 100644 --- a/src/sys/kernel/endtask.c +++ b/src/sys/kernel/endtask.c @@ -49,11 +49,18 @@ //kprintf("FreePage: [0x%X]\n",systemVitals->freePages); sched_setStatus(_current->id,DEAD); sched_yield(); + + /* incase sched_yield failes */ + while (1) + asm("hlt"); return; } /*** $Log$ + Revision 1.15 2004/08/06 22:43:04 reddawg + ok + Revision 1.14 2004/08/06 22:32:16 reddawg Ubix Works Again diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 47748ef..6115213 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -142,6 +142,9 @@ _current->term = tty_find(console); if (_current->term == 0x0) kpanic("Error: invalid console\n"); + + /* Set tty ownership */ + _current->term->owner = _current->id; /* Now We Must Create A Virtual Space For This Proccess To Run In */ _current->tss.cr3 = (uInt32)vmmCreateVirtualSpace(_current->id); @@ -420,6 +423,9 @@ /*** $Log$ + Revision 1.60 2004/08/06 22:32:16 reddawg + Ubix Works Again + Revision 1.58 2004/08/04 08:17:57 reddawg tty: we have primative ttys try f1-f5 so it is easier to use and debug ubixos diff --git a/src/sys/kernel/file.c b/src/sys/kernel/file.c index 2ab131b..8a15403 100644 --- a/src/sys/kernel/file.c +++ b/src/sys/kernel/file.c @@ -207,17 +207,27 @@ void sysFgetc(int *ptr,userFileDescriptor *userFd) { fileDescriptor *tmpFd = 0x0; - asm("sti"); tmpFd = userFd->fd; if (userFd->fd == 0x0) { - /* - while (_current->term->current == 0x0) - schedYield(); - */ - if (_current->term != tty_foreground) - ptr[0] = '\0'; - else - ptr[0] = (int) getch(); + while (1) { + if (_current->term == tty_foreground) { + if ((*ptr = getch()) != 0x0) + return; + sched_yield(); + } + else { + sched_yield(); + } + /* + else { + kprintf("Waking Task: %i\n",tty_foreground->owner); + sched_setStatus(tty_foreground->owner,READY); + kprintf("Sleeping Task: %i\n",_current->id); + sched_setStatus(_current->id,WAIT); + sched_yield(); + } +*/ + } } else { ptr[0] = (int) fgetc(tmpFd); @@ -280,6 +290,9 @@ /*** $Log$ + Revision 1.14 2004/08/09 05:40:31 reddawg + tty: removed current and made a foreground + Revision 1.13 2004/08/06 22:32:16 reddawg Ubix Works Again diff --git a/src/sys/kernel/fork.c b/src/sys/kernel/fork.c index 7420fa5..2e027c7 100644 --- a/src/sys/kernel/fork.c +++ b/src/sys/kernel/fork.c @@ -74,6 +74,7 @@ sprintf(newProcess->oInfo.cwd,_current->oInfo.cwd); newProcess->oInfo.vmStart = _current->oInfo.vmStart; newProcess->term = _current->term; + newProcess->term->owner = newProcess->id; newProcess->uid = _current->uid; newProcess->gid = _current->gid; newProcess->tss.back_link = 0x0; @@ -113,6 +114,9 @@ /*** $Log$ + Revision 1.21 2004/08/06 22:32:16 reddawg + Ubix Works Again + Revision 1.19 2004/08/04 08:17:57 reddawg tty: we have primative ttys try f1-f5 so it is easier to use and debug ubixos diff --git a/src/sys/kernel/sched.c b/src/sys/kernel/sched.c index 7aceeb4..2103fca 100644 --- a/src/sys/kernel/sched.c +++ b/src/sys/kernel/sched.c @@ -296,7 +296,8 @@ void sched_yield() { - sched(); + asm("hlt"); + //sched(); } /* @@ -327,6 +328,9 @@ /*** $Log$ + Revision 1.29 2004/08/06 22:43:04 reddawg + ok + Revision 1.28 2004/08/06 22:32:16 reddawg Ubix Works Again diff --git a/src/sys/kernel/tty.c b/src/sys/kernel/tty.c index 95c9b60..7442db3 100644 --- a/src/sys/kernel/tty.c +++ b/src/sys/kernel/tty.c @@ -91,11 +91,10 @@ Set the tty_pointer to the internal buffer so I can continue writing to what it believes is the screen */ - tty_foreground->tty_point = tty_foreground->tty_buffer; + tty_foreground->tty_pointer = tty_foreground->tty_buffer; terms[tty].tty_pointer = (char *)0xB8000; - terms[tty].current = 0x1; /* set new foreground tty */ tty_foreground = &terms[tty]; @@ -153,6 +152,9 @@ /*** $Log$ + Revision 1.5 2004/08/09 05:40:31 reddawg + tty: removed current and made a foreground + Revision 1.4 2004/08/06 22:32:16 reddawg Ubix Works Again diff --git a/src/sys/ubixfs/dirCache.c b/src/sys/ubixfs/dirCache.c index 6d9b790..bba6d4e 100644 --- a/src/sys/ubixfs/dirCache.c +++ b/src/sys/ubixfs/dirCache.c @@ -34,12 +34,17 @@ #include #include +#include + +static spinLock_t dca_spinLock = SPIN_LOCK_INITIALIZER; + static struct directoryEntry * ubixfs_findName(struct directoryEntry * dirList, uInt32 size, char * name) { unsigned int i; if (dirList == NULL || name == NULL) return NULL; + kprintf("dirList: [0x%X],name: [0x%X]\n",dirList,name); for (i = 0; i < (size / sizeof(struct directoryEntry)) ; i++) { if (strcmp(dirList[i].fileName, name) == 0) return &dirList[i]; } /* for */ @@ -57,6 +62,8 @@ assert(name); assert(head); assert(*name); + spinLock(&dca_spinLock); + spinUnlock(&dca_spinLock); if (name == NULL || head == NULL) return NULL; if (*name == '\0') return NULL; @@ -87,7 +94,7 @@ /* kprintf("nextdir: %s -- dirName: %s\n", nextDir, dirName); */ if (*nextDir != '\0') { while (tmp != NULL) { - + kprintf("tmp->name: [0x%X],dirName: [0x%X]\n",tmp->name,dirName); if (strcmp(tmp->name, dirName) == 0) { if ((*tmp->attributes & typeFile) == typeFile @@ -123,7 +130,9 @@ while (tmp != NULL) { assert(tmp->name); + assert(name); /* don't forget to check to see if it's a directory */ + kprintf("tmpName: [0x%X], name: [0x%X]\n",tmp->name,name); if (strcmp(tmp->name, name) == 0) { /* @@ -193,7 +202,7 @@ ubixfs_cacheDelete(struct cacheNode ** head) { struct cacheNode * tmp = NULL; struct cacheNode * del = NULL; - + if (head == NULL) return; if (*head == NULL) return; @@ -232,8 +241,9 @@ struct cacheNode * ubixfs_cacheAdd(struct cacheNode *node, struct cacheNode * newNode) { struct cacheNode * tmp; - + assert(node); + spinLock(&dca_spinLock); newNode->parent = node; newNode->next = node->fileListHead; newNode->prev = NULL; @@ -244,11 +254,15 @@ node->fileListHead = newNode; tmp = node->fileListHead; + spinUnlock(&dca_spinLock); return tmp; } /* ubixfs_cacheAdd */ /*** $Log$ + Revision 1.28 2004/08/01 17:58:39 flameshadow + chg: fixed string allocation bug in ubixfs_cacheNew() + Revision 1.27 2004/07/28 17:24:13 flameshadow chg: no comment @@ -315,6 +329,9 @@ Revision 1.5 2004/07/20 19:21:30 reddawg You like leaving out $Log$ + You like leaving out Revision 1.28 2004/08/01 17:58:39 flameshadow + You like leaving out chg: fixed string allocation bug in ubixfs_cacheNew() + You like leaving out You like leaving out Revision 1.27 2004/07/28 17:24:13 flameshadow You like leaving out chg: no comment You like leaving out diff --git a/src/sys/ubixfs/ubixfs.c b/src/sys/ubixfs/ubixfs.c index 899b467..878dc10 100644 --- a/src/sys/ubixfs/ubixfs.c +++ b/src/sys/ubixfs/ubixfs.c @@ -50,6 +50,8 @@ //struct directoryEntry * dirEntry = NULL; struct ubixFSInfo *fsInfo = fd->mp->fsInfo; + + /* kprintf("openFileUbixFS(%s), cwd: %s\n", file, _current->oInfo.cwd); */ if (fsInfo->dirCache == NULL) kprintf("dirCache is null!\n"); @@ -60,6 +62,7 @@ assert(fd->mp->device->devInfo->read); assert(fsInfo); assert(fsInfo->dirCache); + assert(file); if ((fd->mode & fileRead) == fileRead) { do { @@ -110,55 +113,7 @@ } return 0; -/* mji --- */ -#if 0 - if (file[0] == '/' && file[1] != '\0') file++; -/*mji rootDirCacheNode = ubixfs_dirCacheFind(fsInfo->dirCache, "/"); */ - cacheNode = fsInfo->dirCache; - assert(cacheNode); - dirEntry = (struct directoryEntry *)rootDirCacheNode->info; - assert(dirEntry); -/* mji - fd->mp->device->devInfo->read(fd->mp->device->devInfo->info, - dirEntry, - (fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),(0x4000/512)); - mji */ - if ((fd->mode & fileRead) == fileRead) { - for (x=0;x<(0x4000/sizeof(struct directoryEntry));x++) { - if ((int)!strcmp(dirEntry[x].fileName,file)) { - fd->start = dirEntry[x].startCluster; - fd->size = dirEntry[x].size; - fd->perms = dirEntry[x].permissions; - //fd->dirBlock = 0x0; /* Directory Start Sector */ - return((int)1); - } - } - } - else if ((fd->mode & fileWrite) == fileWrite) { - for (x=0;x<(0x4000/sizeof(struct directoryEntry));x++) { - if (!strcmp(dirEntry[x].fileName,file)) { - fd->start = dirEntry[x].startCluster; - fd->size = dirEntry[x].size; - fd->perms = dirEntry[x].permissions; - //fd->dirBlock = 0x0; /* Directory Start Sector */ - return(0x1); - } - if (dirEntry[x].attributes == 0x0) { - sprintf(dirEntry[x].fileName,file); - dirEntry[x].size = 0x0; - dirEntry[x].startCluster = getFreeBlocks(1,fd); - dirEntry[x].attributes = typeFile; - dirEntry[x].permissions = 3754; - fd->size = 0x0; - fd->start = dirEntry[x].startCluster; - //fd->dirBlock = 0x0; - fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8); - return(0x1); - } - } - } - return(0); -#endif + } int writeFileByte(int ch, fileDescriptor *fd, long offset) { @@ -526,6 +481,9 @@ /*** $Log$ + Revision 1.41 2004/08/01 17:58:39 flameshadow + chg: fixed string allocation bug in ubixfs_cacheNew() + Revision 1.40 2004/07/28 17:07:29 flameshadow chg: re-added moving cached nodes to the front of the list when found add: added an assert() in ubixfs.c diff --git a/src/sys/vfs/file.c b/src/sys/vfs/file.c index b6839ba..9ee0cab 100644 --- a/src/sys/vfs/file.c +++ b/src/sys/vfs/file.c @@ -63,8 +63,10 @@ return(1); } else { - tmpFd->prev->next = tmpFd->next; - tmpFd->next->prev = tmpFd->prev; + if (tmpFd->prev) + tmpFd->prev->next = tmpFd->next; + if (tmpFd->next) + tmpFd->next->prev = tmpFd->prev; kfree(fd->buffer); kfree(fd); systemVitals->openFiles--; @@ -266,6 +268,9 @@ /*** $Log$ + Revision 1.18 2004/08/06 22:32:16 reddawg + Ubix Works Again + Revision 1.16 2004/07/28 15:05:43 reddawg Major: Pages now have strict security enforcement.