From owner-p4-projects@FreeBSD.ORG Tue Oct 24 22:33:49 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A10DB16A47C; Tue, 24 Oct 2006 22:33:49 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BEDB16A417 for ; Tue, 24 Oct 2006 22:33:49 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41F6943D45 for ; Tue, 24 Oct 2006 22:33:49 +0000 (GMT) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9OMXnUY096915 for ; Tue, 24 Oct 2006 22:33:49 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9OMXmdE096912 for perforce@freebsd.org; Tue, 24 Oct 2006 22:33:48 GMT (envelope-from gonzo@FreeBSD.org) Date: Tue, 24 Oct 2006 22:33:48 GMT Message-Id: <200610242233.k9OMXmdE096912@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 108362 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, 24 Oct 2006 22:33:49 -0000 http://perforce.freebsd.org/chv.cgi?CH=108362 Change 108362 by gonzo@gonzo_hq on 2006/10/24 22:33:25 o Set argc & argv for __start function. o Get env and environ variables from argc & argv values. Affected files ... .. //depot/projects/mips2/src/lib/csu/mips/crt1.c#2 edit Differences ... ==== //depot/projects/mips2/src/lib/csu/mips/crt1.c#2 (text+ko) ==== @@ -51,6 +51,7 @@ #include "crtbrand.c" #include +typedef void (*fptr)(void); struct Struct_Obj_Entry; struct ps_strings; @@ -72,24 +73,34 @@ char **environ; const char *__progname = ""; -struct ps_strings *__ps_strings; /* The entry function. */ __asm(" .text \n" " .align 8 \n" " .globl _start \n" " _start: \n" -" /* TODO: Get argc, argv, and envp from stack */ \n" +" /* Get argc, argv from stack */ \n" +" \n" +" /* lw a0, -32(sp) */\n" +" /* move a1, sp */\n" +" /* addu a1, 32 + 4 */\n" +" \n" +" lw $4, -32($29) \n" +" move $5, $29 \n" +" addu $5, 36 \n" " /* TODO: Ensure the stack is properly aligned before calling C code. */\n" "\n" " j __start "); /* ARGSUSED */ void -__start(int argc, char **argv, char **env, struct ps_strings *ps_strings, - const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void)) +__start(int argc, char **argv) { + char **env; const char *s; + /* XXXMIPS: proper set a cleanup procedure */ + fptr cleanup = NULL; + env = argv + argc + 1; environ = env; if (argc > 0 && argv[0] != NULL) { @@ -99,9 +110,6 @@ __progname = s + 1; } - if (ps_strings != (struct ps_strings *)0) - __ps_strings = ps_strings; - if (&_DYNAMIC != NULL) atexit(cleanup); else