svn commit: r201639 - projects/mips/lib/csu/mips

Warner Losh imp at FreeBSD.org
Wed Jan 6 12:15:10 UTC 2010


Author: imp
Date: Wed Jan  6 12:15:10 2010
New Revision: 201639
URL: http://svn.freebsd.org/changeset/base/201639

Log:
  Revert r200892, 200893 and 200894.  There's companion changes
  elsewhere that aren't quite ready, and these break the world in the
  mean time.

Modified:
  projects/mips/lib/csu/mips/crt1.c
  projects/mips/lib/csu/mips/crti.S
  projects/mips/lib/csu/mips/crtn.S

Modified: projects/mips/lib/csu/mips/crt1.c
==============================================================================
--- projects/mips/lib/csu/mips/crt1.c	Wed Jan  6 10:41:27 2010	(r201638)
+++ projects/mips/lib/csu/mips/crt1.c	Wed Jan  6 12:15:10 2010	(r201639)
@@ -1,4 +1,6 @@
 /*-
+ * Copyright 1996-1998 John D. Polstra.
+ * All rights reserved.
  * Copyright (c) 1995 Christopher G. Demetriou
  * All rights reserved.
  *
@@ -63,94 +65,37 @@ extern int etext;
 
 char **environ;
 const char *__progname = "";
-struct ps_strings *__ps_strings;
 
 void __gccmain(void) {}
 void __main(void) {}
 
-/*
- * Historically, mips has used __start for the beginning address of programs.
- * However, the Cavium toolchain (and maybe others) use _start.  Define both
- * here.  The assembler code here tries to juggle the arguments such that they
- * are right for all ABIs and then calls __start_mips which is what used to
- * be just plain __start, and still is on other BSD ports.
- */
-
 /* The entry function. */
-__asm("	.text			\n"
-"	.align	8		\n"
-"	.globl	_start		\n"
-"	_start:			\n"
-"	.globl	__start		\n"
-"	__start:		\n"
-#if defined(__mips_n32) || defined(__mips_n64)
-"	.cpsetup $25, $24, __start\n"
-#else
-"	.set noreorder		\n"
-"	.cpload $25		\n"
-"	.set reorder		\n"
-#endif
-"	/* Get cleanup routine and main object set by rtld */\n"
-"	/* Note that a2 is already set to ps_string by _rtld_start */\n"
-"	/* move	a3, a0        */\n"
-"	/* move	t0, a1        */\n"
-"	/* Get argc, argv from stack */	\n"
-"	/* lw	a0, 0(sp)     */\n"
-"	/* move	a1, sp        */\n"
-"	/* addu	a1, 4         */\n"
-"				\n"
-"	/* Stack should 8bytes aligned */\n"
-"	/* required by ABI to pass     */\n"
-"	/* 64-bits arguments           */\n"
-"	/* and	sp, ~8        */\n"
-"	/* subu	sp, sp, 20    */\n"
-"	/* sw	t0, 16(sp)    */\n"
-"				\n"
-"	move	$7, $4		/* atexit */\n"
-"	move	$8, $5		/* main_obj entry */\n"
-#if defined(__mips_n64)
-"	ld	$4, 0($29)	\n"
-"	move	$5, $29		\n"
-"	addu	$5, 8		\n"
-#else
-"	lw	$4, 0($29)	\n"
-"	move	$5, $29		\n"
-"	addu	$5, 4		\n"
-#endif
-"				\n"
-"	and	$29, 0xfffffff8	\n"
-"	subu	$29, $29, 24	/* args slot + cleanup + 4 bytes padding */ \n"
-"	sw	$8, 16($29)	\n"
-"\n"
-"	la	 $25, __start_mips  \n"
-"	nop	 \n"
-"	j	 $25\n");
-/* ARGSUSED */
-
 void
-__start_mips(int argc, char **argv, struct ps_strings *ps_strings,
-    void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused)
+__start(char **ap,
+	void (*cleanup)(void),			/* from shared loader */
+	struct Struct_Obj_Entry *obj,		/* from shared loader */
+	struct ps_strings *ps_strings)
 {
+	int argc;
+	char **argv;
 	char **env;
-	const char *s;
 
-	env  = argv + argc + 1;
+	argc = * (long *) ap;
+	argv = ap + 1;
+	env  = ap + 2 + argc;
 	environ = env;
-
 	if(argc > 0 && argv[0] != NULL) {
+		const char *s;
 		__progname = argv[0];
 		for (s = __progname; *s != '\0'; s++)
 			if (*s == '/')
 				__progname = s + 1;
 	}
 
-	__ps_strings = ps_strings;
-
+#ifndef NOSHARED
 	if (&_DYNAMIC != NULL)
 		atexit(cleanup);
-	else
-		_init_tls();
-
+#endif
 #ifdef GCRT
 	atexit(_mcleanup);
 #endif

Modified: projects/mips/lib/csu/mips/crti.S
==============================================================================
--- projects/mips/lib/csu/mips/crti.S	Wed Jan  6 10:41:27 2010	(r201638)
+++ projects/mips/lib/csu/mips/crti.S	Wed Jan  6 12:15:10 2010	(r201639)
@@ -5,13 +5,6 @@ __FBSDID("$FreeBSD$");
 	.align 4
 	.globl	_init
 	.type	_init,%function
-	
-	/*
-	 * The Cavium toolchain apparently has code that references $fp
-	 * instead of $sp for the .cprestore 16 macro.  The move doesn't
-	 * hurt on other toolchains, so unconditionally compile it in for
-	 * now.
-	 */
 _init:
 #ifdef __ABICALLS__
 	.set   noreorder
@@ -20,7 +13,7 @@ _init:
 	subu	sp, sp, 32
 	.cprestore 16
 	sw	ra, 28(sp)
-	move	s8, sp		/* See note above */
+
 #else
 	subu	sp, sp, 32
 	sw	ra, 28(sp)
@@ -31,30 +24,14 @@ _init:
 	.globl	_fini
 	.type	_fini,%function
 _fini:
-	
-#if defined (__mips_n64) || defined (__mips_n32)
-#ifdef __ABICALLS__
-	subu	sp, sp, 32
-	sw	gp, 16(sp)
-	sw	ra, 28(sp)
-	move	s8, sp
-#else
-	subu	sp, sp, 32
-	sw	ra, 28(sp)
-#endif /*__ABICALLS__*/
-
-#else
 #ifdef __ABICALLS__
 	.set   noreorder
 	.cpload $25
 	.set   reorder
 	subu	sp, sp, 32
-	move	s8, sp		/* See note above */
-	.cprestore 16		/* xxx missing in Cavium's version -- why? */
+	.cprestore 16
 	sw	ra, 28(sp)
 #else
 	subu    sp, sp, 32
 	sw	ra, 28(sp)
-#endif /* __ABICALLS__ */
-
-#endif /* __mips_n64 || __mips_n32 */
+#endif

Modified: projects/mips/lib/csu/mips/crtn.S
==============================================================================
--- projects/mips/lib/csu/mips/crtn.S	Wed Jan  6 10:41:27 2010	(r201638)
+++ projects/mips/lib/csu/mips/crtn.S	Wed Jan  6 12:15:10 2010	(r201639)
@@ -9,9 +9,6 @@ __FBSDID("$FreeBSD$");
 
 	.section .fini,"ax",%progbits
 	lw	ra, 28(sp)
-#if defined(__mips_n64) || defined(__mips_n32)
-	lw	gp, 16(sp)
-#endif
 	.set	noreorder
 	j	ra
 	addu	sp, sp, 32


More information about the svn-src-projects mailing list