X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Fld-acess.so_src%2Fmain.c;h=e379a70af18848c4327aef942c24c831ddfc9226;hb=d4b689239171d6786d20accfa3e8db7688271a68;hp=ccdf6b428dd079169a6922e732f73e56f2a3b7f7;hpb=9867382061f9035d65e118d95fa819c0e615f353;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 ccdf6b42..e379a70a 100644 --- a/Usermode/Libraries/ld-acess.so_src/main.c +++ b/Usermode/Libraries/ld-acess.so_src/main.c @@ -3,17 +3,17 @@ By thePowersGang */ #include +#include #include "common.h" // === PROTOTYPES === void *DoRelocate(void *base, char **envp, const char *Filename); int CallUser(void *Entry, void *SP); -void *ElfRelocate(void *Base, char **envp, const char *Filename); -void *PE_Relocate(void *Base, char **envp, const char *Filename); // === Imports === -extern void gLinkedBase; -extern tLoadedLib gLoadedLibraries[]; +extern char gLinkedBase[]; +char **gEnvP; +extern int memcmp(const void *m1, const void *m2, size_t size); // === CODE === /** @@ -21,10 +21,12 @@ extern tLoadedLib gLoadedLibraries[]; \brief Library entry point \note This is the entrypoint for the library */ -void *SoMain(void *base) +void *SoMain(void *base, int argc, char **argv, char **envp) { void *ret; + gEnvP = envp; + // - Assume that the file pointer will be less than 4096 if((intptr_t)base < 0x1000) { SysDebug("ld-acess - SoMain: Passed file pointer %i\n", base); @@ -38,10 +40,6 @@ void *SoMain(void *base) for(;;); } - gLoadedLibraries[0].Base = &gLinkedBase; - // 'libld-acess.so' because that is what applications link against - gLoadedLibraries[0].Name = "/Acess/Libs/libld-acess.so"; - // Otherwise do relocations //ret = DoRelocate( base, envp, "Executable" ); ret = DoRelocate( base, NULL, "Executable" ); @@ -61,7 +59,7 @@ void *SoMain(void *base) */ void *DoRelocate(void *base, char **envp, const char *Filename) { - Uint8 *hdr = base; + uint8_t *hdr = base; // Load Executable if(memcmp(base, "\x7F""ELF", 4) == 0) return ElfRelocate(base, envp, Filename); @@ -98,3 +96,8 @@ int CallUser(void *entry, void *sp) #endif for(;;); } + +void abort(void) +{ + _exit(-4); +}