From owner-freebsd-alpha Fri Jan 4 6:37:38 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id EFD9637B421 for ; Fri, 4 Jan 2002 06:37:33 -0800 (PST) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.12.1/8.12.1) id g04EaRi7022084; Fri, 4 Jan 2002 09:36:27 -0500 (EST) Date: Fri, 4 Jan 2002 09:36:23 -0500 (EST) From: Daniel Eischen To: Bernd Walter Cc: alpha@FreeBSD.org Subject: Re: {get,set,make,swap}context for alpha In-Reply-To: <20020104143622.A8703@cicely8.cicely.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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