From: John Hodge Date: Thu, 3 Nov 2011 14:12:35 +0000 (+0800) Subject: Usermode/ld-acess - Fixed lack of envp X-Git-Tag: rel0.14~160 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=c9f3dc274e9e95b07966bc50c02b73887822556a;p=tpg%2Facess2.git Usermode/ld-acess - Fixed lack of envp --- diff --git a/Usermode/Libraries/ld-acess.so_src/_stublib.c b/Usermode/Libraries/ld-acess.so_src/_stublib.c index 347b32ff..abf80435 100644 --- a/Usermode/Libraries/ld-acess.so_src/_stublib.c +++ b/Usermode/Libraries/ld-acess.so_src/_stublib.c @@ -22,3 +22,5 @@ int32_t __modsi3(int32_t Num, int32_t Den){return 0;} uint32_t __udivsi3(uint32_t Num, uint32_t Den){return 0;} uint32_t __umodsi3(uint32_t Num, uint32_t Den){return 0;} +void *_crt0_exit_handler; + diff --git a/Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h b/Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h index d8823d7b..a1c973bd 100644 --- a/Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h +++ b/Usermode/Libraries/ld-acess.so_src/arch/armv7.S.h @@ -8,6 +8,7 @@ .extern SoMain _start: pop {r0} + ldm sp, {r1,r2,r3} bl SoMain mov r4, r0 diff --git a/Usermode/Libraries/ld-acess.so_src/loadlib.c b/Usermode/Libraries/ld-acess.so_src/loadlib.c index eec3dee2..3f8e6742 100644 --- a/Usermode/Libraries/ld-acess.so_src/loadlib.c +++ b/Usermode/Libraries/ld-acess.so_src/loadlib.c @@ -23,6 +23,7 @@ extern const struct { char *Name; } caLocalExports[]; extern const int ciNumLocalExports; +extern char **gEnvP; // === GLOABLS === tLoadedLib gLoadedLibraries[MAX_LOADED_LIBRARIES]; @@ -90,7 +91,7 @@ void *LoadLibrary(const char *SoName, const char *SearchDir, char **envp) // Call Entrypoint DEBUGS(" LoadLibrary: '%s' Entry %p", SoName, fEntry); - fEntry(base, 0, NULL, envp); + fEntry(base, 0, NULL, gEnvP); DEBUGS("LoadLibrary: RETURN 1"); return base; diff --git a/Usermode/Libraries/ld-acess.so_src/main.c b/Usermode/Libraries/ld-acess.so_src/main.c index ff715bb3..59b7ef16 100644 --- a/Usermode/Libraries/ld-acess.so_src/main.c +++ b/Usermode/Libraries/ld-acess.so_src/main.c @@ -13,6 +13,7 @@ void *DoRelocate(void *base, char **envp, const char *Filename); // === Imports === extern char gLinkedBase[]; extern tLoadedLib gLoadedLibraries[]; +char **gEnvP; // === CODE === /** @@ -20,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);