git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Kernel - Added PMM stats method (stubbed) to x86_64 and template
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
modules.c
diff --git
a/KernelLand/Kernel/modules.c
b/KernelLand/Kernel/modules.c
index
d703290
..
8202b08
100644
(file)
--- a/
KernelLand/Kernel/modules.c
+++ b/
KernelLand/Kernel/modules.c
@@
-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);
@@
-350,38
+351,40
@@
int Module_LoadFile(const char *Path, const char *ArgString)
Log_Warning("Module", "Module_LoadFile - Unable to load '%s'", Path);
return 0;
}
+
+ // 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);
+ Binary_Unload(base);
+ return 0;
+ }
// 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 )
+ for( loader = gModule_Loaders; loader; loader = loader->Next)
{
- 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;
}
-
+
// Initialise (and register)
- if( Module_int_Initialise( info, ArgString ) )
+ if(
loader ? loader->Loader(base) :
Module_int_Initialise( info, ArgString ) )
{
Binary_Unload(base);
return 0;
UCC
git Repository :: git.ucc.asn.au