X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=KernelLand%2FKernel%2Fmodules.c;h=c5e7f1bc30a92a9c6aef4a188c0d92c9b8bdacfe;hb=015f48988e0ff398409d71dfc692005ab439490a;hp=8202b086671f8583b7cb2572d1fe7f07e809c39a;hpb=11dbd684e9a3d907d43d71a3145205f1a86992fb;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/modules.c b/KernelLand/Kernel/modules.c index 8202b086..c5e7f1bc 100644 --- a/KernelLand/Kernel/modules.c +++ b/KernelLand/Kernel/modules.c @@ -8,6 +8,7 @@ #define USE_EDI 0 #define USE_UDI 0 +#define MODULE_FLAG_LOADERROR 0x1 // === PROTOTYPES === int Module_int_Initialise(tModule *Module, const char *ArgString); @@ -80,6 +81,15 @@ int Module_int_Initialise(tModule *Module, const char *ArgString) "Module %p (%s) is for another architecture (%i)", Module, Module->Name, Module->Arch ); + LEAVE('i', MODULE_ERR_BADMODULE); + return MODULE_ERR_BADMODULE; + } + + LOG("Module->Flags = %x", Module->Flags); + if(Module->Flags & MODULE_FLAG_LOADERROR ) { + Log_Warning("Module", "%s has already attempted to load and encountered errors", Module->Name); + LEAVE('i', MODULE_ERR_MISC); + return MODULE_ERR_MISC; } deps = Module->Dependencies; @@ -177,6 +187,7 @@ int Module_int_Initialise(tModule *Module, const char *ArgString) Log_Warning("Module", "Unable to load reason - Unknown code %i", ret); break; } + Module->Flags |= MODULE_FLAG_LOADERROR; LEAVE_RET('i', ret); return ret; } @@ -355,7 +366,7 @@ int Module_LoadFile(const char *Path, const char *ArgString) // TODO: I need a way of relocating the dependencies before everything else, so // they can be resolved before any other link errors if( !Binary_Relocate(base) ) { - Log_Warning("Relocation of module %s failed", Path); + Log_Warning("Module", "Relocation of module %s failed", Path); Binary_Unload(base); return 0; } @@ -378,7 +389,7 @@ int Module_LoadFile(const char *Path, const char *ArgString) } if( !Module_int_ResolveDeps(info) ) { - Log_Warning("Dependencies not met for '%s'", Path); + Log_Warning("Module", "Dependencies not met for '%s'", Path); Binary_Unload(base); return 0; }