PERFORCE change 29658 for review

Peter Wemm peter at FreeBSD.org
Thu Apr 24 17:44:04 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=29658

Change 29658 by peter at peter_daintree on 2003/04/24 17:43:07

	gah! gag me with a spoon!
	We have to deliberately odd-align the starting stack pointer because
	gcc "knows" that there is a return address pushed there and will
	push the wrong number of longs onto the stack, causing everything
	to be misaligned.

Affected files ...

.. //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#80 edit

Differences ...

==== //depot/projects/hammer/sys/x86_64/x86_64/machdep.c#80 (text+ko) ====

@@ -466,7 +466,8 @@
 
 	bzero((char *)regs, sizeof(struct trapframe));
 	regs->tf_rip = entry;
-	regs->tf_rsp = stack;
+	/* This strangeness is to ensure alignment after the implied return address */
+	regs->tf_rsp = ((stack - 8) & ~0xF) + 8;
 	regs->tf_rdi = stack;		/* argv */
 	regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T);
 	regs->tf_ss = _udatasel;


More information about the p4-projects mailing list