\r
// === Imports ===\r
extern void gLinkedBase;\r
+extern tLoadedLib gLoadedLibraries[];\r
\r
// === CODE ===\r
/**\r
int SoMain(Uint base, int arg1)\r
{\r
int ret;\r
- \r
- SysDebug("SoMain: base = 0x%x", base);\r
- SysDebug("SoMain: arg1 = 0x%x", arg1);\r
\r
// - 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 = "/Acess/Libs/libld-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
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
*/\r
int CallUser(Uint entry, Uint sp)\r
{\r
- SysDebug("CallUser: (entry=0x%x, sp=0x%x)", entry, sp);\r
+ //SysDebug("CallUser: (entry=0x%x, sp=0x%x)", entry, sp);\r
*(Uint*)(sp-4) = 0; // Clear return address\r
__asm__ __volatile__ (\r
"mov %%eax, %%esp;\n\t"\r
"jmp *%%ecx"\r
- : : "a"(sp-4), "c"(entry));\r
+ : : "a"(sp), "c"(entry));\r
for(;;);\r
}\r