From owner-cvs-all@FreeBSD.ORG Sat Dec 6 17:40:09 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F177516A4CE; Sat, 6 Dec 2003 17:40:08 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 177E843FA3; Sat, 6 Dec 2003 17:40:08 -0800 (PST) (envelope-from davidxu@freebsd.org) Received: from freebsd.org (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id hB71e6FY070048; Sat, 6 Dec 2003 17:40:06 -0800 (PST) (envelope-from davidxu@freebsd.org) Message-ID: <3FD285AC.3080609@freebsd.org> Date: Sun, 07 Dec 2003 09:43:08 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031206 Thunderbird/0.3 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Wemm References: <20031207011600.E70C32A7EA@canning.wemm.org> In-Reply-To: <20031207011600.E70C32A7EA@canning.wemm.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org cc: Daniel Eischen Subject: Re: cvs commit: src/lib/libc/amd64/gen makecontext.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2003 01:40:09 -0000 Peter Wemm wrote: >Daniel Eischen wrote: > > >>On Thu, 4 Dec 2003, Peter Wemm wrote: >> >> >> >>>peter 2003/12/04 17:36:44 PST >>> >>> FreeBSD src repository >>> >>> Modified files: >>> lib/libc/amd64/gen makecontext.c >>> Log: >>> "Fix" makecontext() so that the C code begins execution with its >>> ABI-required stack alignment. C code expects that the push of the >>> return address disturbed the 16 byte alignment and it will take correctiv >>> >>> > e > > >>> measures to fix it before making another call. Of course, if its wrong >>> to start with, then all hell breaks loose. Essentially we "fix" this >>> by making the stack alignment odd to start with. >>> >>> >>Hey, you didn't include this little bit of knowledge in your amd64 "notes" >>that you sent me ;-) >> >> > >Heh. I never get it right. I've had to resort to things like this: > > assert((((long)__builtin_frame_address(0)) & 15 == 0), "misaligned stack!"); > >The trick of course is that gcc-3.3.3 is broken and __builtin_frame_address(0) >doesn't actually work unless you compile *also* with -fno-omit-frame-pointer >on amd64. > >Anyway, thats the only way I've ever been able to get this stuff sorted out. :-) > > > I have found upcall stack is not aligned at 16 bytes. it is triggered when I add this test into kse_sched_multi in libkse, maybe the line contains "td->td_frame->tf_rsp -= 8;" in vm_machdep.c should be removed. >Cheers, >-Peter >-- >Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com >"All of this is for nothing if we don't go to the stars" - JMS/B5 > > >