diff --git a/src/bin/init/main.c b/src/bin/init/main.c index 674ef4e..c86268a 100644 --- a/src/bin/init/main.c +++ b/src/bin/init/main.c @@ -53,10 +53,6 @@ printf("Initializing UbixOS\n"); /* Start TTYD */ - for (i=0;i<100;i++) { - printf("[%i]",i); - } - printf("\nG\n"); i = fork(); if (0x0 == i) { @@ -110,6 +106,9 @@ /*** $Log$ + Revision 1.23 2004/08/24 23:33:45 reddawg + Fixed + Revision 1.22 2004/08/24 05:24:36 reddawg TCA Is A BONER!!!! diff --git a/src/lib/libc_old/sys/fork.c b/src/lib/libc_old/sys/fork.c index daeb8e6..8b9e581 100644 --- a/src/lib/libc_old/sys/fork.c +++ b/src/lib/libc_old/sys/fork.c @@ -33,33 +33,29 @@ pid_t fork() { volatile pid_t pid = 0x0; asm volatile( - /* "pushl %%eax\n" "pushl %%ecx\n" - */ "movl $4,%%eax\n" - /* "push %%ss\n" "movl %%esp,%%ecx\n" "sub $4,%%ecx\n" "pushl %%ecx\n" - */ "int $0x80 \n" - /* "popl %%esp\n" "pop %%ax\n" "popl %%ecx\n" "popl %%eax\n" - */ : : "b" (&pid) ); - while (1); return(pid); } /*** $Log$ + Revision 1.5 2004/08/24 23:33:45 reddawg + Fixed + Revision 1.4 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 diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 69988f1..10682ca 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -70,13 +70,6 @@ union descriptorTableUnion *gdt __attribute__ ((packed)); } loadGDT = { (9 * sizeof(union descriptorTableUnion) - 1), ubixGDT }; -void test_thread() { - int i = 0x0; - while (1) { - //kprintf("HOLLER\n"); - for (i = 0x0;i<0x1000;i++) asm("hlt"); - } - } /***************************************************************************************** Functoin: int main() @@ -109,26 +102,34 @@ kprintf("Problem Mounting HD Mount Point\n"); } */ + initHardDisk(); execThread(systemTask,(uInt32)(kmalloc(0x2000)+0x2000),0x0); - execThread(test_thread,(uInt32)(kmalloc(0x2000)+0x2000),0x0); + execFile("sys:/init",0x0,0x0,0x1); - //execFile("sys:/login",0x0,0x0,0x1); - //execFile("sys:/login",0x0,0x0,0x2); - //execFile("sys:/login",0x0,0x0,0x3); - //execFile("sys:/login",0x0,0x0,0x4); + + /* + 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"); irqEnable(0x0); - //sched(); + while (1); + return(0x0); } /*** $Log$ + Revision 1.78 2004/08/24 23:33:45 reddawg + Fixed + Revision 1.77 2004/08/24 05:24:37 reddawg TCA Is A BONER!!!! diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 5e4fc4b..de777e8 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -338,6 +338,8 @@ elfProgramHeader *programHeader = 0x0; elfSectionHeader *sectionHeader = 0x0; elfDynamic *elfDynamicS = 0x0; + + struct i386_frame *iframe = 0x0; tmpFd = fopen(file,"r"); _current->imageFd = tmpFd; @@ -454,17 +456,48 @@ tmp = (uInt32 *)0x5DD000 - 2; tmp[0] = argc; tmp[1] = (uInt32)argv; - - + /* Now That We Relocated The Binary We Can Unmap And Free Header Info */ + + iframe = _current->kernelStack;//(_current->kernelStack + 0x1000) - sizeof(struct i386_frame); + memset(iframe,0x0,sizeof(struct i386_frame)); + iframe->eip = (uInt32)binaryHeader->eEntry; + iframe->flags = 0x206; + iframe->esp = &_current->kernelStack + 0x2000 - sizeof(struct i386_frame); + iframe->ebp = 0x5DD000; + iframe->user_esp = 0x5DD000 - 12; + iframe->user_ss = 0x30 + 3; + iframe->cs = 0x28 + 3; + iframe->es = 0x30 + 3; + iframe->ss = 0x10 + 0; + iframe->ds = 0x30 + 3; + iframe->fs = 0x30 + 3; + iframe->gs = 0x30 + 3; + kfree(binaryHeader); kfree(programHeader); + asm( + "mov %0,%%esp\n" + "pop %%gs \n" + "pop %%fs \n" + "pop %%es \n" + "pop %%ds \n" + "pop %%ss \n" + "popa \n" + "iret \n" + : + : "g" (iframe) + ); + return; } /*** $Log$ + Revision 1.67 2004/08/24 05:24:37 reddawg + TCA Is A BONER!!!! + Revision 1.66 2004/08/21 23:47:50 reddawg *** empty log message *** diff --git a/src/sys/kernel/fork.c b/src/sys/kernel/fork.c index 7c6b6cc..ccab089 100644 --- a/src/sys/kernel/fork.c +++ b/src/sys/kernel/fork.c @@ -70,15 +70,20 @@ assert(_current); //memcpy(newProcess->kernelStack,_current->kernelStack,0x2000); //newProcess->iframe = ((uInt32)newProcess->kernelStack + ((uInt32)_current->iframe - (uInt32)_current->kernelStack)); - newProcess->iframe->gs = _current->iframe->gs; - newProcess->iframe->fs = _current->iframe->gs; - newProcess->iframe->es = _current->iframe->es; - newProcess->iframe->ds = _current->iframe->ds; + sprintf(newProcess->oInfo.cwd,_current->oInfo.cwd); + newProcess->oInfo.vmStart = _current->oInfo.vmStart; + newProcess->term = _current->term; + newProcess->uid = _current->uid; + newProcess->gid = _current->gid; + newProcess->iframe->gs = 0x33;//_current->iframe->gs; + newProcess->iframe->fs = 0x33;//_current->iframe->gs; + newProcess->iframe->es = 0x33;//_current->iframe->es; + newProcess->iframe->ds = 0x33;//_current->iframe->ds; newProcess->iframe->ss = 0x10; newProcess->iframe->edi = edi; newProcess->iframe->esi = esi; newProcess->iframe->ebp = ebp; - newProcess->iframe->esp = esp; + newProcess->iframe->esp = (newProcess->kernelStack + 0x2000) - sizeof(struct i386_frame); newProcess->iframe->ebx = ebx; newProcess->iframe->edx = edx; newProcess->iframe->ecx = ecx; @@ -88,24 +93,24 @@ newProcess->iframe->flags = eflags; newProcess->iframe->user_esp = esp; newProcess->iframe->user_ss = ss; - //newProcess->iframe->esp = ((uInt32)newProcess->kernelStack - sizeof(struct i386_frame) + 0x2000); + /* Create A Copy Of The VM Space For New Task */ newProcess->cr3 = (uInt32)vmmCopyVirtualSpace(newProcess->id); - kprintf("newProcess->id: [0x%X][0x%X][0x%X][0x%X][0x%X]\n",ss,esp,eip,ebp,newProcess->kernelStack); newProcess->state = FORK; - while (1); - //kprintf("DIKI\n"); while (newProcess->state == FORK) sched_yield(); - //kprintf("WIKI\n"); + /* Return Id of Proccess */ return(newProcess->id); } /*** $Log$ + Revision 1.27 2004/08/24 23:33:45 reddawg + Fixed + Revision 1.26 2004/08/24 05:24:37 reddawg TCA Is A BONER!!!! diff --git a/src/sys/kernel/sched.c b/src/sys/kernel/sched.c index ff14d7b..bfe2ccc 100644 --- a/src/sys/kernel/sched.c +++ b/src/sys/kernel/sched.c @@ -155,10 +155,7 @@ /* Switch Tasks */ sched_tss->esp0 = _current->kernelStack + 0x2000; - if (_current->id == 4) { - //kprintf("esp0: [0x%X:0x%X]\n",sched_tss->esp0,sched_tss->esp0 - 0x2000); - outportByte(0xE9,0xE9); - } + asm volatile( "mov %0,%%eax \n" "mov %%eax,%%cr3 \n" @@ -308,6 +305,9 @@ /*** $Log$ + Revision 1.42 2004/08/24 23:33:45 reddawg + Fixed + Revision 1.41 2004/08/24 05:24:37 reddawg TCA Is A BONER!!!! diff --git a/src/sys/sys/idt.c b/src/sys/sys/idt.c index 7952497..f8ecf7f 100644 --- a/src/sys/sys/idt.c +++ b/src/sys/sys/idt.c @@ -77,7 +77,7 @@ "cli \n" "lidt (%0) \n" /* Load the IDT */ "pushfl \n" /* Clear the NT flag */ - "andl $0xffffbfff,(%%esp) \n" + "andl $0xffffbfff,(%%esp) \n" "popfl \n" "sti \n" : @@ -460,6 +460,9 @@ /*** $Log$ + Revision 1.33 2004/08/24 23:33:45 reddawg + Fixed + Revision 1.32 2004/08/21 17:36:57 reddawg updates: converted to software task switching however it is not working yet diff --git a/src/sys/vmm/pagefault.c b/src/sys/vmm/pagefault.c index 1357582..092e8d0 100644 --- a/src/sys/vmm/pagefault.c +++ b/src/sys/vmm/pagefault.c @@ -110,7 +110,7 @@ else { spinUnlock(&pageFaultSpinLock); /* Need To Create A Routine For Attempting To Access Non Mapped Memory */ - kpanic("Segfault At Address: [0x%X][0x%X][%i][0x%X] Non Mapped\n",memAddr,esp,_current->id,eip); + kprintf("Segfault At Address: [0x%X][0x%X][%i][0x%X] Non Mapped\n",memAddr,esp,_current->id,eip); spinUnlock(&pageFaultSpinLock); endTask(_current->id); } @@ -127,6 +127,9 @@ /*** $Log$ + Revision 1.13 2004/08/24 05:24:37 reddawg + TCA Is A BONER!!!! + Revision 1.12 2004/08/14 11:23:03 reddawg Changes