diff options
-rw-r--r-- | ldso/ldso/powerpc/dl-startup.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h index 8f67c3610..d86dd13c7 100644 --- a/ldso/ldso/powerpc/dl-startup.h +++ b/ldso/ldso/powerpc/dl-startup.h @@ -10,12 +10,34 @@ asm( " .type _start,@function\n" "_start:\n" " mr 3,1\n" /* Pass SP to _dl_start in r3 */ - " addi 1,1,-16\n" /* Make room on stack for _dl_start to store LR */ - " li 4,0\n" - " stw 4,0(1)\n" /* Clear Stack frame */ + " li 0,0\n" + " stwu 1,-16(1)\n" /* Make room on stack for _dl_start to store LR */ + " stw 0,0(1)\n" /* Clear Stack frame */ " bl _dl_start@local\n" /* Perform relocation */ + /* Save the address of the apps entry point in CTR register */ + " mtctr 3\n" /* application entry point */ + " bl _GLOBAL_OFFSET_TABLE_-4@local\n" /* Put our GOT pointer in r31, */ + " mflr 31\n" " addi 1,1,16\n" /* Restore SP */ - " mtctr 3\n" /* Load applications entry point */ +#if 0 + /* Try beeing SVR4 ABI compliant?, even though it is not needed for uClibc on Linux */ + /* argc */ + " lwz 3,0(1)\n" + /* find argv one word offset from the stack pointer */ + " addi 4,1,4\n" + /* find environment pointer (argv+argc+1) */ + " lwz 5,0(1)\n" + " addi 5,5,1\n" + " rlwinm 5,5,2,0,29\n" + " add 5,5,4\n" + /* pass the auxilary vector in r6. This is passed to us just after _envp. */ + "2: lwzu 0,4(6)\n" + " cmpwi 0,0\n" + " bne 2b\n" + " addi 6,6,4\n" +#endif + /* Pass a termination function pointer (in this case _dl_fini) in r7. */ + " lwz 7,_dl_fini@got(31)\n" " bctr\n" /* Jump to entry point */ " .size _start,.-_start\n" " .previous\n" |