X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Fmodules.c;h=ba92905fe22ae5a549a2ffa5cb83cc4c3da8706e;hb=38e4b28d370c5f9284b285a71518ae2b6bce125c;hp=b1d858c7d0d2672a39fe61e8460b815239e06759;hpb=77ed20ce9d7e25654215980d0f89e63b8dd366f0;p=tpg%2Facess2.git diff --git a/Kernel/modules.c b/Kernel/modules.c index b1d858c7..ba92905f 100644 --- a/Kernel/modules.c +++ b/Kernel/modules.c @@ -5,13 +5,20 @@ #include #include +#define USE_EDI 0 +#define USE_UDI 1 + // === PROTOTYPES === + int Modules_LoadBuiltins(); int Module_LoadMem(void *Buffer, Uint Length, char *ArgString); int Module_LoadFile(char *Path, char *ArgString); int Module_int_ResolveDeps(tModule *Info); int Module_IsLoaded(char *Name); // === IMPORTS === +#if USE_UDI +extern int UDI_LoadDriver(void *Base); +#endif extern void StartupPrint(char *Str); extern tModule gKernelModules[]; extern void gKernelModulesEnd; @@ -64,6 +71,8 @@ int Modules_LoadBuiltins() for( i = 0; i < giNumBuiltinModules; i++ ) { if( baIsLoaded[i] ) continue; // Ignore already loaded modules + + deps = gKernelModules[i].Dependencies; if( deps ) { @@ -95,9 +104,13 @@ int Modules_LoadBuiltins() gKernelModules[i].Name, gKernelModules[i].Version>>8, gKernelModules[i].Version & 0xFF ); - gKernelModules[i].Init(NULL); + if( gKernelModules[i].Init(NULL) == 0 ) { + Log("Loading Failed, all modules that depend on this will also fail"); + baIsLoaded[i] = -1; + } // Mark as loaded - baIsLoaded[i] = 1; + else + baIsLoaded[i] = 1; numToInit --; } } @@ -113,7 +126,7 @@ int Module_LoadMem(void *Buffer, Uint Length, char *ArgString) { char path[VFS_MEMPATH_SIZE]; - VFS_GetMemPath(Buffer, Length, path); + VFS_GetMemPath(path, Buffer, Length); return Module_LoadFile( path, ArgString ); } @@ -145,6 +158,14 @@ int Module_LoadFile(char *Path, char *ArgString) } #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