Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/ia64/ia64 Tweak the argument order passed to the el...



details:   https://anonhg.NetBSD.org/src/rev/38099ef744c6
branches:  trunk
changeset: 327697:38099ef744c6
user:      cherry <cherry%NetBSD.org@localhost>
date:      Fri Mar 14 17:45:37 2014 +0000

description:
Tweak the argument order passed to the elf executable entry point (usually "__start"),
so as to make call to the C function ___start() easier from assembler.
We setup the memory stack frame for ___start(), before calling it.

diffstat:

 sys/arch/ia64/ia64/machdep.c |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (56 lines):

diff -r 4834a0a93d10 -r 38099ef744c6 sys/arch/ia64/ia64/machdep.c
--- a/sys/arch/ia64/ia64/machdep.c      Fri Mar 14 17:36:03 2014 +0000
+++ b/sys/arch/ia64/ia64/machdep.c      Fri Mar 14 17:45:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.34 2013/01/06 11:29:35 kiyohara Exp $    */
+/*     $NetBSD: machdep.c,v 1.35 2014/03/14 17:45:37 cherry Exp $      */
 
 /*-
  * Copyright (c) 2003,2004 Marcel Moolenaar
@@ -716,16 +716,16 @@
                kst = ksttop - 1;
                if (((uintptr_t)kst & 0x1ff) == 0x1f8)
                        *kst-- = 0;
-               *kst-- = l->l_proc->p_psstrp;   /* in3 = ps_strings */
+               *kst-- = stack;                         /* in3 = sp */
                if (((uintptr_t)kst & 0x1ff) == 0x1f8)
                        *kst-- = 0;
-               *kst-- = 0;                             /* in2 = *obj */
+               *kst-- = l->l_proc->p_psstrp;           /* in2 = ps_strings */
                if (((uintptr_t)kst & 0x1ff) == 0x1f8)
                        *kst-- = 0;
-               *kst-- = 0;                             /* in1 = *cleanup */
+               *kst-- = 0;                             /* in1 = *obj */
                if (((uintptr_t)kst & 0x1ff) == 0x1f8)
                        *kst-- = 0;
-               *kst = stack; /* in0 = sp */
+               *kst = 0;                               /* in0 = *cleanup */
                tf->tf_special.ndirty = (ksttop - kst) << 3;
        } else {                                /* epc syscalls (default). */
                tf->tf_special.cfm = (3UL<<62) | (3UL<<7) | 3UL;
@@ -737,18 +737,18 @@
                 * Assumes that (bspstore & 0x1f8) < 0x1e0.
                 */
 
-               /* in0 = sp */
-               suword((char *)tf->tf_special.bspstore - 32, stack);
+               /* in0 = *cleanup */
+               suword((char *)tf->tf_special.bspstore - 32, 0);
 
-               /* in1 == *cleanup */
+               /* in1 == *obj */
                suword((char *)tf->tf_special.bspstore -  24, 0);
 
-               /* in2 == *obj */
-               suword((char *)tf->tf_special.bspstore -  16, 0);
+               /* in2 == ps_strings */
+               suword((char *)tf->tf_special.bspstore -  16, l->l_proc->p_psstrp);
 
-               /* in3 = ps_strings */
+               /* in3 = sp */
                suword((char *)tf->tf_special.bspstore - 8,
-                   l->l_proc->p_psstrp);
+                   stack);
 
        }
 



Home | Main Index | Thread Index | Old Index