diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 4b08818..67ffcc4 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -126,8 +126,6 @@ int i = 0x0; int x = 0x0; - uInt32 eStart = 0x0; - char *newLoc = 0x0; fileDescriptor *tmpFd = 0x0; elfHeader *binaryHeader = 0x0; @@ -196,7 +194,6 @@ /* Loop Through The Header And Load Sections Which Need To Be Loaded */ for (i=0;iePhnum;i++) { if (programHeader[i].phType == 1) { - newLoc = (char *)programHeader[i].phVaddr; /* Allocate Memory Im Going To Have To Make This Load Memory With Correct Settings so it helps us in the future @@ -210,33 +207,20 @@ _current->oInfo.vmStart = ((programHeader[i].phVaddr & 0xFFFFF000) + 0x1900000); /* Now Load Section To Memory */ fseek(tmpFd,programHeader[i].phOffset,0); - fread(newLoc,programHeader[i].phFilesz,1,tmpFd); + fread((void *)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd); } } - /* Set Virtual Memory Start */ _current->oInfo.vmStart = ((programHeader[i].phVaddr & 0xFFFFF000) + 0x1900000); - /* Get The Starting Point */ - eStart = binaryHeader->eEntry; - /* Now Lets Make A Clean Stack */ - i = 0x5DD000; - + /* Task Stack 0x2000 bytes long */ vmmRemapPage(vmmFindFreePage(_current->id),0x5DC000); vmmSetPageAttribute(0x5DC000,(pageDefault | pageStack)); vmmRemapPage(vmmFindFreePage(_current->id),0x5DB000); vmmSetPageAttribute(0x5DB000,(pageDefault | pageStack)); - /* - vmmRemapPage(vmmFindFreePage(_current->id),0x5DA000); - vmmSetPageAttribute(0x5DA000,(pageDefault | pageStack)); - vmmRemapPage(vmmFindFreePage(_current->id),0x5D9000); - vmmSetPageAttribute(0x5D9000,(pageDefault | pageStack)); - vmmRemapPage(vmmFindFreePage(_current->id),0x5D3000); - vmmSetPageAttribute(0x5D3000,(pageDefault | pageStack)); - vmmRemapPage(vmmFindFreePage(_current->id),0x5D2000); - vmmSetPageAttribute(0x5D2000,(pageDefault | pageStack)); - */ + + /* Kernel Stack 0x2000 bytes long */ vmmRemapPage(vmmFindFreePage(_current->id),0x5D1000); vmmSetPageAttribute(0x5D1000,(pageDefault | pageStack)); vmmRemapPage(vmmFindFreePage(_current->id),0x5D0000); @@ -250,10 +234,10 @@ _current->tss.ss1 = 0x0; _current->tss.esp2 = 0x0; _current->tss.ss2 = 0x0; - _current->tss.eip = (long)eStart; + _current->tss.eip = (long)binaryHeader->eEntry; _current->tss.eflags = 0x206; - _current->tss.esp = i-12; - _current->tss.ebp = i; + _current->tss.esp = 0x5DD000-12; + _current->tss.ebp = 0x5DD000; _current->tss.esi = 0x0; _current->tss.edi = 0x0; @@ -362,7 +346,6 @@ /* Loop Through The Header And Load Sections Which Need To Be Loaded */ for (i=0;iePhnum;i++) { if (programHeader[i].phType == 1) { - //newLoc = (char *)programHeader[i].phVaddr; /* Allocate Memory Im Going To Have To Make This Load Memory With Correct Settings so it helps us in the future @@ -402,7 +385,7 @@ tmp[3] = 0x5DD000-12; tmp = (uInt32 *)0x5DD000 - 3; tmp[0] = argc; - tmp[1] = (uInt32 *)argv; + tmp[1] = (uInt32)argv; tmp[2] = 0x0; /* Now That We Relocated The Binary We Can Unmap And Free Header Info */ @@ -414,6 +397,9 @@ /*** $Log$ + Revision 1.47 2004/07/22 19:18:14 reddawg + Fixed some pointer arithmatic which isn't causing any troubles marky mark who can't code rock hard + Revision 1.46 2004/07/22 18:46:16 reddawg Fixed up exec.c