diff --git a/src/sys/init/main.c b/src/sys/init/main.c index bf55f0c..fa81e8a 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -71,7 +71,7 @@ } loadGDT = { (9 * sizeof(union descriptorTableUnion) - 1), ubixGDT }; void test_thread() { - kprintf("HOLLER\n"); + //kprintf("HOLLER\n"); while (1); } /***************************************************************************************** @@ -107,7 +107,7 @@ } */ initHardDisk(); - execThread(test_thread,(uInt32)(kmalloc(0x2000)+0x2000),0x0); + //execThread(systemTask,(uInt32)(kmalloc(0x2000)+0x2000),0x0); execFile("sys:/init",0x0,0x0,0x1); //execFile("sys:/login",0x0,0x0,0x1); @@ -118,7 +118,7 @@ kprintf("Free Pages: [%i]\n",systemVitals->freePages); kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); kprintf("Starting Os\n"); - /* irqEnable(0x0); */ + //irqEnable(0x0); sched(); while (1); return(0x0); @@ -126,6 +126,9 @@ /*** $Log$ + Revision 1.74 2004/08/21 17:36:57 reddawg + updates: converted to software task switching however it is not working yet + Revision 1.73 2004/08/15 00:33:02 reddawg Wow the ide driver works again diff --git a/src/sys/isa/fdc.c b/src/sys/isa/fdc.c index c5b0fda..71b8e84 100644 --- a/src/sys/isa/fdc.c +++ b/src/sys/isa/fdc.c @@ -80,7 +80,17 @@ ".globl floppyIsr \n" "floppyIsr: \n" " pusha \n" + " push %ss \n" + " push %ds \n" + " push %es \n" + " push %fs \n" + " push %gs \n" " call floppyIsrhndlr \n" + " pop %gs \n" + " pop %fs \n" + " pop %es \n" + " pop %ds \n" + " pop %ss \n" " popa \n" " iret \n" ); @@ -304,6 +314,9 @@ /*** $Log$ + Revision 1.21 2004/08/15 16:47:49 reddawg + Fixed + Revision 1.20 2004/08/15 00:33:02 reddawg Wow the ide driver works again diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 245e524..d7ec4de 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -86,7 +86,7 @@ newProcess->tss.io_map = 0x8000; newProcess->oInfo.vmStart = 0x6400000; */ - + newProcess->cr3 = (uInt32)kernelPageDirectory; newProcess->iframe->eip = (uInt32)tproc; newProcess->iframe->flags = 0x206; @@ -95,6 +95,11 @@ newProcess->iframe->user_esp = stack; newProcess->iframe->user_ss = 0x10; newProcess->iframe->cs = 0x08; + newProcess->iframe->es = 0x10; + newProcess->iframe->ss = 0x10; + newProcess->iframe->ds = 0x10; + newProcess->iframe->fs = 0x10; + newProcess->iframe->gs = 0x10; /* Set up default stack for thread here filled with arg list 3 times */ asm volatile( @@ -110,8 +115,9 @@ "movl %%ecx,%%esp \n" "popa \n" : - : "b" (arg),"m" (newProcess->iframe->esp) + : "b" (arg),"m" (newProcess->iframe->user_esp) ); + newProcess->iframe->esp = newProcess->iframe->user_esp; /* Put new thread into the READY state */ sched_setStatus(newProcess->id,READY); @@ -285,6 +291,11 @@ _current->iframe->user_esp = 0x5DD000 - 12; _current->iframe->user_ss = 0x30 + 3; _current->iframe->cs = 0x28 + 3; + _current->iframe->es = 0x30 + 3; + _current->iframe->ss = 0x30 + 3; + _current->iframe->ds = 0x30 + 3; + _current->iframe->fs = 0x30 + 3; + _current->iframe->gs = 0x30 + 3; sched_setStatus(_current->id,READY); @@ -450,6 +461,9 @@ /*** $Log$ + Revision 1.63 2004/08/21 17:36:57 reddawg + updates: converted to software task switching however it is not working yet + Revision 1.62 2004/08/14 11:23:02 reddawg Changes diff --git a/src/sys/kernel/sched.c b/src/sys/kernel/sched.c index b36cac4..f5beeee 100644 --- a/src/sys/kernel/sched.c +++ b/src/sys/kernel/sched.c @@ -128,12 +128,12 @@ sched_tss->eflags = 0x206; /* Set these up to be ring 3 tasks */ - sched_tss->es = 0x30+3; - sched_tss->cs = 0x28+3; - sched_tss->ss = 0x30+3; - sched_tss->ds = 0x30+3; - sched_tss->fs = 0x30+3; - sched_tss->gs = 0x30+3; + sched_tss->es = 0x10; + sched_tss->cs = 0x8; + sched_tss->ss = 0x10; + sched_tss->ds = 0x10; + sched_tss->fs = 0x10; + sched_tss->gs = 0x10; /* Adjust the GDT to reflect our new TSS */ ubixGDT[4].descriptor.baseLow = ((uInt32)sched_tss & 0xFFFF); @@ -163,7 +163,7 @@ void sched() { - uInt32 memAddr = 0x0; + uInt32 memAddr = 0x0; kTask_t *tmpTask = 0x0; tmpTask = sched_getRunableTask(); @@ -193,17 +193,30 @@ */ /* Switch Tasks */ + //kprintf("Starting Task: [%i]\n",_current->id); sched_tss->esp0 = _current->kernelStack + 0x2000; + //kprintf("EIP: [0x%X:0x%X:0x%X:0x%X:0x%X:0x%X]\n",_current->iframe->eip,_current->cr3,_current->iframe->cs,&_current->iframe->cs,_current->iframe,_current->kernelStack); + //_current->iframe->gs = 0x69; + kprintf("SS: [0x%X]\n",_current->iframe->ss); + memAddr = (uInt32)(_current->iframe); + //kprintf("memAddr: [0x%X]\n",memAddr); + //while (1); asm volatile( "mov %0,%%eax \n" "mov %1,%%esp \n" "mov %%eax,%%cr3 \n" + "pop %%gs \n" + "pop %%fs \n" + "pop %%es \n" + "pop %%ds \n" + "pop %%ss \n" "popa \n" + "sti \n" "iret \n" : - : "g" (_current->cr3), "g" (_current->iframe) - ); - + : "a" (_current->cr3), "p" ((uInt32)(_current->iframe)) + ); + kprintf("This should not be seen?\n"); /* Return */ return; } @@ -232,7 +245,7 @@ runList->prev = tmpTask; runList = tmpTask; - tmpTask->iframe = tmpTask->kernelStack - sizeof(struct i386_frame); + tmpTask->iframe = (tmpTask->kernelStack + 0x2000) - sizeof(struct i386_frame); spinUnlock(&sched_spinLock); return(tmpTask); } @@ -344,6 +357,9 @@ /*** $Log$ + Revision 1.36 2004/08/21 17:36:57 reddawg + updates: converted to software task switching however it is not working yet + Revision 1.35 2004/08/21 16:49:14 reddawg tj check out sched_init does it look well to you? diff --git a/src/sys/kernel/syscall.c b/src/sys/kernel/syscall.c index 03497e8..1fdcae3 100644 --- a/src/sys/kernel/syscall.c +++ b/src/sys/kernel/syscall.c @@ -51,6 +51,11 @@ ".globl _sysCallNew \n" "_sysCallNew: \n" " pusha \n" + " push %ss \n" + " push %ds \n" + " push %es \n" + " push %fs \n" + " push %gs \n" " cmpl totalCalls,%eax \n" " jae invalidSysCallNew \n" " mov %esp,%ebx \n" @@ -62,6 +67,11 @@ "invalidSysCallNew: \n" " call invalidCall \n" "doneNew: \n" + " pop %gs \n" + " pop %fs \n" + " pop %es \n" + " pop %ds \n" + " pop %ss \n" " popa \n" " iret \n" ); @@ -177,6 +187,9 @@ /*** $Log$ + Revision 1.27 2004/08/06 22:43:04 reddawg + ok + Revision 1.26 2004/08/06 22:32:16 reddawg Ubix Works Again diff --git a/src/sys/kernel/timer.S b/src/sys/kernel/timer.S index 47f7162..2d01bb3 100644 --- a/src/sys/kernel/timer.S +++ b/src/sys/kernel/timer.S @@ -30,8 +30,13 @@ .globl timerInt .text .code32 -timerInt: +timerInt: pusha /* Save all of the registers */ + push %ss + push %ds + push %es + push %fs + push %gs mov $0x20,%dx /* The Following Sends Our EOI To The MPIC */ mov $0x20,%ax outb %al,%dx @@ -52,12 +57,20 @@ test %edx,%edx jnz done call sched -done: +done: + pop %gs + pop %fs + pop %es + pop %ds + pop %ss popa /* Restore Registers */ iret /*** $Log$ + Revision 1.6 2004/08/14 11:23:02 reddawg + Changes + Revision 1.5 2004/07/29 21:32:16 reddawg My quick lunchs breaks worth of updates....