svn commit: trunk/uClibc/ldso/ldso/m68k

vapier at uclibc.org vapier at uclibc.org
Sat Jan 14 07:14:42 UTC 2006


Author: vapier
Date: 2006-01-13 23:14:40 -0800 (Fri, 13 Jan 2006)
New Revision: 13308

Log:
fixup so we can at least get to the ldso Standalone execution step

Modified:
   trunk/uClibc/ldso/ldso/m68k/dl-startup.h


Changeset:
Modified: trunk/uClibc/ldso/ldso/m68k/dl-startup.h
===================================================================
--- trunk/uClibc/ldso/ldso/m68k/dl-startup.h	2006-01-14 06:59:09 UTC (rev 13307)
+++ trunk/uClibc/ldso/ldso/m68k/dl-startup.h	2006-01-14 07:14:40 UTC (rev 13308)
@@ -4,23 +4,43 @@
  * Copyright (C) 2005 by Erik Andersen <andersen at codepoet.org>
  */
 
-asm(
-    "	.text\n"
-    "	.globl	_start\n"
-    "	.type	_start, at function\n"
-    "_start:\n"
-    "	.set	_start,_dl_start\n"
-    "	.size	_start,.-_start\n"
-    "	.previous\n"
-);
+asm ("\
+	.text\n\
+	.globl _start\n\
+	.type _start, at function\n\
+_start:\n\
+	move.l %sp, -(%sp)\n\
+	jbsr _dl_start\n\
+	addq.l #4, %sp\n\
+	# Save the user entry point address in %a4.\n\
+	move.l %d0, %a4\n\
+	# See if we were run as a command with the executable file\n\
+	# name as an extra leading argument.\n\
+	move.l _dl_skip_args(%pc), %d0\n\
+	# Pop the original argument count\n\
+	move.l (%sp)+, %d1\n\
+	# Subtract _dl_skip_args from it.\n\
+	sub.l %d0, %d1\n\
+	# Adjust the stack pointer to skip _dl_skip_args words.\n\
+	lea (%sp, %d0*4), %sp\n\
+	# Push back the modified argument count.\n\
+	move.l %d1, -(%sp)\n\
+	# Pass our finalizer function to the user in %a1.\n\
+	lea _dl_fini(%pc), %a1\n\
+	# Initialize %fp with the stack pointer.\n\
+	move.l %sp, %fp\n\
+	# Jump to the user's entry point.\n\
+	jmp (%a4)\n\
+	.size _dl_start_user, . - _dl_start_user\n\
+	.previous");
 
 /* Get a pointer to the argv array.  On many platforms this can be just
  * the address if the first argument, on other platforms we need to
  * do something a little more subtle here.  */
-#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned int *) & ARGS)
+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *) ARGS) + 1)
 
 /* Handle relocation of the symbols in the dynamic loader. */
-static inline
+static __always_inline
 void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
 	unsigned long symbol_addr, unsigned long load_addr, Elf32_Sym *symtab)
 {
@@ -63,8 +83,4 @@
 /* Transfer control to the user's application, once the dynamic loader is
  * done.  This routine has to exit the current function, then call the
  * _dl_elf_main function.  */
-#define START() \
-	__asm__ volatile ( \
-		"unlk %%a6\n\t" \
-		"jmp %0@" \
-		: : "a" (_dl_elf_main));
+#define START() return _dl_elf_main




More information about the uClibc-cvs mailing list