Changed the x86 architecture to have tPAddr be 64-bits always
[tpg/acess2.git] / Kernel / bin / elf.c
index 2f37739..6719a41 100644 (file)
@@ -76,7 +76,7 @@ tBinary *Elf_Load(int fp)
        LOG("iPageCount = %i", iPageCount);\r
        \r
        // Allocate Information Structure\r
-       ret = malloc( sizeof(tBinary) + 3*sizeof(Uint)*iPageCount );\r
+       ret = malloc( sizeof(tBinary) + sizeof(tBinaryPage)*iPageCount );\r
        // Fill Info Struct\r
        ret->Entry = hdr.entrypoint;\r
        ret->Base = -1;         // Set Base to maximum value\r
@@ -106,9 +106,7 @@ tBinary *Elf_Load(int fp)
                if(phtab[i].Type != PT_LOAD)    continue;\r
                \r
                // Find Base\r
-               if(phtab[i].VAddr < ret->Base)  ret->Base = phtab[i].VAddr;
-\r
-               k = 0;\r
+               if(phtab[i].VAddr < ret->Base)  ret->Base = phtab[i].VAddr;\r
                \r
                LOG("phtab[%i] = {VAddr:0x%x,Offset:0x%x,FileSize:0x%x}",\r
                        i, phtab[i].VAddr, phtab[i].Offset, phtab[i].FileSize);\r
@@ -123,7 +121,7 @@ tBinary *Elf_Load(int fp)
                \r
                // Get Pages\r
                count = ( (phtab[i].VAddr&0xFFF) + phtab[i].FileSize + 0xFFF) >> 12;\r
-               for(;k<count;k++)\r
+               for( k = 0; k < count; k ++ )\r
                {\r
                        ret->Pages[j+k].Virtual = phtab[i].VAddr + (k<<12);\r
                        ret->Pages[j+k].Physical = phtab[i].Offset + (k<<12);   // Store the offset in the physical address\r

UCC git Repository :: git.ucc.asn.au