X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fmodules.c;h=e4f49b288e776b2b854bb771ad09ee3c5d92e213;hb=1c2a87ec67d332b6a165c79398693eac1eb1166e;hp=b2f453525fb54b268f586a17146c0d9eceb31b72;hpb=9b7a7e725ca1b371e4a89776ac4a7bb10e2cbea7;p=tpg%2Facess2.git diff --git a/Kernel/modules.c b/Kernel/modules.c index b2f45352..e4f49b28 100644 --- a/Kernel/modules.c +++ b/Kernel/modules.c @@ -6,7 +6,7 @@ #include #define USE_EDI 0 -#define USE_UDI 0 +#define USE_UDI 1 // === PROTOTYPES === int Modules_LoadBuiltins(); @@ -27,6 +27,7 @@ extern void gKernelModulesEnd; int giNumBuiltinModules = 0; int giModuleSpinlock = 0; tModule *gLoadedModules = NULL; +tModuleLoader *gModule_Loaders = NULL; // === CODE === int Modules_LoadBuiltins() @@ -118,6 +119,20 @@ int Modules_LoadBuiltins() return 0; } +/** + * \brief Registers a tModuleLoader with the kernel + * \param Loader Pointer to loader structure (must be persistent) + */ +int Module_RegisterLoader(tModuleLoader *Loader) +{ + if(!Loader) return 1; + + Loader->Next = gModule_Loaders; + gModule_Loaders = Loader; + + return 0; +} + /** * \fn int Module_LoadMem(void *Buffer, Uint Length, char *ArgString) * \brief Load a module from a memory location @@ -152,23 +167,22 @@ int Module_LoadFile(char *Path, char *ArgString) // Check for Acess Driver if( Binary_FindSymbol(base, "DriverInfo", (Uint*)&info ) == 0 ) { + tModuleLoader *tmp; + for( tmp = gModule_Loaders; tmp; tmp = tmp->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 ) { - Binary_Relocate(base); // Relocate return Module_InitEDI( base ); // And intialise } #endif - #if USE_UDI - if( Binary_FindSymbol(base, "udi_init_info", NULL ) != 0 ) - { - Binary_Relocate(base); // Relocate - return UDI_LoadDriver( base ); // And intialise - } - #endif - // Unknown module type?, return error Binary_Unload(base); #if USE_EDI