Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2002 17:46:13 +0100
From:      Bernd Walter <ticso@cicely8.cicely.de>
To:        Daniel Eischen <eischen@pcnet1.pcnet.com>
Cc:        alpha@FreeBSD.ORG
Subject:   Re: {get,set,make,swap}context for alpha
Message-ID:  <20020104174613.C8703@cicely8.cicely.de>
In-Reply-To: <Pine.SUN.3.91.1020104092820.20776A-100000@pcnet1.pcnet.com>
References:  <20020104143622.A8703@cicely8.cicely.de> <Pine.SUN.3.91.1020104092820.20776A-100000@pcnet1.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 04, 2002 at 09:36:23AM -0500, Daniel Eischen wrote:
> 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...

Lsc_sm: lda     sp, -16(sp)                     /* get stack space */
        stq     ra, 0(sp)                       /* save ra */
        stq     a0, 8(sp)                       /* save ptr to ucontext */
        mov     a0, a1                          /* set:  &ucp->uc_sigmask */
        mov     zero, a2                        /* oset: NULL */
        ldiq    a0, 3                           /* how:  SIG_SETMASK */
        CALL(_sigprocmask)                      /* set new signal mask */
        ldq     a0, 8(sp)                       /* restore ptr to ucontext */
        ldq     ra, 0(sp)                       /* restore ra */
        lda     sp, 16(sp)                      /* restore sp */
        bne     v0, Lscbad                      /* check for error */
        /* restore floating point regs first */
        ldq     t0, ((71 + 3) * 8)(a0)          /* if FP regs not saved, */

What I found so far with the core dump is that proc3 is called with a
bogus t12 value.
I still have to search why.

-- 
B.Walter              COSMO-Project         http://www.cosmo-project.de
ticso@cicely.de         Usergroup           info@cosmo-project.de


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?20020104174613.C8703>