From owner-svn-src-projects@FreeBSD.ORG Wed Dec 23 08:16:53 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1A7A1065676; Wed, 23 Dec 2009 08:16:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B106A8FC21; Wed, 23 Dec 2009 08:16:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBN8GrKU090551; Wed, 23 Dec 2009 08:16:53 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBN8Grjd090549; Wed, 23 Dec 2009 08:16:53 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200912230816.nBN8Grjd090549@svn.freebsd.org> From: Warner Losh Date: Wed, 23 Dec 2009 08:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200893 - projects/mips/lib/csu/mips X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2009 08:16:53 -0000 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 */