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
More work on UDI, cleanup and pseudod should now load.
[tpg/acess2.git]
/
Kernel
/
modules.c
diff --git
a/Kernel/modules.c
b/Kernel/modules.c
index
eec5020
..
93de973
100644
(file)
--- a/
Kernel/modules.c
+++ b/
Kernel/modules.c
@@
-2,9
+2,12
@@
* Acess2
* - Module Loader
*/
* Acess2
* - Module Loader
*/
-#include <
common
.h>
+#include <
acess
.h>
#include <modules.h>
#include <modules.h>
+#define USE_EDI 0
+#define USE_UDI 1
+
// === PROTOTYPES ===
int Modules_LoadBuiltins();
int Module_LoadMem(void *Buffer, Uint Length, char *ArgString);
// === PROTOTYPES ===
int Modules_LoadBuiltins();
int Module_LoadMem(void *Buffer, Uint Length, char *ArgString);
@@
-13,6
+16,9
@@
int Module_IsLoaded(char *Name);
// === IMPORTS ===
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;
extern void StartupPrint(char *Str);
extern tModule gKernelModules[];
extern void gKernelModulesEnd;
@@
-98,9
+104,13
@@
int Modules_LoadBuiltins()
gKernelModules[i].Name,
gKernelModules[i].Version>>8, gKernelModules[i].Version & 0xFF
);
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
// Mark as loaded
- baIsLoaded[i] = 1;
+ else
+ baIsLoaded[i] = 1;
numToInit --;
}
}
numToInit --;
}
}
@@
-116,7
+126,7
@@
int Module_LoadMem(void *Buffer, Uint Length, char *ArgString)
{
char path[VFS_MEMPATH_SIZE];
{
char path[VFS_MEMPATH_SIZE];
- VFS_GetMemPath(
Buffer, Length, pa
th);
+ VFS_GetMemPath(
path, Buffer, Leng
th);
return Module_LoadFile( path, ArgString );
}
return Module_LoadFile( path, ArgString );
}
@@
-134,26
+144,37
@@
int Module_LoadFile(char *Path, char *ArgString)
base = Binary_LoadKernel(Path);
// Error check
base = Binary_LoadKernel(Path);
// Error check
- if(base == NULL) return 0;
+ if(base == NULL) {
+ Warning("Module_LoadFile: Unable to load '%s'", Path);
+ return 0;
+ }
// Check for Acess Driver
if( Binary_FindSymbol(base, "DriverInfo", (Uint*)&info ) == 0 )
{
#if USE_EDI
// Check for EDI Driver
// Check for Acess Driver
if( Binary_FindSymbol(base, "DriverInfo", (Uint*)&info ) == 0 )
{
#if USE_EDI
// Check for EDI Driver
- if( Binary_FindSymbol(base, "driver_init", NULL )
=
= 0 )
+ if( Binary_FindSymbol(base, "driver_init", NULL )
!
= 0 )
{
Binary_Relocate(base); // Relocate
return Module_InitEDI( base ); // And intialise
}
#endif
{
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
// Unknown module type?, return error
Binary_Unload(base);
#if USE_EDI
- Warning("Module_Load
Mem
: Module has neither a Module Info struct, nor an EDI entrypoint");
+ Warning("Module_Load
File
: Module has neither a Module Info struct, nor an EDI entrypoint");
#else
#else
- Warning("Module_Load
Mem
: Module does not have a Module Info struct");
+ Warning("Module_Load
File
: Module does not have a Module Info struct");
#endif
return 0;
}
#endif
return 0;
}
@@
-161,14
+182,14
@@
int Module_LoadFile(char *Path, char *ArgString)
// Check magic number
if(info->Magic != MODULE_MAGIC)
{
// Check magic number
if(info->Magic != MODULE_MAGIC)
{
- Warning("Module_Load
Mem
: Module's magic value is invalid (0x%x != 0x%x)", info->Magic, MODULE_MAGIC);
+ Warning("Module_Load
File
: Module's magic value is invalid (0x%x != 0x%x)", info->Magic, MODULE_MAGIC);
return 0;
}
// Check Architecture
if(info->Arch != MODULE_ARCH_ID)
{
return 0;
}
// Check Architecture
if(info->Arch != MODULE_ARCH_ID)
{
- Warning("Module_Load
Mem
: Module is for a different architecture");
+ Warning("Module_Load
File
: Module is for a different architecture");
return 0;
}
return 0;
}
UCC
git Repository :: git.ucc.asn.au