Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2002 09:36:23 -0500 (EST)
From:      Daniel Eischen <eischen@pcnet1.pcnet.com>
To:        Bernd Walter <ticso@cicely8.cicely.de>
Cc:        alpha@FreeBSD.org
Subject:   Re: {get,set,make,swap}context for alpha
Message-ID:  <Pine.SUN.3.91.1020104092820.20776A-100000@pcnet1.pcnet.com>
In-Reply-To: <20020104143622.A8703@cicely8.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 4 Jan 2002, Bernd Walter wrote:
> On Thu, Jan 03, 2002 at 04:05:25PM -0500, Daniel Eischen wrote:
  [...]
> > The first problem I'm having is that getcontext is getting caught
> > in an infinite loop.  After the call to sigprocmask, the return
> > value is checked and the next branch instruction doesn't jump to
> > the label; it jumps to a few instructions prior and repeats all
> > over again.
> > 
> >         ...
> > 	CALL(_sigprocmask)			/* see what's blocked */
> > 	mov	s0, a0				/* restore ptr to ucontext */
> >   -->	beq	v0, Lgc2			/* check for error */
> > 	ldiq	v0, -1				/* return -1 */
> > 	br	Lgcend
> >   Lgc2:
> > 	...

OK, I changed the above to be:

	CALL(_sigprocmask)			/* see what's blocked */
	mov	s0, a0				/* restore ptr to ucontext */
	ldq	ra, ((FRAME_RA + 3) * 8)(a0)	/* restore ra */
	ldq	s0, ((FRAME_S0 + 3) * 8)(a0)	/* restore s0 */
	beq	v0, Lgc2			/* check for error */
	ldiq	v0, -1				/* return -1 */
	br	Lgcend
  Lgc2:
	...

and getcontext now seems to work.  I think getcontext can remain a
LEAF function because it can save and restore anything it wants in
the context; that's it's raison d'etre.  setcontext probably needs
to be a NESTED function because it doesn't have a place to save
and restore anything -- unless it uses some unused slots in the
ucontext...

> One problem I found is that you defined getcontext to be a LEAF
> function, but actually call others.

Yes, thanks.  This clue helped a lot.

-- 
Dan Eischen

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.91.1020104092820.20776A-100000>