cvs commit: src/lib/libc/amd64/gen makecontext.c
David Xu
davidxu at freebsd.org
Sat Dec 6 17:40:09 PST 2003
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 at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
>"All of this is for nothing if we don't go to the stars" - JMS/B5
>
>
>
More information about the cvs-src
mailing list