diff --git a/etc/libmap.conf b/etc/libmap.conf new file mode 100644 index 0000000..2885f2e --- /dev/null +++ b/etc/libmap.conf @@ -0,0 +1 @@ +includedir /usr/local/etc/libmap.d diff --git a/lib/libc_old/stdlib/malloc.c b/lib/libc_old/stdlib/malloc.c index 8fb74ee..5627b90 100644 --- a/lib/libc_old/stdlib/malloc.c +++ b/lib/libc_old/stdlib/malloc.c @@ -66,8 +66,6 @@ if ( ( emptyKernDesc = (struct memDescriptor *) getPage( 0x4 ) ) == 0x0 ) return ( 0x0 ); - printf("getPage(0x%X): 0x%X", 0x4, emptyKernDesc); - /* zero out the memory so we know there is no garbage */ memset( emptyKernDesc, 0x0, 0x4000 ); diff --git a/lib/objgfx40/main.cpp b/lib/objgfx40/main.cpp index 9490127..69fb506 100644 --- a/lib/objgfx40/main.cpp +++ b/lib/objgfx40/main.cpp @@ -17,7 +17,7 @@ #include #include -using namespace std; +//using namespace std; void testPixCon(void) { diff --git a/lib/objgfx40/objgfx40.cpp b/lib/objgfx40/objgfx40.cpp index 2cd2b05..22ea7e5 100644 --- a/lib/objgfx40/objgfx40.cpp +++ b/lib/objgfx40/objgfx40.cpp @@ -15,9 +15,9 @@ extern "C" { #include #include - #include + #include #include - #include + //#include } #define abs(a) (((a) < 0) ? -(a) : (a)) @@ -2208,9 +2208,9 @@ * use this method unless YOU KNOW WHAT YOU'RE DOING!!!!!!!!! */ - memcpy( (uInt8*)buffer+lineOfs[dy]+dx*bytesPerPix, // dest - src, // src - size); // size + memcpy( (uint8_t *)buffer + lineOfs[dy] + (dx*bytesPerPix), // dest + src, // src + size); // size return; } // ogSurface::ogCopyLineTo @@ -2784,8 +2784,7 @@ return tmp; } // ogSurface::ogGetLastError -void -ogSurface::ogGetPalette(ogRGBA8 _pal[256]) { +void ogSurface::ogGetPalette(ogRGBA8 _pal[256]) { memcpy(_pal, pal, sizeof(_pal)); return; } // ogSurface::ogGetPalette diff --git a/lib/objgfx40/ogBlit.cpp b/lib/objgfx40/ogBlit.cpp index 4de049c..04f5388 100644 --- a/lib/objgfx40/ogBlit.cpp +++ b/lib/objgfx40/ogBlit.cpp @@ -6,7 +6,7 @@ #include #include -using namespace std; +//using namespace std; static bool fileExists(const char *file) diff --git a/lib/objgfx40/ogFont.cpp b/lib/objgfx40/ogFont.cpp index 70e1ccb..b6af2ef 100644 --- a/lib/objgfx40/ogFont.cpp +++ b/lib/objgfx40/ogFont.cpp @@ -4,7 +4,7 @@ extern "C" { #ifdef __UBIXOS_KERNEL__ #include - #include + #include #else #include #include @@ -12,7 +12,8 @@ #endif } -using namespace std; +//using namespace std; + typedef struct { char ID[3]; diff --git a/lib/objgfx40/ogPixelFmt.cpp b/lib/objgfx40/ogPixelFmt.cpp index 8f25d98..63d390b 100644 --- a/lib/objgfx40/ogPixelFmt.cpp +++ b/lib/objgfx40/ogPixelFmt.cpp @@ -1,10 +1,13 @@ #include #include + +extern "C" { #ifdef __UBIXOS_KERNEL__ -#include +#include #else #include #endif +} ogPixelFmt::ogPixelFmt(void) : BPP(0), redFieldPosition(0), greenFieldPosition(0), diff --git a/lib/objgfx40/ogSprite.cpp b/lib/objgfx40/ogSprite.cpp index 72c6434..872437d 100644 --- a/lib/objgfx40/ogSprite.cpp +++ b/lib/objgfx40/ogSprite.cpp @@ -2,7 +2,8 @@ #include #include #include - } +} + #include #include diff --git a/lib/objgfx40/vWindow.cpp b/lib/objgfx40/vWindow.cpp index 5e4da43..7e29296 100644 --- a/lib/objgfx40/vWindow.cpp +++ b/lib/objgfx40/vWindow.cpp @@ -1,6 +1,7 @@ extern "C" { #include - } +} + #include vWindow::vWindow(void) { diff --git a/sys/Makefile b/sys/Makefile index 3a69599..929246e 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -29,7 +29,7 @@ @echo "Kernel Build For ${_ARCH} Completed On `LC_ALL=C date`" @echo "***************************************************************" -kernel-build: init-code sys-code arch-code kernel-code vmm-code mpi-code fs-code lib-code isa-code pci-code net-code kernel-img +kernel-build: init-code sys-code arch-code kernel-code vmm-code mpi-code fs-code lib-code isa-code pci-code net-code sde-code kernel-img generic-code: generic (cd generic;make) diff --git a/sys/Makefile.incl b/sys/Makefile.incl index fc05a04..c370d8d 100644 --- a/sys/Makefile.incl +++ b/sys/Makefile.incl @@ -8,5 +8,5 @@ KMAKE= ${MAKE} ${KERNEL_FLAGS} INCLUDE=${KERNEL_INC} KERNEL=${KERNEL_NAME} INCLUDES = -I${INCLUDE} -CFLAGS = ${KFLAGS} -m32 -Wall -nostdlib -nostdinc -fno-builtin -fno-exceptions -ffreestanding +CFLAGS = ${KFLAGS} -m32 -Wall -nostdlib -nostdinc -nostdinc++ -fno-builtin -fno-exceptions -ffreestanding ROOT=/ubixos diff --git a/sys/compile/Makefile b/sys/compile/Makefile index ab3c603..341c4c1 100644 --- a/sys/compile/Makefile +++ b/sys/compile/Makefile @@ -9,7 +9,9 @@ OBJS = null.o #Kernel Parts -KPARTS = ../${_ARCH}/*.o ../fs/ubixfs/*.o ../init/*.o ../sys/*.o ../vmm/*.o ../lib/*.o ../kernel/*.o ../isa/*.o ../fs/vfs/*.o ../pci/*.o ../fs/devfs/*.o ../mpi/*.o ../fs/ufs/*.o ../fs/common/*.o ../net/net/*.o ../net/netif/*.o ../net/api/*.o ../net/core/*.o ../net/core/ipv4/*.o ../net/core/ipv6/*.o +KPARTS = ../${_ARCH}/*.o ../init/*.o ../sys/*.o ../vmm/*.o ../lib/*.o ../kernel/*.o ../isa/*.o ../fs/vfs/*.o ../pci/*.o ../fs/devfs/*.o ../mpi/*.o ../fs/ufs/*.o ../fs/common/*.o ../net/net/*.o ../net/netif/*.o ../net/api/*.o ../net/core/*.o ../net/core/ipv4/*.o ../sde/*.o +# ../net/core/ipv6/*.o +# ../fs/ubixfs/*.o # ../sde/*.o ../graphics/*.o ../ld/*.o -Ttext 0x30000 -Tdata 0x34000 ../ubixfs/*.o # Link the kernel statically with fixed text+data address @1M diff --git a/sys/compile/ldscript.i386 b/sys/compile/ldscript.i386 index 731e787..a16ca03 100644 --- a/sys/compile/ldscript.i386 +++ b/sys/compile/ldscript.i386 @@ -5,7 +5,7 @@ SEARCH_DIR("libgcc"); SECTIONS { - . = 0x30000 + SIZEOF_HEADERS; + . = 0x20000 + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } @@ -67,7 +67,10 @@ /* unintialized data (in same segment as writable data) */ __bss_start = .; - .bss : { *(.bss) } + .bss : { + *(COMMON) + *(.bss) + } . = ALIGN(0x1000); _end = . ; diff --git a/sys/fs/vfs/file.c b/sys/fs/vfs/file.c index eb40f76..d8c828f 100644 --- a/sys/fs/vfs/file.c +++ b/sys/fs/vfs/file.c @@ -132,6 +132,7 @@ } int sys_chdir( struct thread *td, struct sys_chdir_args *args ) { + kprintf("chdir: [%s][%s]", _current->oInfo.cwd, args->path); if ( strstr( args->path, ":" ) == 0x0 ) { sprintf( _current->oInfo.cwd, "%s%s", _current->oInfo.cwd, args->path ); } @@ -352,12 +353,15 @@ return (NULL); } - //if (file[0] == "." && file[1] == '\0') - if (strcmp(file, ".") == 0) + path = file; + + if (path[0] == "." && path[1] == '\0') strcpy(fileName, _current->oInfo.cwd); else strcpy( fileName, file ); + path = 0x0; + if ( strstr( fileName, ":" ) ) { mountPoint = (char *) strtok( (char *) &fileName, ":" ); path = strtok( NULL, "\n" ); diff --git a/sys/i386/i386_exec.c b/sys/i386/i386_exec.c index b820e51..25b8520 100644 --- a/sys/i386/i386_exec.c +++ b/sys/i386/i386_exec.c @@ -168,7 +168,7 @@ newProcess->tss.eip = (unsigned int) tproc; newProcess->tss.eflags = 0x206; newProcess->tss.esp = stack; - newProcess->tss.ebp = stack; + newProcess->tss.ebp = 0x0;//stack; newProcess->tss.esi = 0x0; newProcess->tss.edi = 0x0; @@ -200,6 +200,8 @@ newProcess->files[0] = 0x0; + kprintf("EIP: 0x%X", tproc); + /* Set up default stack for thread here filled with arg list 3 times */ asm volatile( "pusha \n" @@ -884,8 +886,6 @@ _current->tss.gs = 0xF; //Select 0x8 + Ring 3 + LDT _current->pgrp = _current->id; - kprintf("DONE YET[0x%X]?", data_addr); - return (0x0); } diff --git a/sys/i386/sched.c b/sys/i386/sched.c index 6612f91..d55e857 100644 --- a/sys/i386/sched.c +++ b/sys/i386/sched.c @@ -103,7 +103,6 @@ break; } else if (tmpTask->state == DEAD) { - kprintf("DEAD: %i", tmpTask->id); delTask = tmpTask; if (delTask->parent != 0x0) { delTask->parent->children -= 1; diff --git a/sys/include/net/net.h b/sys/include/net/net.h index d18fc60..47308a6 100644 --- a/sys/include/net/net.h +++ b/sys/include/net/net.h @@ -27,7 +27,7 @@ #include #include -struct netif lnc_netif; +extern struct netif lnc_netif; int net_init(); diff --git a/sys/include/sde/ogDisplay_UbixOS.h b/sys/include/sde/ogDisplay_UbixOS.h index cb799bb..7d67375 100755 --- a/sys/include/sde/ogDisplay_UbixOS.h +++ b/sys/include/sde/ogDisplay_UbixOS.h @@ -29,7 +29,9 @@ #ifndef OGDISPLAY_UBIXOS_H #define OGDISPLAY_UBIXOS_H +extern "C" { #include +} #include diff --git a/sys/include/sde/sde.h b/sys/include/sde/sde.h index 1cd485e..7827d8a 100644 --- a/sys/include/sde/sde.h +++ b/sys/include/sde/sde.h @@ -25,8 +25,12 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _SDE_H_ -#define _SDE_H_ +#ifndef _SDE_SDE_H +#define _SDE_SDE_H + +#ifdef __cplusplus +extern "C" { +#endif #include @@ -35,14 +39,8 @@ #define drawWindow 3 #define killWindow 4 -#ifdef __cplusplus -extern "C" -#endif void sdeThread(); -#ifdef __cplusplus -extern "C" -#endif void sysSDE(uInt32 cmd, void *ptr); struct sdeWindows { @@ -50,10 +48,13 @@ struct sdeWindows *prev; void *buf; pidType pid; - uInt8 status; + uint8_t status; }; extern struct sdeWindows *windows; +#ifdef __cplusplus +} #endif +#endif diff --git a/sys/include/ubixos/sched.h b/sys/include/ubixos/sched.h index cdc11e9..ac6313a 100644 --- a/sys/include/ubixos/sched.h +++ b/sys/include/ubixos/sched.h @@ -29,6 +29,10 @@ #ifndef _UBIXOS_SCHED_H #define _UBIXOS_SCHED_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -100,4 +104,9 @@ extern kTask_t *_current; extern kTask_t *_usedMath; +#ifdef __cplusplus +} +#endif + + #endif diff --git a/sys/include/ubixos/syscalls.h b/sys/include/ubixos/syscalls.h index dd7f241..bae41f1 100644 --- a/sys/include/ubixos/syscalls.h +++ b/sys/include/ubixos/syscalls.h @@ -77,7 +77,7 @@ int sysMkDir(); int sysRmDir(); -int sysSDE(); +//int sysSDE(); int sysGetDrives(); int sysGetCwd(); int sysChDir(); diff --git a/sys/init/main.c b/sys/init/main.c index 9131b84..b18a840 100644 --- a/sys/init/main.c +++ b/sys/init/main.c @@ -36,6 +36,7 @@ #include #include #include +#include #define B_ADAPTORSHIFT 24 #define B_ADAPTORMASK 0x0f @@ -145,12 +146,24 @@ if (sysTask == 0x0) kprintf("OS: Unable to allocate memory\n"); + else + kprintf("OS Stack: 0x%X\n", sysTask); execThread(systemTask, (uint32_t) sysTask + 0x2000, 0x0); kprintf("Thread Start!\n"); - execFile("sys:/bin/init", argv_init, envp_init, 0x0); /* OS Initializer */ - kprintf("File Start!\n"); + //execFile("sys:/bin/init", argv_init, envp_init, 0x0); /* OS Initializer */ + //kprintf("File Start!\n"); + + sysTask = kmalloc(0x2000); + + if (sysTask == 0x0) + kprintf("OS: Unable to allocate memory\n"); + else + kprintf("SDE Stack: 0x%X\n", sysTask); + + execThread(sdeThread, sysTask + 0x2000,0x0); + kprintf("SDE Thread Start!\n"); irqEnable(0x0); diff --git a/sys/init/static.c b/sys/init/static.c index e289999..f7bbdc1 100644 --- a/sys/init/static.c +++ b/sys/init/static.c @@ -29,14 +29,18 @@ // XXX Set up the ctors int static_constructors(void) { extern void (*__ctor_list)(); + void (**l_ctor)() = &__ctor_list; + int l_ctorCount = *(int *) l_ctor; l_ctor++; + while (l_ctorCount) { (*l_ctor)(); l_ctorCount--; l_ctor++; } + return (0x0); } diff --git a/sys/kernel/descrip.c b/sys/kernel/descrip.c index 4e663b2..82b3c16 100644 --- a/sys/kernel/descrip.c +++ b/sys/kernel/descrip.c @@ -217,6 +217,7 @@ } break; case TIOCGWINSZ: + asm("nop"); struct winsize *win = (struct winsize *) args->data; win->ws_row = 50; win->ws_col = 80; diff --git a/sys/kernel/kern_sysctl.c b/sys/kernel/kern_sysctl.c index 2571dd8..e68d1ab 100644 --- a/sys/kernel/kern_sysctl.c +++ b/sys/kernel/kern_sysctl.c @@ -35,19 +35,21 @@ #include #include #include +#include static struct sysctl_entry *ctls = 0x0; static struct sysctl_entry *sysctl_find(int *, int); +static struct sysctl_entry *sysctl_findMib(char *name, int namelen); /* This is a cheat for now */ static void def_ctls() { int name[CTL_MAXNAME], name_len; - uInt32 page_val = 0x1000; + uint32_t page_val = 0x1000; name[0] = 6; name[1] = 7; name_len = 2; - sysctl_add(name, name_len, "page_size", &page_val, sizeof(uInt32)); + sysctl_add(name, name_len, "pagesizes", &page_val, sizeof(uint32_t)); /* Clock Rate */ name[0] = 1; @@ -78,6 +80,11 @@ name[1] = 3; page_val = 0x1; sysctl_add(name, name_len, "hw.ncpu", &page_val, sizeof(uint32_t)); + + name[0] = 9; + name[1] = 20; + page_val = 0x4000; + sysctl_add(name, name_len, "p1003_1b.pagesize", &page_val, sizeof(uint32_t)); } int sysctl_init() { @@ -212,10 +219,18 @@ endTask(_current->id); } + if (args->namelen == 2 && args->name[0] == 0 && args->name[1] == 3) { + kprintf("name_to_mib: %s", args->newp); + // tmpCtl = sysctl_findMib(args->newp, args->namelen); +td->td_retval[0] = ENOENT; +return(-1); + } + else { tmpCtl = sysctl_find(args->name, args->namelen); + } if (tmpCtl == 0x0) { - kprintf("Invalid CTL\n"); + kprintf("Invalid CTL: "); for (i = 0x0; i < args->namelen; i++) kprintf("(%i)", (int) args->name[i]); kprintf("\n"); @@ -254,6 +269,35 @@ return (0x0); } + +static struct sysctl_entry *sysctl_findMib(char *name, int namelen) { + int i = 0x0; + struct sysctl_entry *tmpCtl = 0x0; + struct sysctl_entry *lCtl = ctls; + + char *mib = (char *) strtok( (char *) name, "." ); + + + kprintf("FMIB: %s", mib); + /* Loop Name Len */ + for (i = 0x0; i < namelen; i++) { + for (tmpCtl = lCtl; tmpCtl != 0x0; tmpCtl = tmpCtl->next) { + if (strcmp(mib, tmpCtl->name) == 0x0) { + kprintf("ctlName: [%s], ctlId: [%i]",tmpCtl->name,tmpCtl->id); + if ((i + 1) == namelen) { + return (tmpCtl); + } + mib = strtok( NULL, "\n" ); + kprintf("SMIB: %s", mib); + lCtl = tmpCtl->children; + break; + } + } + } + return (0x0); +} + + int sysctl_add(int *name, int namelen, char *str_name, void *buf, int buf_size) { struct sysctl_entry *tmpCtl = 0x0; struct sysctl_entry *newCtl = 0x0; diff --git a/sys/kernel/sem.c b/sys/kernel/sem.c index a3a9c53..ea22bc9 100644 --- a/sys/kernel/sem.c +++ b/sys/kernel/sem.c @@ -57,7 +57,8 @@ sys_sem_t *newSem = 0x0; if (*sem != 0) { - kpanic("UH OH!"); + //kpanic("UH OH!"); + kprintf("UH OH!"); } newSem = kmalloc(sizeof(struct sys_sem)); diff --git a/sys/kernel/syscall.c b/sys/kernel/syscall.c index 8ede230..ac168ed 100644 --- a/sys/kernel/syscall.c +++ b/sys/kernel/syscall.c @@ -203,10 +203,17 @@ int sys_getcwd(struct thread *td, struct sys_getcwd_args *args) { char *buf = (char *) args->buf; - //kprintf("GETCWD: [%s][0x%X]\n", _current->oInfo.cwd, args->buf); + char *cwd = _current->oInfo.cwd; + + while (cwd[0] != '/') + cwd++; + if (args->buf) { - sprintf(buf, "%s", _current->oInfo.cwd); - buf[strlen(_current->oInfo.cwd)] = '\0'; + sprintf(buf, "%s", cwd); + buf[strlen(cwd)] = '\0'; + + //sprintf(buf, "%s", _current->oInfo.cwd); + //buf[strlen(_current->oInfo.cwd)] = '\0'; //MrOlsen (2018-01-01) - Why is sprintf not null terminating } // kprintf("GETCWD: [%s][0x%X]\n", _current->oInfo.cwd, args->buf); diff --git a/sys/lib/libcpp.cc b/sys/lib/libcpp.cc index 152bd49..05e2950 100644 --- a/sys/lib/libcpp.cc +++ b/sys/lib/libcpp.cc @@ -27,27 +27,30 @@ */ extern "C" { + #include #include - void __pure_virtual() { - while (1) - ; - } - void __cxa_pure_virtual() { - while (1) - ; - } +void __pure_virtual() { + while (1) + asm("nop"); +} - /* Don't plan on exiting the kernel...so do nothing. */ - int __cxa_atexit(void (*func)(void *), void * arg, void * d) { - return 0; - } +void __cxa_pure_virtual() { + while (1) + asm("nop"); +} - void __dso_handle() { - while (1) - ; - } +/* Don't plan on exiting the kernel...so do nothing. */ +int __cxa_atexit(void (*func)(void *), void * arg, void * d) { + return 0; +} + +void __dso_handle() { + while (1) + asm("nop"); +} + } #include @@ -71,35 +74,3 @@ kfree(ptr); return; } - -/*** - $Log: libcpp.cc,v $ - Revision 1.1.1.1 2006/06/01 12:46:16 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:37 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:24:12 reddawg - no message - - Revision 1.5 2004/09/08 22:04:10 apwillia - Added calling of static constructors, commented out tty_printf in kprintf (due to deadlock) - - Revision 1.4 2004/07/20 22:58:33 reddawg - retiring to the laptop for the night must sync in work to resume from there - - Revision 1.3 2004/07/02 12:28:24 reddawg - Changes for new libc, someone please test that the kernel still works - - Revision 1.2 2004/05/19 04:07:43 reddawg - kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been - - Revision 1.1.1.1 2004/04/15 12:07:10 reddawg - UbixOS v1.0 - - Revision 1.2 2004/04/13 16:36:33 reddawg - Changed our copyright, it is all now under a BSD-Style license - - END - ***/ diff --git a/sys/pci/lnc.c b/sys/pci/lnc.c index 90587e1..3cdb808 100644 --- a/sys/pci/lnc.c +++ b/sys/pci/lnc.c @@ -39,6 +39,8 @@ #include #include +struct netif lnc_netif; + struct lncInfo *lnc = 0x0; //static struct spinLock lnc_intSpinLock = SPIN_LOCK_INITIALIZER; diff --git a/sys/sde/Makefile b/sys/sde/Makefile index 1be27ce..33a0de1 100644 --- a/sys/sde/Makefile +++ b/sys/sde/Makefile @@ -17,6 +17,7 @@ CFLAGS += -fno-rtti +INCLUDES += -I../../lib/objgfx40 all: (cp ../../lib/objgfx40/objgfx40.cpp ./) (cp ../../lib/objgfx40/ogFont.cpp ./) @@ -28,9 +29,10 @@ # Compile Types .cpp.o: - $(CXX) -DNOBOOL -D__UBIXOS_KERNEL__ $(CFLAGS) ${INCLUDES} -I../../lib/objgfx40 -c -o $@ $< + $(CXX) -DNOBOOL -D__UBIXOS_KERNEL__ $(CFLAGS) ${INCLUDES} -c -o $@ $< .cc.o: - $(CXX) -DNOBOOL -D__UBIXOS_KERNEL__ $(CFLAGS) ${INCLUDES} -I../../lib/objgfx40 -c -o $@ $< + $(CXX) -DNOBOOL -D__UBIXOS_KERNEL__ $(CFLAGS) -fno-rtti $(INCLUDES) -c -o $@ $< + .cc.s: $(CXX) -DNOBOOL -D__UBIXOS_KERNEL__ ${CFLAGS} ${INCLUDES} -S -o $@ $< .c.o: diff --git a/sys/sde/main.cc b/sys/sde/main.cc index 11b9735..a8712d2 100644 --- a/sys/sde/main.cc +++ b/sys/sde/main.cc @@ -28,10 +28,12 @@ extern "C" { #include -#include #include #include #include +#include +#include +#include } #include @@ -49,11 +51,13 @@ font->SetFGColor(255, 255, 255, 255); font->SetBGColor(0, 0, 0, 255); + printOff = 0x1; screen->ogCreate(800, 600, OG_PIXFMT_16BPP); screen->ogClear(screen->ogPack(122, 140, 163)); + systemVitals->screen = screen; systemVitals->font = font; @@ -70,7 +74,7 @@ if (buf->buffer == 0x0) { kprintf("Error: buf->buffer\n"); while (1) - ; + asm("nop"); } buf->lineOfs = (uInt32 *) vmm_mapFromTask(tmp->pid, buf->lineOfs, buf->lSize); if (buf->lineOfs == 0x0) { @@ -102,9 +106,9 @@ else { windows = 0x0; } - vmm_unmapPages(buf->buffer, buf->bSize); - vmm_unmapPages(buf->lineOfs, buf->lSize); - // kfree(tmp->buf); + vmm_unmapPages(buf->buffer, buf->bSize, VMM_KEEP); + vmm_unmapPages(buf->lineOfs, buf->lSize, VMM_KEEP); + //kfree(tmp->buf); kfree(tmp); tmp = 0x0; break; @@ -112,11 +116,5 @@ break; } } - //sched_yield(); } } - -/*** - END - ***/ - diff --git a/sys/sde/ogDisplay_UbixOS.cc b/sys/sde/ogDisplay_UbixOS.cc index 650d6ca..51371f9 100755 --- a/sys/sde/ogDisplay_UbixOS.cc +++ b/sys/sde/ogDisplay_UbixOS.cc @@ -32,10 +32,11 @@ extern "C" { #include +#include #include #include #include -#include +#include #include #include } @@ -47,9 +48,9 @@ */ void initVESAMode(uInt16 mode) { - //kprintf("Pre-initVESAMode\n"); + kprintf("Pre-initVESAMode\n"); biosCall(0x10, 0x4F02, mode, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0); - //kprintf("Post-initVESAMode\n"); + kprintf("Post-initVESAMode\n"); return; } @@ -172,7 +173,7 @@ printOff = 0; for (i = 0x0; i < ((size) / 4096); i++) { - if ((vmm_remapPage(modeInfo->physBasePtr + (i * 0x1000), modeInfo->physBasePtr + (i * 0x1000), KERNEL_PAGE_DEFAULT, -2)) == 0x0) + if ((vmm_remapPage(modeInfo->physBasePtr + (i * 0x1000), modeInfo->physBasePtr + (i * 0x1000), KERNEL_PAGE_DEFAULT, -2, 0)) == 0x0) kpanic("Error: vmm_remapPage failed\n"); } // for i diff --git a/sys/sde/sde.cc b/sys/sde/sde.cc index cf31b55..2c06de3 100644 --- a/sys/sde/sde.cc +++ b/sys/sde/sde.cc @@ -29,13 +29,14 @@ extern "C" { #include #include -#include -#include +//#include +#include #include #include -#include -#include +#include } + +#include #include struct sdeWindows *windows = 0x0; @@ -53,7 +54,6 @@ if (tmp != 0x0) { while (tmp->status != windowReady) asm("hlt"); - //sched_yield(); } else if (tmp == 0x0 && cmd != registerWindow) { kprintf("Invalid Window\n"); @@ -64,7 +64,7 @@ case drawWindow: tmp->status = drawWindow; while (tmp->status != windowReady) { - //sched(); + asm("nop"); //asm("hlt"); } break; diff --git a/sys/sys/idt.c b/sys/sys/idt.c index 233c3f7..58f0942 100644 --- a/sys/sys/idt.c +++ b/sys/sys/idt.c @@ -256,23 +256,30 @@ sched_yield(); } -void _int8() { - struct tssStruct *sfTSS = (struct tssStruct *) 0x6200; - kpanic("int8: Double Fault! [%i]\n", _current->id); - sfTSS->cr3 = (unsigned int) kernelPageDirectory; - sfTSS->eip = (unsigned int) &_int8; - sfTSS->eflags = 0x206; - sfTSS->esp = 0x1C000; - sfTSS->ebp = 0x1C000; - sfTSS->es = 0x10; - sfTSS->cs = 0x08; - sfTSS->ss = 0x10; - sfTSS->ds = 0x10; - sfTSS->fs = 0x10; - sfTSS->gs = 0x10; - sfTSS->io_map = 0x8000; - while (1) - asm("nop"); + +asm( + ".globl _int8 \n" + "_int8: \n" +// " pushl $0x8 \n" + " pushal \n" /* Save all registers */ + " push %ds \n" + " push %es \n" + " push %fs \n" + " push %gs \n" + " push %esp \n" + " call __int8 \n" + " pop %gs \n" + " pop %fs \n" + " pop %es \n" + " pop %ds \n" + " popal \n" + " iret \n" /* Exit interrupt */ +); + +void __int8(struct trapframe *frame) { + die_if_kernel("INT8 Double Fault", frame, 8); + endTask(_current->id); + sched_yield(); } void _int9() { diff --git a/sys/vmm/pagefault.c b/sys/vmm/pagefault.c index b79422a..0b28425 100644 --- a/sys/vmm/pagefault.c +++ b/sys/vmm/pagefault.c @@ -114,8 +114,8 @@ kprintf("pageDir: [0x%X]\n", pageDir[pageDirectoryIndex]); kprintf("pageTable: [0x%X:0x%X:0x%X:0x%X]\n", pageTable[pageTableIndex], pageTableIndex, pageDirectoryIndex, eip); kprintf("Segfault At Address: [0x%X][0x%X][%i][0x%X] Non Mapped.\n", memAddr, esp, _current->id, eip); - die_if_kernel("SEGFAULT", frame, 0xC); kpanic("SIT HERE FOR NOW"); + die_if_kernel("SEGFAULT", frame, 0xC); spinUnlock(&pageFaultSpinLock); endTask(_current->id); } diff --git a/sys/vmm/paging.c b/sys/vmm/paging.c index 7f7be0d..0fd8bfd 100644 --- a/sys/vmm/paging.c +++ b/sys/vmm/paging.c @@ -281,16 +281,14 @@ "pop %eax \n" ); -if (dest == 0x1294b000) - kprintf("WOOT: 0x%X, 0x%X", PD_INDEX(dest), PT_INDEX(dest)); - /* Return */ if (haveLock == 0x0) { - if (dest >= VMM_USER_START && dest <= VMM_USER_END) - spinUnlock(&rmpSpinLock); - else - spinUnlock(&pdSpinLock); + if (dest >= VMM_USER_START && dest <= VMM_USER_END) + spinUnlock(&rmpSpinLock); + else + spinUnlock(&pdSpinLock); } + return (source); }