}\r
#define AddLoaded(a,b) do{}while(0)\r
#define LoadLibrary(a,b,c) (Log_Debug("ELF", "Module requested lib '%s'",a),0)\r
-#define _SysSetMemFlags(ad,f,m) do{}while(0)\r
+static int _SysSetMemFlags(tVAddr addr, int flag, int mask) {\r
+ if( mask & 1 ) {\r
+ if( flag ) {\r
+ // Re-set RO, clear COW\r
+ MM_SetFlags(addr, MM_PFLAG_RO, MM_PFLAG_RO|MM_PFLAG_COW);\r
+ }\r
+ else {\r
+ MM_SetFlags(addr, MM_PFLAG_RO|MM_PFLAG_COW, MM_PFLAG_RO|MM_PFLAG_COW);\r
+ }\r
+ }\r
+ return 0;\r
+}\r
#include "../../../Usermode/Libraries/ld-acess.so_src/elf.c"\r
// ---- / ----\r
\r
VFS_GetMemPath(path, Buffer, Length);
- return Module_LoadFile( path, ArgString );
+ return Module_LoadFile( path, ArgString ) == EOK;
}
/**
// Error check
if(base == NULL) {
Log_Warning("Module", "Module_LoadFile - Unable to load '%s'", Path);
- return 0;
+ return ENOENT;
}
// TODO: I need a way of relocating the dependencies before everything else, so
if( !Binary_Relocate(base) ) {
Log_Warning("Module", "Relocation of module %s failed", Path);
Binary_Unload(base);
- return 0;
+ return EINVAL;
}
// Check for Acess Driver
if( !loader ) {
Binary_Unload(base);
Log_Warning("Module", "Module '%s' does not have a Module Info struct", Path);
- return 0;
+ return EINVAL;
}
}
- if( !Module_int_ResolveDeps(info) ) {
- Log_Warning("Module", "Dependencies not met for '%s'", Path);
- Binary_Unload(base);
- return 0;
+ if( loader )
+ {
+ if( loader->Loader(base) )
+ {
+ Binary_Unload(base);
+ return EINVAL;
+ }
}
-
- // Initialise (and register)
- if( loader ? loader->Loader(base) : Module_int_Initialise( info, ArgString ) )
+ else
{
- Binary_Unload(base);
- return 0;
+ if( !Module_int_ResolveDeps(info) ) {
+ Log_Warning("Module", "Dependencies not met for '%s'", Path);
+ Binary_Unload(base);
+ return EINVAL;
+ }
+
+ if( Module_int_Initialise(info, ArgString) )
+ {
+ Binary_Unload(base);
+ return EINVAL;
+ }
}
- return 1;
+ return 0;
}
/**