X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fbinary.c;h=f618673900668ad54c7e74e2003ab9817457f0b3;hb=ea487239a8b3632d13c6e4ec92d21f0fcd460bdd;hp=e72de28b035d70c5a08b713d30d30a6d4279f504;hpb=2fcb3775f3afee7bfa9aa3cbb6aea3c6c3426e64;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/binary.c b/KernelLand/Kernel/binary.c index e72de28b..f6186739 100644 --- a/KernelLand/Kernel/binary.c +++ b/KernelLand/Kernel/binary.c @@ -194,9 +194,10 @@ int Proc_SysSpawn(const char *Binary, const char **ArgV, const char **EnvP, int Proc_Execve(Binary, ArgV, EnvP, size); for(;;); } - if( ret < 0 ) + if( ret == -1 ) { VFS_FreeSavedHandles(nFD, handles); + free(cachebuf); } return ret; @@ -249,7 +250,7 @@ int Proc_Execve(const char *File, const char **ArgV, const char **EnvP, int Data base = Binary_Load(File, &entry); if(base == 0) { - Log_Warning("Binary", "Proc_Execve - Unable to load '%s'", File); + Log_Warning("Binary", "Proc_Execve - Unable to load '%s' [errno=%i]", File, errno); LEAVE('-'); Threads_Exit(0, -10); for(;;); @@ -768,17 +769,7 @@ void *Binary_LoadKernel(const char *File) pKBinary->Next = glLoadedKernelLibs; glLoadedKernelLibs = pKBinary; SHORTREL( &glKBinListLock ); - - // Relocate Library - if( !Binary_Relocate( (void*)base ) ) - { - Log_Warning("Binary", "Relocation of '%s' failed, unloading", File); - Binary_Unload( (void*)base ); - Binary_Dereference( pBinary ); - LEAVE('n'); - return 0; - } - + LEAVE('p', base); return (void*)base; } @@ -832,9 +823,12 @@ Uint Binary_GetSymbolEx(const char *Name, Uint *Value) tKernelBin *pKBin; int numKSyms = ((Uint)&gKernelSymbolsEnd-(Uint)&gKernelSymbols)/sizeof(tKernelSymbol); + LOG("numKSyms = %i", numKSyms); + // Scan Kernel for( i = 0; i < numKSyms; i++ ) { + LOG("KSym %s = %p", gKernelSymbols[i].Name, gKernelSymbols[i].Value); if(strcmp(Name, gKernelSymbols[i].Name) == 0) { *Value = gKernelSymbols[i].Value; return 1; @@ -891,12 +885,12 @@ int Binary_int_CheckMemFree( tVAddr _start, size_t _len ) _start &= ~(PAGE_SIZE-1); LOG("_start = %p, _len = 0x%x", _start, _len); for( ; _len > PAGE_SIZE; _len -= PAGE_SIZE, _start += PAGE_SIZE ) { - if( MM_GetPhysAddr(_start) != 0 ) { + if( MM_GetPhysAddr( (void*)_start ) != 0 ) { LEAVE('i', 1); return 1; } } - if( _len == PAGE_SIZE && MM_GetPhysAddr(_start) != 0 ) { + if( _len == PAGE_SIZE && MM_GetPhysAddr( (void*)_start ) != 0 ) { LEAVE('i', 1); return 1; }