diff --git a/src/sys/include/ubixos/sched.h b/src/sys/include/ubixos/sched.h index 79b31ed..5a20525 100644 --- a/src/sys/include/ubixos/sched.h +++ b/src/sys/include/ubixos/sched.h @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -67,6 +68,7 @@ uInt16 usedMath; uInt16 nice; uInt32 timeSlice; + tty_term *term; } kTask_t; typedef struct prioQueue { @@ -101,6 +103,9 @@ /*** $Log$ + Revision 1.15 2004/07/29 21:32:16 reddawg + My quick lunchs breaks worth of updates.... + Revision 1.14 2004/07/21 17:15:02 reddawg removed garbage diff --git a/src/sys/include/ubixos/tty.h b/src/sys/include/ubixos/tty.h index 25385c1..0e26265 100644 --- a/src/sys/include/ubixos/tty.h +++ b/src/sys/include/ubixos/tty.h @@ -36,17 +36,25 @@ typedef struct tty_termNode { char *tty_buffer; + char *tty_pointer; + uInt8 tty_colour; + uInt16 current; uInt16 tty_x; uInt16 tty_y; } tty_term; int tty_init(); -int tty_chang(uInt16 tty); +int tty_chang(uInt16); +tty_term *tty_find(uInt16); +int tty_print(char *,tty_term *); #endif /*** $Log$ + Revision 1.1 2004/08/03 21:44:24 reddawg + ttys + END ***/ diff --git a/src/sys/init/main.c b/src/sys/init/main.c index edf8a11..dc3c018 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -105,6 +105,10 @@ execThread(systemTask,(uInt32)(kmalloc(0x2000)+0x2000),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); kprintf("Free Pages: [%i]\n",systemVitals->freePages); kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); kprintf("Starting Os\n"); @@ -115,6 +119,9 @@ /*** $Log$ + Revision 1.67 2004/08/03 18:31:19 reddawg + virtual terms + Revision 1.66 2004/08/03 00:05:52 reddawg com cvs comi comi cvs comiits sc sfix fb bug diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index e71dba6..a987a48 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -137,8 +137,11 @@ /* Get A New Task For This Proccess */ _current = schedNewTask(); assert(_current); - _current->gid = 0x0; - _current->uid = 0x0; + _current->gid = 0x0; + _current->uid = 0x0; + _current->term = tty_find(console); + if (_current->term == 0x0) + kpanic("Error: invalid console\n"); /* Now We Must Create A Virtual Space For This Proccess To Run In */ _current->tss.cr3 = (uInt32)vmmCreateVirtualSpace(_current->id); @@ -417,6 +420,9 @@ /*** $Log$ + Revision 1.57 2004/08/02 17:38:24 reddawg + Cleaned up self inflicted bug that messed up argc,argv + Revision 1.56 2004/07/28 17:07:25 reddawg MPI: moved the syscalls diff --git a/src/sys/kernel/file.c b/src/sys/kernel/file.c index c030b6f..fba322b 100644 --- a/src/sys/kernel/file.c +++ b/src/sys/kernel/file.c @@ -1,5 +1,5 @@ /***************************************************************************************** - Copyright (c) 2002 The UbixOS Project + Copyright (c) 2002-2004 The UbixOS Project All rights reserved. Redistribution and use in source and binary forms, with or without modification, are @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -120,7 +121,6 @@ size_t fwrite(void *ptr,int size,int nmemb,fileDescriptor *fd) { fileDescriptor *tmpFd = 0x0; /* Search For File Descriptor */ - kprintf("HERE?\n"); for (tmpFd=fdTable;tmpFd;tmpFd=tmpFd->next) { /* If Found Return Next Char */ if (tmpFd == fd) { @@ -184,7 +184,7 @@ //userFileDescriptor *userFd = stackPtr[2]; //kprintf("Sys FWrite: [0x%X][0x%X][0x%X]\n",ptr,size,userFd); if (userFd == 0x0) { - kprintf(ptr); + tty_print(ptr,_current->term); } else { fwrite(ptr,size,1,userFd->fd); @@ -210,7 +210,14 @@ asm("sti"); tmpFd = userFd->fd; if (userFd->fd == 0x0) { - ptr[0] = (int) getch(); + /* + while (_current->term->current == 0x0) + schedYield(); + */ + if (_current->term->current == 0x0) + ptr[0] = '\0'; + else + ptr[0] = (int) getch(); } else { ptr[0] = (int) fgetc(tmpFd); @@ -273,6 +280,9 @@ /*** $Log$ + Revision 1.10 2004/07/28 17:07:25 reddawg + MPI: moved the syscalls + Revision 1.9 2004/07/28 15:05:43 reddawg Major: Pages now have strict security enforcement. diff --git a/src/sys/kernel/fork.c b/src/sys/kernel/fork.c index 29bb3eb..3539d36 100644 --- a/src/sys/kernel/fork.c +++ b/src/sys/kernel/fork.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,8 @@ /* Set Up New Tasks Information */ newProcess->tss.eip = eip; sprintf(newProcess->oInfo.cwd,_current->oInfo.cwd); - newProcess->oInfo.vmStart = _current->oInfo.vmStart; + newProcess->oInfo.vmStart = _current->oInfo.vmStart; + newProcess->term = _current->term; newProcess->uid = _current->uid; newProcess->gid = _current->gid; newProcess->tss.back_link = 0x0; @@ -111,6 +113,9 @@ /*** $Log$ + Revision 1.18 2004/08/02 18:50:13 reddawg + Updates to make some variable volatile to make work with gcc 3.3. However there are still some issues but we have not caused new issues with gcc 2.95 + Revision 1.17 2004/07/29 21:32:16 reddawg My quick lunchs breaks worth of updates.... diff --git a/src/sys/kernel/tty.c b/src/sys/kernel/tty.c index afcb3e0..67907a2 100644 --- a/src/sys/kernel/tty.c +++ b/src/sys/kernel/tty.c @@ -29,12 +29,14 @@ #include #include +#include #include #include #include static tty_term *terms = 0x0; static uInt16 tty_current = 0x0; +static spinLock_t tty_spinLock = SPIN_LOCK_INITIALIZER; int tty_init() { int i = 0x0; @@ -49,21 +51,82 @@ terms[i].tty_buffer = (char *)kmalloc(80*60*2); if (terms[i].tty_buffer == 0x0) kpanic("tty_init: Failed to allocate buffer memory\n"); + terms[i].tty_pointer = terms[i].tty_buffer; + terms[i].tty_x = 0x0; + terms[i].tty_y = 0x0; + terms[i].current = 0x0; + terms[i].tty_colour = 0x0A + i; } + terms[0].tty_pointer = (char *)0xB8000; + terms[0].current = 0x1; kprintf("tty0 - Initialized\n"); return(0x0); } int tty_change(uInt16 tty) { - memcpy(terms[tty_current].tty_buffer,0xB8000,(80*60*2)); - memcpy(0xB8000,terms[tty].tty_buffer,(80*60*2)); + memcpy(terms[tty_current].tty_buffer,(char *)0xB8000,(80*60*2)); + memcpy((char *)0xB8000,terms[tty].tty_buffer,(80*60*2)); + terms[tty_current].tty_pointer = terms[tty_current].tty_buffer; + terms[tty_current].current = 0x0; + + terms[tty].tty_pointer = (char *)0xB8000; + terms[tty].current = 0x1; tty_current = tty; return(0x0); } + +int tty_print(char *string,tty_term *term) { + unsigned int bufferOffset = 0x0, character = 0x0, i = 0x0; + spinLock(&tty_spinLock); + + /* We Need To Get The Y Position */ + bufferOffset = term->tty_y; + bufferOffset <<= 8; + + /* Then We Need To Add The X Position */ + bufferOffset += term->tty_x; + bufferOffset <<= 1; + + while ((character = *string++)) { + switch (character) { + case '\n': + bufferOffset = (bufferOffset / 160) * 160 + 160; + break; + default: + term->tty_pointer[bufferOffset++] = character; + term->tty_pointer[bufferOffset++] = term->tty_colour; + break; + } /* switch */ + /* Check To See If We Are Out Of Bounds */ + if (bufferOffset >= 160 * 25) { + for (i = 0; i < 160 * 24; i++) { + term->tty_pointer[i] = term->tty_pointer[i + 160]; + } + for (i = 0; i < 80; i++) { + term->tty_pointer[(160 * 24) + (i * 2)] = 0x20; + term->tty_pointer[(160 * 24) + (i * 2) + 1] = term->tty_colour; + } + bufferOffset -= 160; + } + } + bufferOffset >>= 1; /* Set the new cursor position */ + term->tty_x = (bufferOffset & 0xFF); + term->tty_y = (bufferOffset >> 8); + spinUnlock(&tty_spinLock); + + return(0x0); + } + +tty_term *tty_find(uInt16 tty) { + return(&terms[tty]); + } /*** $Log$ + Revision 1.1 2004/08/03 21:44:24 reddawg + ttys + END ***/