From owner-p4-projects@FreeBSD.ORG Tue Feb 12 01:19:03 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 38D6116A420; Tue, 12 Feb 2008 01:19:03 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE45416A417 for ; Tue, 12 Feb 2008 01:19:02 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B487413C455 for ; Tue, 12 Feb 2008 01:19:02 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1C1J2Nw098148 for ; Tue, 12 Feb 2008 01:19:02 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1C1J2EL098145 for perforce@freebsd.org; Tue, 12 Feb 2008 01:19:02 GMT (envelope-from gonzo@FreeBSD.org) Date: Tue, 12 Feb 2008 01:19:02 GMT Message-Id: <200802120119.m1C1J2EL098145@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 135232 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Feb 2008 01:19:03 -0000 http://perforce.freebsd.org/chv.cgi?CH=135232 Change 135232 by gonzo@gonzo_jeeves on 2008/02/12 01:18:18 o Replace mips2 crt1.c with juniper's crt1.c. This is required because exec_setregs registers layout in mips2-jnpr tree differs from one in mips2. Juniper's is more logical and less hackerish: it uses a0 and a3 registers to pass unaligned stack address where arguments resides and ps_strings structs. _start from mips2 uses $sp register for getting arguments and does not pass ps_string struct at all. NOTE: This submit is just a copy from //depot/vendor/juniper-mips branch Affected files ... .. //depot/projects/mips2-jnpr/src/lib/csu/mips/crt1.c#2 edit Differences ... ==== //depot/projects/mips2-jnpr/src/lib/csu/mips/crt1.c#2 (text+ko) ==== @@ -1,10 +1,6 @@ -/* LINTLIBRARY */ /*- - * Copyright 2001 David E. O'Brien. - * All rights reserved. * Copyright 1996-1998 John D. Polstra. * All rights reserved. - * Copyright (c) 1997 Jason R. Thorpe. * Copyright (c) 1995 Christopher G. Demetriou * All rights reserved. * @@ -18,12 +14,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed for the - * FreeBSD Project. See http://www.freebsd.org/ for - * information about FreeBSD. - * This product includes software developed for the - * NetBSD Project. See http://www.netbsd.org/ for - * information about NetBSD. + * This product includes software developed by Christopher G. Demetriou + * for the NetBSD Project. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * @@ -37,31 +29,32 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * FreeBSD: src/lib/csu/alpha/crt1.c,v 1.7.2.1 2000/10/30 20:32:23 obrien */ -#ifndef lint +#include +__FBSDID("$FreeBSD$"); + #ifndef __GNUC__ #error "GCC is needed to compile this file" #endif -#endif /* lint */ #include - #include "libc_private.h" #include "crtbrand.c" -#include struct Struct_Obj_Entry; struct ps_strings; +#ifndef NOSHARED extern int _DYNAMIC; #pragma weak _DYNAMIC +#endif +extern void _init(void); extern void _fini(void); -extern void _init(void); extern int main(int, char **, char **); -extern void _start(int, char **, char **, const struct Struct_Obj_Entry *, - void (*)(void), struct ps_strings *); #ifdef GCRT extern void _mcleanup(void); @@ -72,70 +65,37 @@ char **environ; const char *__progname = ""; -struct ps_strings *__ps_strings; + +void __gccmain(void) {} +void __main(void) {} /* The entry function. */ -__asm(" .text \n" -" .align 8 \n" -" .globl _start \n" -" _start: \n" -" .cpload $25 \n" -" /* 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" -" lw $4, 0($29) \n" -" move $5, $29 \n" -" addu $5, 4 \n" -" \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 \n" -" nop \n" -" j $25\n"); -/* ARGSUSED */ - void -__start(int argc, char **argv, struct ps_strings *ps_strings, - void (*cleanup)(void), const 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) { + if(argc > 0 && argv[0] != NULL) { + const char *s; __progname = argv[0]; for (s = __progname; *s != '\0'; s++) if (*s == '/') __progname = s + 1; } - if (ps_strings != (struct ps_strings *)0) - __ps_strings = ps_strings; - +#ifndef NOSHARED if (&_DYNAMIC != NULL) atexit(cleanup); - else - _init_tls(); - +#endif #ifdef GCRT atexit(_mcleanup); #endif @@ -143,7 +103,9 @@ #ifdef GCRT monstartup(&eprol, &etext); #endif +#ifndef NOGPREL _init(); +#endif exit( main(argc, argv, env) ); } @@ -152,5 +114,3 @@ __asm__("eprol:"); __asm__(".previous"); #endif - -__asm__(".ident\t\"$FreeBSD: src/lib/csu/arm/crt1.c,v 1.3 2004/09/23 23:00:51 cognet Exp $\"");