Build fixes
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / main.c
index 678dc9a..4f2ef88 100644 (file)
@@ -12,6 +12,7 @@
 \r
 // === Imports ===\r
 extern void    gLinkedBase;\r
+extern tLoadedLib      gLoadedLibraries[];\r
  \r
 // === CODE ===\r
 /**\r
@@ -26,22 +27,25 @@ int SoMain(Uint base, int arg1)
        // - Assume that the file pointer will be less than 4096\r
        if(base < 0x1000) {\r
                SysDebug("ld-acess - SoMain: Passed file pointer %i\n", base);\r
-               SysExit();\r
+               _exit(-1);\r
                for(;;);\r
        }\r
        // Check if we are being called directly\r
        if(base == (Uint)&gLinkedBase) {\r
                SysDebug("ld-acess should not be directly called\n");\r
-               SysExit();\r
+               _exit(1);\r
                for(;;);\r
        }\r
+\r
+       gLoadedLibraries[0].Base = (Uint)&gLinkedBase;\r
+       gLoadedLibraries[0].Name = "ld-acess.so";\r
        \r
        // Otherwise do relocations\r
        //ret = DoRelocate( base, envp, "Executable" );\r
        ret = DoRelocate( base, NULL, "Executable" );\r
        if( ret == 0 ) {\r
                SysDebug("ld-acess - SoMain: Relocate failed, base=0x%x\n", base);\r
-               SysExit();\r
+               _exit(-1);\r
                for(;;);\r
        }\r
        \r
@@ -67,7 +71,7 @@ int DoRelocate( Uint base, char **envp, char *Filename )
        SysDebug("ld-acess - DoRelocate: Unkown file format '0x%x 0x%x 0x%x 0x%x'\n",\r
                *(Uint8*)(base), *(Uint8*)(base+1), *(Uint8*)(base+2), *(Uint8*)(base+3) );\r
        SysDebug("ld-acess - DoRelocate: File '%s'\n", Filename);\r
-       SysExit();\r
+       _exit(-1);\r
        for(;;);\r
 }\r
 \r

UCC git Repository :: git.ucc.asn.au