Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jan 2002 22:18:29 +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:  <20020104221828.F8703@cicely8.cicely.de>
In-Reply-To: <Pine.SUN.3.91.1020104124905.23748A-100000@pcnet1.pcnet.com>
References:  <20020104182107.D8703@cicely8.cicely.de> <Pine.SUN.3.91.1020104124905.23748A-100000@pcnet1.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 04, 2002 at 12:56:45PM -0500, Daniel Eischen wrote:
> On Fri, 4 Jan 2002, Bernd Walter wrote:
> > --- _ctx_start.S.orig   Fri Jan  4 18:15:18 2002
> > +++ _ctx_start.S        Fri Jan  4 18:13:26 2002
> > @@ -40,6 +40,7 @@
> >         .set    noreorder
> >  LEAF(_ctx_start,0)
> >         LDGP(pv)
> > +       mov     s0, t12
> >         jsr     ra, (s0)        /* call start routine; args already set */
> >         mov     s1, a0          /* load A0 (arg 1) with pointer to ucontext */
> >         CALL(_ctx_done)         /* call context completion routine */
> 
> Ahh, this makes a bit of sense.

After rechecking I found it was incomplete:
ticso@cicely9# diff -u _ctx_start.S.orig _ctx_start.S
--- _ctx_start.S.orig   Fri Jan  4 18:15:18 2002
+++ _ctx_start.S        Fri Jan  4 22:05:42 2002
@@ -39,8 +39,9 @@
  */
        .set    noreorder
 LEAF(_ctx_start,0)
-       LDGP(pv)
+       mov     s0, t12
        jsr     ra, (s0)        /* call start routine; args already set */
+       LDGP(ra)
        mov     s1, a0          /* load A0 (arg 1) with pointer to ucontext */
        CALL(_ctx_done)         /* call context completion routine */
        CALL(abort)             /* should never return from above call */

The original LDGP was useless, because it t12 wasn't initialised,
but we also don't need it.
After calling a function we need to reinitialise gp, which is
implied by CALL but not by jsr alone.
We need a valid gp to get _ctx_done savely referenced.

-- 
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?20020104221828.F8703>