From owner-freebsd-alpha Fri Jan 4 9:58:28 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 C2B5537B447 for ; Fri, 4 Jan 2002 09:57:51 -0800 (PST) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.12.1/8.12.1) id g04HujZr025025; Fri, 4 Jan 2002 12:56:45 -0500 (EST) Date: Fri, 4 Jan 2002 12:56:45 -0500 (EST) From: Daniel Eischen To: Bernd Walter Cc: alpha@FreeBSD.ORG Subject: Re: {get,set,make,swap}context for alpha In-Reply-To: <20020104182107.D8703@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 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 :(. > --- _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. > ticso@cicely9# ./test_context > Send a few SIGUSR1's to pid 65418 > Main: setting context to myself. > Main: returned from setcontext. > Proc3 called with arguments (1) > Proc3: working... > Proc3: working... > Proc3: working... > Proc3: working... > Proc3: working... > Proc3: returned from getcontext, count 1 [...] > Proc2: working... > Proc2: working... > Proc2: working... > Main context returned. 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). > Signaling does not work, yet: > ticso@cicely9# ./test_context > Send a few SIGUSR1's to pid 65430 > Main: setting context to myself. > Main: returned from setcontext. > Proc3 called with arguments (1) > Proc3: working... > Proc3: working... > Proc3: working... > Proc3: working... > Proc3: working... > Proc3: returned from getcontext, count 1 > Got signal 30, uc_rev 0x0 > Assertion failed: (setcontext(ucp) == 0), function sighandler, file test_context.c, line 77. 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. -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message