X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Fld-acess.so_src%2Fmain.c;h=85fbc74da90540f8f13825c33ac130b869f5944c;hb=fe2794b4f932c0755674493b6a6da4b60a5c2433;hp=fb9cd3527b324972770d15123fd6f1a7bdbbaa16;hpb=17e16b3110b4c5124b0707435e0427993d696545;p=tpg%2Facess2.git diff --git a/Usermode/Libraries/ld-acess.so_src/main.c b/Usermode/Libraries/ld-acess.so_src/main.c index fb9cd352..85fbc74d 100644 --- a/Usermode/Libraries/ld-acess.so_src/main.c +++ b/Usermode/Libraries/ld-acess.so_src/main.c @@ -12,6 +12,7 @@ // === Imports === extern void gLinkedBase; +extern tLoadedLib gLoadedLibraries[]; // === CODE === /** @@ -22,29 +23,29 @@ extern void gLinkedBase; int SoMain(Uint base, int arg1) { int ret; - - SysDebug("SoMain: base = 0x%x", base); - SysDebug("SoMain: arg1 = 0x%x", arg1); // - Assume that the file pointer will be less than 4096 if(base < 0x1000) { SysDebug("ld-acess - SoMain: Passed file pointer %i\n", base); - SysExit(); + _exit(-1); for(;;); } // Check if we are being called directly if(base == (Uint)&gLinkedBase) { SysDebug("ld-acess should not be directly called\n"); - SysExit(); + _exit(1); for(;;); } + + gLoadedLibraries[0].Base = (Uint)&gLinkedBase; + gLoadedLibraries[0].Name = "/Acess/Libs/libld-acess.so"; // Otherwise do relocations //ret = DoRelocate( base, envp, "Executable" ); ret = DoRelocate( base, NULL, "Executable" ); if( ret == 0 ) { SysDebug("ld-acess - SoMain: Relocate failed, base=0x%x\n", base); - SysExit(); + _exit(-1); for(;;); } @@ -70,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", *(Uint8*)(base), *(Uint8*)(base+1), *(Uint8*)(base+2), *(Uint8*)(base+3) ); SysDebug("ld-acess - DoRelocate: File '%s'\n", Filename); - SysExit(); + _exit(-1); for(;;); } @@ -79,11 +80,11 @@ int DoRelocate( Uint base, char **envp, char *Filename ) */ int CallUser(Uint entry, Uint sp) { - SysDebug("CallUser: (entry=0x%x, sp=0x%x)", entry, sp); + //SysDebug("CallUser: (entry=0x%x, sp=0x%x)", entry, sp); *(Uint*)(sp-4) = 0; // Clear return address __asm__ __volatile__ ( "mov %%eax, %%esp;\n\t" "jmp *%%ecx" - : : "a"(sp-4), "c"(entry)); + : : "a"(sp), "c"(entry)); for(;;); }