Subject: Re: swapcontext(3) does not work?
To: Kouichirou Hiratsuka <hira@po6.nsk.ne.jp>
From: Hubert Feyrer <hubert@feyrer.de>
List: port-amd64
Date: 11/30/2004 13:38:17
On Tue, 30 Nov 2004, Kouichirou Hiratsuka wrote:
> The following program (example in IEEE Std 1003.1, 2004 Edition)
> dumps core on -current/amd64.  It works fine on i386.  Is this a
> bug?

As I said, I'm mostly clueless on the details, but maye there's another 
issue hidden here, that of having the wrong stack when exiting f2():

You start with default stack
switch to stack2,
print "start f2"
switch to stack 1
print "start f1"
switch to stack 2
print "finish f2"
now f2() exits, what return address will it find on the stack (#2)?

Dunno why this works at all, under that light. ;)

The fact that "finish f2" is not printed may be because the segfault 
happens before stdio writes out it's buffer.


  - Hubert

-- 
NetBSD - Free AND Open!      (And of course secure, portable, yadda yadda)