summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-08-18 09:26:17 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2004-08-18 09:26:17 +0000
commiteb4a09605477c67962df48f0760a8e94e2b49507 (patch)
tree10bce83cb2a1c87843804d3ae08833b95b9ffbd1 /ldso
parentec448a42f4a100b3c692f75e6dc7c8b6c16681a0 (diff)
Clean up the _dl_boot code and make it similar to arm and sh.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/powerpc/dl-startup.h44
1 files changed, 18 insertions, 26 deletions
diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h
index f8e14e0ba..37d3cf0fd 100644
--- a/ldso/ldso/powerpc/dl-startup.h
+++ b/ldso/ldso/powerpc/dl-startup.h
@@ -4,20 +4,25 @@
/* Overrive the default _dl_boot function, and replace it with a bit of asm.
* Then call the real _dl_boot function, which is now named _dl_boot2. */
-
-asm("" \
-" .text\n" \
-" .globl _dl_boot\n" \
-"_dl_boot:\n" \
-" mr 3,1\n" \
-" li 4,0\n" \
-" addi 1,1,-16\n" \
-" stw 4,0(1)\n" \
-" bl _dl_boot2\n" \
-".previous\n" \
+asm(
+ " .text\n"
+ " .globl _dl_boot\n"
+ " .type _dl_boot,@function\n"
+ "_dl_boot:\n"
+ " mr 3,1\n" /* Pass SP to _dl_boot2 in r3 */
+ " addi 1,1,-16\n" /* Make room on stack for _dl_boot2 to store LR */
+ " li 4,0\n"
+ " stw 4,0(1)\n" /* Clear Stack frame */
+ " bl _dl_boot2@local\n" /* Perform relocation */
+ " addi 1,1,16\n" /* Restore SP */
+ " mtctr 3\n" /* Load applications entry point */
+ " bctr\n" /* Jump to entry point */
+ " .size _dl_boot,.-_dl_boot\n"
+ " .previous\n"
);
-#define DL_BOOT(X) static void __attribute_used__ _dl_boot2(X)
+
+#define DL_BOOT(X) static void* __attribute_used__ _dl_boot2(X)
/*
* Get a pointer to the argv array. On many platforms this can be just
@@ -53,17 +58,4 @@ asm("" \
* is done. This routine has to exit the current function, then
* call the _dl_elf_main function.
*/
-
-/*
- * Use "b"(Address base register) operand for %1 since "b" excludes
- * r0 which is important for the addi instruction in this case.
- */
-#define START() \
- __asm__ volatile ( \
- "addi 1,%1,0\n\t" \
- "mtlr %0\n\t" \
- "blrl\n\t" \
- : : "r" (_dl_elf_main), "b" (args))
-
-
-
+#define START() return _dl_elf_main