diff --git a/src/sys/include/sys/tss.h b/src/sys/include/sys/tss.h index d83abd9..d093aa2 100644 --- a/src/sys/include/sys/tss.h +++ b/src/sys/include/sys/tss.h @@ -32,34 +32,6 @@ #include -struct tssStruct -{ - unsigned short backlink, __blh; - unsigned long esp0; - unsigned short ss0, __ss0h; - unsigned long esp1; - unsigned short ss1, __ss1h; - unsigned long esp2; - unsigned short ss2, __ss2h; - unsigned long cr3, eip, eflags; - unsigned long eax,ecx,edx,ebx,esp,ebp,esi,edi; - unsigned short es, __esh; - unsigned short cs, __csh; - unsigned short ss, __ssh; - unsigned short ds, __dsh; - unsigned short fs, __fsh; - unsigned short gs, __gsh; - unsigned short ldt, __ldth; - unsigned short trace, iomapbase; - uInt16 selector; - short trace_bitmap; - short io_map; - char io_space[8192]; - short back_link; -}; - - -/* struct tssStruct { short back_link; @@ -102,7 +74,7 @@ short io_map; char io_space[8192]; }; -*/ + struct i387Struct { long cwd; @@ -144,6 +116,9 @@ /*** $Log$ + Revision 1.8 2005/08/08 21:33:44 fsdfs + new scheduler! + Revision 1.7 2005/08/05 09:43:57 fsdfs code clean up, performance tuning diff --git a/src/sys/init/main.c b/src/sys/init/main.c index ad2de7a..d448a26 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -106,13 +106,14 @@ kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); kprintf("Starting OS\n"); + sysTask = kmalloc(0x2000); if(sysTask == NULL) kpanic("INIT: Unable to allocate memory\n"); //sysExec("sys:/init", 0x0, 0x0, 0x0); execThread(systemTask, (uInt32)sysTask+0x2000,0x0); - //execFile("sys:/init",0x0,0x0,0x0); + execFile("sys:/init",0x0,0x0,0x0); /* start the scheduler */ sched(); diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index c96f9f5..fff6ccf 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -51,7 +51,6 @@ *****************************************************************************************/ uInt32 execThread(void (* tproc)(void),uInt32 stack,char *arg) { kTask_t * newProcess = 0x0; - /* Find A New Thread */ newProcess = schedNewTask(); assert(newProcess); @@ -60,7 +59,7 @@ kpanic("exec: stack not in valid area: [0x%X]\n",stack); /* Set All The Correct Thread Attributes */ -/* + newProcess->tss.back_link = 0x0; newProcess->tss.esp0 = 0x0; newProcess->tss.ss0 = 0x0; @@ -68,16 +67,13 @@ newProcess->tss.ss1 = 0x0; newProcess->tss.esp2 = 0x0; newProcess->tss.ss2 = 0x0; -*/ newProcess->tss.cr3 = (unsigned int)kernelPageDirectory; newProcess->tss.eip = (unsigned int)tproc; newProcess->tss.eflags = 0x206; newProcess->tss.esp = stack; newProcess->tss.ebp = stack; -/* newProcess->tss.esi = 0x0; newProcess->tss.edi = 0x0; -*/ newProcess->tss.es = 0x10; newProcess->tss.cs = 0x08; newProcess->tss.ss = 0x10; @@ -85,16 +81,14 @@ newProcess->tss.fs = 0x10; newProcess->tss.gs = 0x10; newProcess->tss.ldt = 0x18; - newProcess->tss.trace_bitmap = 0x0000; newProcess->tss.io_map = 0x8000; newProcess->oInfo.vmStart = 0x6400000; - - // newProcess->imageFd = 0x0; + newProcess->imageFd = 0x0; /* Set up default stack for thread here filled with arg list 3 times */ -/* + asm volatile( "pusha \n" "movl %%esp,%%ecx \n" @@ -110,13 +104,13 @@ : : "b" (arg),"m" (newProcess->tss.esp) ); -*/ + /* Put new thread into the NEW state */ sched_setStatus2(newProcess,NEW); /* Return with the new process ID */ - return((uInt32)newProcess); - } + return(newProcess->id); + } /***************************************************************************************** diff --git a/src/sys/kernel/sched.c b/src/sys/kernel/sched.c index 9fffee3..4e6759e 100644 --- a/src/sys/kernel/sched.c +++ b/src/sys/kernel/sched.c @@ -46,7 +46,6 @@ void SendTaskToProcessor(kTask_t *task, kProcessor *cpu) { uInt32 memAddr = 0x0; - uInt16 current = 2; _current = task; memAddr = (uInt32)&(task->tss); @@ -92,7 +91,7 @@ kpanic("Unable to create task list"); taskList->id = nextID++; - _current = NULL; + //_current = NULL; taskList->first = NULL; taskList->last = NULL; taskList->next = NULL; @@ -194,13 +193,11 @@ tmpTask->usedMath = 0x0; tmpTask->state = NEW; - spinLock(&schedulerSpinLock); tmpTask->id = nextID++; taskList->last->next = tmpTask; tmpTask->next = NULL; tmpTask->prev = taskList->last; taskList->last = tmpTask; - spinUnlock(&schedulerSpinLock); return(tmpTask); } diff --git a/src/sys/kernel/systemtask.c b/src/sys/kernel/systemtask.c index 5e54284..c551da4 100644 --- a/src/sys/kernel/systemtask.c +++ b/src/sys/kernel/systemtask.c @@ -42,20 +42,18 @@ #include void systemTask() { - kprintf("hi from system task!\n"); -/* + mpi_message_t myMsg; uInt32 counter = 0x0; int i = 0x0; int *x = 0x0; kTask_t *tmpTask = 0x0; - if (mpi_createMbox("system") != 0x0) { kpanic("Error: Error creating mailbox: system\n"); } - kprintf("System task\n"); + kprintf("hi from System task\n"); while(1) { if (mpi_fetchMessage("system",&myMsg) == 0x0) { @@ -80,6 +78,7 @@ kprintf("system: backdoor opened\n"); break; case 0x80: + kprintf("uh"); if (!strcmp(myMsg.data,"sdeStart")) { kprintf("Starting SDE\n"); execThread(sdeThread,(uInt32)(kmalloc(0x2000)+0x2000),0x0); @@ -100,7 +99,7 @@ } //sched_yield(); } -*/ + return; } diff --git a/src/sys/vmm/memory.c b/src/sys/vmm/memory.c index d9c9c4c..380c1f7 100644 --- a/src/sys/vmm/memory.c +++ b/src/sys/vmm/memory.c @@ -57,8 +57,7 @@ int vmmMemMapInit() { int i = 0x0; int memStart = 0x0; - uInt32 MB1; - uInt32 MB2; + uInt32 MB1, MB2; /* Count System Memory */ numPages = countMemory(); @@ -337,6 +336,9 @@ /*** $Log$ + Revision 1.16 2005/08/08 21:33:44 fsdfs + new scheduler! + Revision 1.15 2004/09/11 23:39:31 reddawg ok time for bed