From owner-freebsd-alpha Fri Jan 4 11:28:40 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 CC83237B41B for ; Fri, 4 Jan 2002 11:28:36 -0800 (PST) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.12.1/8.12.1) id g04JRTeN010355; Fri, 4 Jan 2002 14:27:29 -0500 (EST) Date: Fri, 4 Jan 2002 14:27:27 -0500 (EST) From: Daniel Eischen To: Bernd Walter Cc: alpha@FreeBSD.ORG Subject: Re: {get,set,make,swap}context for alpha In-Reply-To: <20020104195054.E8703@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 Fri, Jan 04, 2002 at 12:56:45PM -0500, Daniel Eischen wrote: > > On Fri, 4 Jan 2002, Bernd Walter wrote: > > > On Fri, Jan 04, 2002 at 05:46:13PM +0100, Bernd Walter wrote: > > > > 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. > > > > Thanks for the previous fix to setcontext; we seem to have > > figured out the same fix for getcontext :-). I was in the > > process of making setcontext a NESTED function, but had to > > go to work :(. > > It wouldn't work as NESTED, because it expects values on the > stack for return which are not there after switching. > NESTED does the same as my change, but at the beginning and end of > the function. OK. I was going to treat a return due to error as a normal return, and have an abnormal return for a normal return. But as long as yours works, that's fine. > > Cool, it's working! I was unsure about makecontext being correct. > > I should probably add a test that passes more than 6 arguments > > to a function to be sure that the remaining arguments are correctly > > pulled off the stack (the first 6 being in registers). > > Good point. > > I asume FP registers also need to be handled. > At least fs and fa registers. I dunno. Read the comment in the code (setcontext.S) about floating point registers and whether we need to save them. When called from application code, setcontext & getcontext are like setjmp and longjmp. I figured that the caller should be done with the floating point registers and there would be no need to save all of them. When the context is a sigframe though, that means the kernel interrupted the application to deliver a signal so we don't know anything about whether the caller still needs the FP registers (and have to restore them). Or something like that anyways. At this point I just want to get it working, so we can always save and restore the FP registers and fine-tune it later. > > The kernel needs to be patched (machdep.c) to set ucp->mc_context.mc_rev > > to denote it is a signal frame and not a trap frame. The test program > > should account for an unpatched kernel by setting mc_rev to denote a > > signal frame. Make sure that it's being set correctly, or else > > setcontext will return -1. > > Ah. > I hadn't looked into the complete patch yet. I didn't include the patch to the kernel yet. I'll do that after everything seems to be working. Thanks, -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message