diff --git a/src/sys/kernel/gen_calls.c b/src/sys/kernel/gen_calls.c index 5cd78c0..2283e58 100644 --- a/src/sys/kernel/gen_calls.c +++ b/src/sys/kernel/gen_calls.c @@ -34,24 +34,24 @@ #include #include +/* return the process id */ int getpid(struct thread *td, struct getpid_args *uap) { td->td_retval[0] = _current->id; return (0); } +/* return the process user id */ int getuid(struct thread *td, struct getuid_args *uap) { td->td_retval[0] = _current->uid; return (0); } +/* return the process group id */ int getgid(struct thread *td, struct getgid_args *uap) { td->td_retval[0] = _current->gid; return (0); } - - - int sys_write(struct thread *td, struct write_args *uap) { if (uap->fd == 2) { kprintf("stderr: %s",uap->buf); @@ -78,9 +78,6 @@ return(0x0); } - - /*** END ***/ - diff --git a/src/sys/kernel/tty.c b/src/sys/kernel/tty.c index 39b79d0..7db7ce1 100644 --- a/src/sys/kernel/tty.c +++ b/src/sys/kernel/tty.c @@ -41,7 +41,7 @@ int tty_init() { int i = 0x0; - + /* Allocate memory for terminals */ terms = (tty_term *)kmalloc(sizeof(tty_term)*TTY_MAX_TERMS); if (terms == 0x0) @@ -52,13 +52,13 @@ terms[i].tty_buffer = (char *)kmalloc(80*60*2); if (terms[i].tty_buffer == 0x0) kpanic("tty_init: Failed to allocate buffer memory. File: %s, Line: %i\n",__FILE__,__LINE__); - + terms[i].tty_pointer = terms[i].tty_buffer; /* Set up tty pointer to internal buffer */ terms[i].tty_x = 0x0; /* Set up default X position */ terms[i].tty_y = 0x0; /* Set up default Y position */ terms[i].tty_colour = 0x0A + i; /* Set up default tty text colour */ } - + /* Read tty0 current position (to migrate from kprintf). */ outportByte(0x3D4, 0x0e); terms[0].tty_y = inportByte(0x3D5); @@ -79,7 +79,7 @@ } - /* + /* This will change the specified tty. It ultimately copies the screen to the foreground buffer copies the new ttys buffer to the screen and adjusts a couple pointers and we are good to go. @@ -101,7 +101,6 @@ */ tty_foreground->tty_pointer = tty_foreground->tty_buffer; - terms[tty].tty_pointer = (char *)0xB8000; /* set new foreground tty */ @@ -116,16 +115,14 @@ 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; @@ -139,7 +136,8 @@ term->tty_pointer[bufferOffset++] = character; term->tty_pointer[bufferOffset++] = term->tty_colour; break; - } /* switch */ + } /* switch */ + /* Check To See If We Are Out Of Bounds */ if (bufferOffset >= 160 * 25) { for (i = 0; i < 160 * 24; i++) { @@ -151,23 +149,24 @@ } bufferOffset -= 160; } - } - bufferOffset >>= 1; /* Set the new cursor position */ + } + + bufferOffset >>= 1; /* Set the new cursor position */ term->tty_x = (bufferOffset & 0xFF); term->tty_y = (bufferOffset >> 0x8); - + if (term == tty_foreground) { outportByte(0x3D4, 0x0f); outportByte(0x3D5, term->tty_x); outportByte(0x3D4, 0x0e); outportByte(0x3D5, term->tty_y); } - + spinUnlock(&tty_spinLock); return(0x0); } - + tty_term *tty_find(uInt16 tty) { return(&terms[tty]); } @@ -175,4 +174,3 @@ /*** END ***/ -