Module Name:    src
Committed By:   cherry
Date:           Fri Mar 14 17:45:38 UTC 2014

Modified Files:
        src/sys/arch/ia64/ia64: machdep.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/ia64/ia64/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/ia64/ia64/machdep.c
diff -u src/sys/arch/ia64/ia64/machdep.c:1.34 src/sys/arch/ia64/ia64/machdep.c:1.35
--- src/sys/arch/ia64/ia64/machdep.c:1.34	Sun Jan  6 11:29:35 2013
+++ src/sys/arch/ia64/ia64/machdep.c	Fri Mar 14 17:45:37 2014
@@ -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 @@ setregs(register struct lwp *l, struct e
 		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 @@ setregs(register struct lwp *l, struct e
 		 * 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);
 
 	}
 

Reply via email to