Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Dec 2009 08:16:53 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r200893 - projects/mips/lib/csu/mips
Message-ID:  <200912230816.nBN8Grjd090549@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Wed Dec 23 08:16:53 2009
New Revision: 200893
URL: http://svn.freebsd.org/changeset/base/200893

Log:
  Start to add support for N32 and N64 ABIs.
  
  In addition, add a work around for (or maybe you would call it
  increase compatibility with) Cavium toolchain:
  
  	the .cprestore macro references fp rather than sp, so we need
  	to copy sp to fp in a couple of places.
  
  Also add a couple of comments to explain what's going on.
  
  Obtained from:	Cavium FreeBSD/octeon port.

Modified:
  projects/mips/lib/csu/mips/crti.S

Modified: projects/mips/lib/csu/mips/crti.S
==============================================================================
--- projects/mips/lib/csu/mips/crti.S	Wed Dec 23 08:13:44 2009	(r200892)
+++ projects/mips/lib/csu/mips/crti.S	Wed Dec 23 08:16:53 2009	(r200893)
@@ -5,6 +5,13 @@ __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
@@ -13,7 +20,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)
@@ -24,14 +31,30 @@ _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
-	.cprestore 16
+	move	s8, sp		/* See note above */
+	.cprestore 16		/* xxx missing in Cavium's version -- why? */
 	sw	ra, 28(sp)
 #else
 	subu    sp, sp, 32
 	sw	ra, 28(sp)
-#endif
+#endif /* __ABICALLS__ */
+
+#endif /* __mips_n64 || __mips_n32 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912230816.nBN8Grjd090549>