Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so/arch/alpha Simplify _rtld_start() a little...



details:   https://anonhg.NetBSD.org/src/rev/90eff9fe0e01
branches:  trunk
changeset: 472032:90eff9fe0e01
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Apr 19 00:05:00 1999 +0000

description:
Simplify _rtld_start() a little, and shave some cycles.  Spefically, there's
no need to save the stack pointer.  Just push the space for the cleanup
and obj_main pointers before calling _rtld(), and pop it after loading those
pointers into the appropriate argument registers for the program entry point.

diffstat:

 libexec/ld.elf_so/arch/alpha/rtld_start.S |  46 ++++++++++++++----------------
 1 files changed, 22 insertions(+), 24 deletions(-)

diffs (70 lines):

diff -r cd1edd47a6ea -r 90eff9fe0e01 libexec/ld.elf_so/arch/alpha/rtld_start.S
--- a/libexec/ld.elf_so/arch/alpha/rtld_start.S Sun Apr 18 23:12:59 1999 +0000
+++ b/libexec/ld.elf_so/arch/alpha/rtld_start.S Mon Apr 19 00:05:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld_start.S,v 1.2 1999/04/18 23:12:59 thorpej Exp $   */
+/*     $NetBSD: rtld_start.S,v 1.3 1999/04/19 00:05:00 thorpej Exp $   */
 
 /*
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
@@ -40,20 +40,6 @@
        br      pv, L1
 L1:    LDGP(pv)
 
-       /*
-        * Save the stack pointer.  This is what we will pass to _rtld().
-        */
-       lda     s0, 0(sp)
-
-       /*
-        * Make room for the atexit and cleanup vectors that _rtld() will
-        * provide to us.
-        */
-       lda     sp, -16(sp)
-
-       /* Save ps_strings pointer */
-       mov     a3, s1
-
        /* XXX Partially relocate ourself. */
 
        /* Step 1 -- Figure out the displacement */
@@ -87,18 +73,30 @@
        bne     t1, L3          /* no, do more */
 
        /*
-        *  Ya!  Things are far enough so we can do some dynamic linking!
+        * Ya!  Things are far enough so we can do some dynamic linking!
         */
 
-       lda     a0, -16(s0)
-       CALL(_rtld)             /* v0 = _rtld(sp); */
+       /* Sqirrel away ps_strings. */
+       mov     a3, s0
+
+       /*
+        * Allocate space on the stack for the cleanup and obj_main
+        * entries that _rtld() will provide for us.
+        */
+       lda     sp, -16(sp)
 
-       ldq     a1, -16(s0)     /* our atexit function */
-       ldq     a2, -8(s0)      /* obj_main entry */
-       lda     sp, 16(sp)      /* readjust our stack */
-       mov     s0, a0          /* stack pointer */
-       mov     s1, a3          /* ps_strings pointer */
-       mov     v0, t12
+       mov     sp, a0          /* v0 = _rtld(sp); */
+       CALL(_rtld)
+
+       ldq     a1, 0(sp)       /* cleanup */
+       ldq     a2, 8(sp)       /* obj_main */
+       lda     sp, 16(sp)      /* pop stack */
+
+       mov     sp, a0          /* stack pointer */
+       mov     s0, a3          /* ps_strings */
+
+       mov     v0, pv          /* set up PV for entry point */
+
        jsr     ra, (v0), 0     /* (*_start)(sp, cleanup, obj, ps_strings); */
        ldgp    gp, 0(ra)
 



Home | Main Index | Thread Index | Old Index