p4-projects@freebsd.org
[Top] [All Lists]

PERFORCE change 115070 for review

Subject: PERFORCE change 115070 for review
From: Oleksandr Tymoshenko
Date: Mon, 26 Feb 2007 17:24:35 GMT
http://perforce.freebsd.org/chv.cgi?CH=115070

Change 115070 by gonzo@gonzo_jeeves on 2007/02/26 17:23:47

        o Pass obj_main, ps_strings and cleanup procedure 
            as arguments to __start.

Affected files ...

.. //depot/projects/mips2/src/lib/csu/mips/crt1.c#6 edit

Differences ...

==== //depot/projects/mips2/src/lib/csu/mips/crt1.c#6 (text+ko) ====

@@ -51,7 +51,6 @@
 #include "crtbrand.c"
 #include <machine/asm.h>
 
-typedef void (*fptr)(void);
 struct Struct_Obj_Entry;
 struct ps_strings;
 
@@ -73,6 +72,7 @@
 
 char **environ;
 const char *__progname = "";
+struct ps_strings *__ps_strings;
 
 /* The entry function. */
 __asm("        .text                   \n"
@@ -80,6 +80,10 @@
 "      .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"
@@ -89,12 +93,18 @@
 "      /* 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"
@@ -102,12 +112,11 @@
 /* ARGSUSED */
 
 void
-__start(int argc, char **argv)
+__start(int argc, char **argv, struct ps_strings *ps_strings,
+     void (*cleanup)(void), const struct Struct_Obj_Entry *obj __unused)
 {
        char **env;
        const char *s;
-       /* XXXMIPS: proper set a cleanup procedure */
-       fptr cleanup = NULL;
 
        env = argv + argc + 1;
        environ = env;
@@ -119,10 +128,14 @@
                                __progname = s + 1;
        }
 
+       if (ps_strings != (struct ps_strings *)0)
+               __ps_strings = ps_strings;
+
        if (&_DYNAMIC != NULL)
                atexit(cleanup);
        else
                _init_tls();
+
 #ifdef GCRT
        atexit(_mcleanup);
 #endif
_______________________________________________
p4-projects@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "p4-projects-unsubscribe@xxxxxxxxxxx"

<Prev in Thread] Current Thread [Next in Thread>
  • PERFORCE change 115070 for review, Oleksandr Tymoshenko <=