8 #define MODULE_MAGIC ('A'|('M'<<8)|('D'<<16)|('\2'<<24))
10 // IA32 - Architecture 1
12 # define MODULE_ARCH_ID 1
13 // IA64 - Architecture 2
15 # define MODULE_ARCH_ID 2
17 # error "Unknown architecture when determining MODULE_ARCH_ID ('" #ARCHDIR "')"
20 #define MODULE_DEFINE(_flags,_ver,_ident,_entry,_deinit,_deps...) \
21 char *EXPAND_CONCAT(_DriverDeps_,_ident)[]={_deps};\
22 tModule __attribute__ ((section ("KMODULES"),unused))\
23 EXPAND_CONCAT(_DriverInfo_,_ident)=\
24 {MODULE_MAGIC,MODULE_ARCH_ID,_flags,_ver,NULL,EXPAND_STR(_ident),\
25 _entry,_deinit,EXPAND_CONCAT(_DriverDeps_,_ident)}
27 typedef struct sModule {
34 int (*Init)(char **Arguments);
36 char **Dependencies; // NULL Terminated List
37 } __attribute__((packed)) tModule;
39 #define MODULE_INIT_SUCCESS 1
40 #define MODULE_INIT_FAILURE 0
43 * \brief Module Loader definition
45 * Allows a module to extend the loader to recognise other module types
46 * E.g. EDI, UDI, Windows, Linux, ...
48 typedef struct sModuleLoader {
49 struct sModuleLoader *Next; //!< Kernel Only - Next loader in list
50 char *Name; //!< Friendly name for the loader
51 int (*Detector)(void *Base); //!< Simple detector function
52 int (*Loader)(void *Base); //!< Initialises the module
53 int (*Unloader)(void *Base); //!< Calls module's cleanup
54 } PACKED tModuleLoader;
57 * \brief Registers a tModuleLoader with the kernel
58 * \param Loader Pointer to loader structure (must be persistent)
60 extern int Module_RegisterLoader(tModuleLoader *Loader);