[uClibc-cvs] CVS update of uClibc/ldso/ldso/powerpc (dl-startup.h)

Joakim Tjernlund jocke at codepoet.org
Wed Aug 18 09:26:18 UTC 2004


    Date: Wednesday, August 18, 2004 @ 03:26:18
  Author: jocke
    Path: /var/cvs/uClibc/ldso/ldso/powerpc

Modified: dl-startup.h (1.12 -> 1.13)

Clean up the _dl_boot code and make it similar to arm and sh.


Index: uClibc/ldso/ldso/powerpc/dl-startup.h
diff -u uClibc/ldso/ldso/powerpc/dl-startup.h:1.12 uClibc/ldso/ldso/powerpc/dl-startup.h:1.13
--- uClibc/ldso/ldso/powerpc/dl-startup.h:1.12	Fri Aug  6 10:11:43 2004
+++ uClibc/ldso/ldso/powerpc/dl-startup.h	Wed Aug 18 03:26:17 2004
@@ -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, at 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 at 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 @@
  * 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



More information about the uClibc-cvs mailing list