Date: Thu, 24 Apr 2003 17:44:02 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 29658 for review Message-ID: <200304250044.h3P0i2aA011300@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29658 Change 29658 by peter@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304250044.h3P0i2aA011300>
