X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fmodules.c;h=e3e0ebeba68cb5ca753bca981a828b38222ff1bb;hb=700d4228ad14b3a7406eefc9a58735748c254d42;hp=98ca1a1eb43e40490214757dc73e28e4133d37c1;hpb=51ab5f489bc356940c95cc936fd0508e8f07ea97;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/modules.c b/KernelLand/Kernel/modules.c index 98ca1a1e..e3e0ebeb 100644 --- a/KernelLand/Kernel/modules.c +++ b/KernelLand/Kernel/modules.c @@ -168,7 +168,7 @@ int Module_int_Initialise(tModule *Module, const char *ArgString) Log_Warning("Module", "Unable to load, reason: Miscelanious"); break; case MODULE_ERR_NOTNEEDED: - Log_Debug("Module", "Unable to load, reason: Module not needed"); +// Log_Debug("Module", "Unable to load, reason: Module not needed"); break; case MODULE_ERR_MALLOC: Log_Warning("Module", "Unable to load, reason: Error in malloc/realloc/calloc, probably not good"); @@ -341,6 +341,7 @@ int Module_LoadFile(const char *Path, const char *ArgString) { void *base; tModule *info; + tModuleLoader *loader = NULL; // Load Binary base = Binary_LoadKernel(Path); @@ -352,36 +353,36 @@ int Module_LoadFile(const char *Path, const char *ArgString) } // Check for Acess Driver - if( Binary_FindSymbol(base, "DriverInfo", (Uint*)&info ) == 0 ) + if( Binary_FindSymbol(base, "DriverInfo", (Uint*)&info ) ) { - tModuleLoader *tmp; - for( tmp = gModule_Loaders; tmp; tmp = tmp->Next) + for( loader = gModule_Loaders; loader; loader = loader->Next) { - if( tmp->Detector(base) == 0 ) continue; - - return tmp->Loader(base); - } - - #if USE_EDI - // Check for EDI Driver - if( Binary_FindSymbol(base, "driver_init", NULL ) != 0 ) - { - return Module_InitEDI( base ); // And intialise + if( loader->Detector(base) ) + break; } - #endif // Unknown module type?, return error + if( !loader ) { + Binary_Unload(base); + Log_Warning("Module", "Module '%s' does not have a Module Info struct", Path); + return 0; + } + } + + if( !Module_int_ResolveDeps(info) ) { + Log_Warning("Dependencies not met for '%s'", Path); Binary_Unload(base); - #if USE_EDI - Log_Warning("Module", "Module '%s' has neither a Module Info struct, nor an EDI entrypoint", Path); - #else - Log_Warning("Module", "Module '%s' does not have a Module Info struct", Path); - #endif return 0; } - + + if( !Binary_Relocate(base) ) { + Log_Warning("Relocation of module %s failed", Path); + Binary_Unload(base); + return 0; + } + // Initialise (and register) - if( Module_int_Initialise( info, ArgString ) ) + if( loader ? loader->Loader(base) : Module_int_Initialise( info, ArgString ) ) { Binary_Unload(base); return 0;