X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FLibraries%2Fld-acess.so_src%2Fmain.c;h=985f9c8cf04e74529a78b96de182bc72e8d5334e;hb=04a050f42807686dc119838c82372409246d55bb;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..985f9c8c 100644 --- a/Usermode/Libraries/ld-acess.so_src/main.c +++ b/Usermode/Libraries/ld-acess.so_src/main.c @@ -3,17 +3,18 @@ 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 char gLinkedBase[]; extern tLoadedLib gLoadedLibraries[]; +char **gEnvP; +extern int memcmp(const void *m1, const void *m2, size_t size); // === CODE === /** @@ -21,10 +22,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); @@ -61,7 +64,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 +101,8 @@ int CallUser(void *entry, void *sp) #endif for(;;); } + +void abort(void) +{ + _exit(-4); +}