diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 9a4318f..4b08818 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -298,10 +298,8 @@ void sysExec(char *file,int argc,char **argv) { int i = 0x0; int x = 0x0; - uInt32 eStart = 0x0; uInt32 *tmp = 0x0; uInt32 ldAddr = 0x0; - char *newLoc = 0x0; fileDescriptor *tmpFd = 0x0; elfHeader *binaryHeader = 0x0; @@ -364,7 +362,7 @@ /* 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; + //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 @@ -376,13 +374,13 @@ _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); } else if (programHeader[i].phType == 2) { - newLoc = (char *)programHeader[i].phVaddr; + //newLoc = (char *)programHeader[i].phVaddr; elfDynamicS = (elfDynamic *)programHeader[i].phVaddr; fseek(tmpFd,programHeader[i].phOffset,0); - fread(newLoc,programHeader[i].phFilesz,1,tmpFd); + fread((void *)programHeader[i].phVaddr,programHeader[i].phFilesz,1,tmpFd); } else if (programHeader[i].phType == 3) { ldAddr = ldEnable(); @@ -398,27 +396,27 @@ } } - /* Get The Starting Point */ - eStart = binaryHeader->eEntry; - - /* Now That We Relocated The Binary We Can Unmap And Free Header Info */ + /* Adjust iframe */ + tmp = (uInt32 *)_current->tss.esp0 - 5; + tmp[0] = binaryHeader->eEntry; + tmp[3] = 0x5DD000-12; + tmp = (uInt32 *)0x5DD000 - 3; + tmp[0] = argc; + tmp[1] = (uInt32 *)argv; + tmp[2] = 0x0; + + /* Now That We Relocated The Binary We Can Unmap And Free Header Info */ kfree(binaryHeader); kfree(programHeader); - /* Adjust iframe */ - tmp = (uInt32)(_current->tss.esp0)-20; - tmp[0] = eStart; - tmp[3] = 0x5DD000-12; - tmp = 0x5DD000 - 12; - tmp[0] = argc; - tmp[1] = argv; - tmp[2] = 0x0; - return; } /*** $Log$ + Revision 1.46 2004/07/22 18:46:16 reddawg + Fixed up exec.c + Revision 1.45 2004/07/22 17:32:25 reddawg I broke it hopefully