From owner-cvs-src@FreeBSD.ORG Mon Jul 30 20:12:02 2007 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61ABB16A469; Mon, 30 Jul 2007 20:12:02 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 2F78213C428; Mon, 30 Jul 2007 20:12:02 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id B592A2C2AA2; Mon, 30 Jul 2007 14:44:03 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id i6gSspd1yUKd; Mon, 30 Jul 2007 14:43:56 -0500 (CDT) Received: from [10.251.22.150] (nat.ironport.com [63.251.108.100]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id A5CC12C2A66; Mon, 30 Jul 2007 14:43:46 -0500 (CDT) Message-ID: <46AE3F6F.9090609@cs.rice.edu> Date: Mon, 30 Jul 2007 14:43:43 -0500 From: Alan Cox User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: Alfred Perlstein References: <200707270819.08197.jhb@freebsd.org> <200707300717.l6U7HcNC089641@gw.catspoiler.org> <20070730175334.GH92956@elvis.mu.org> In-Reply-To: <20070730175334.GH92956@elvis.mu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: cvs-src@FreeBSD.org, Don Lewis , src-committers@FreeBSD.org, cvs-all@FreeBSD.org, jhb@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/i386 trap.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2007 20:12:02 -0000 Alfred Perlstein wrote: > * Don Lewis [070730 00:17] wrote: > >> After installing this patch, the bootstrap in the pm3-base port still >> fails. I installed pm3-base from the 6-STABLE package, and it isn't >> able to compile any of the other ports. I suspect the reason for the >> latter is that it is new enough to use sendsig() and not osendsig(). >> This makes sense because osendsig is a COMPAT_43 function and the binary >> is a lot newer than that. >> >> To preserve the "kludge" ABI as much as possible, I think it would be >> necessary to move the assignment to sc_err into the if-else block that >> checks to see if the signal handler was installed with the SA_SIGIFNO >> flag, and to make the same change in sendsig(), osendsig(), and >> freebsd4_sendsig(). This will break the wine port unless it uses >> SA_SIGINFO. >> >> >> As an alternative, I've got a set of patches to pm3-base to get it >> working on -CURRENT. It wasn't too hard to fix the bootstrap to use the >> "undocumented 4th arg" to the signal handler that is mentioned in >> i386/include/sigframe.h. The rest of the patches change the low-level >> Module-3 code to use sigaction() with the SA_SIGINFO flag instead of >> using a mixture of sigaction() (without SA_SIGINFO) and sigvec(). >> I'll post the patches for testing once I've had a chance to clean them >> up some more. >> > > This sounds really, really hackish. I talked to Alan Cox about this > over the weekend and he said, if I have this right, that supposedly > a correct program actually does get the correct info on the stack > as an argument to their signal callback. m3 should be fixed. > > I think I was unclear. I agree with what Don is proposing. I was referring to the "undocumented 4th arg" when I said that a program would receive "the correct info on the stack as an argument". I'm not, however, sure why FreeBSD never documented the 4th argument. It is not only implemented by some other flavors of Unix but it is actually documented, for example, from a Solaris 2.8 man page: The handler routine can be declared: void handler(int sig, int code, struct sigcontext *scp, char *addr); Here sig is the signal number; code is a parameter of cer- tain signals that provides additional detail; scp is a pointer to the sigcontext structure (defined in signal.h), used to restore the context from before the signal; and addr is additional address information. Also, that FreeBSD used to clobber tf_err with the faulting address made it rather challenging to determine whether the SIGBUS/SIGSEGV was caused by a read or a write access. So, not clobbering tf_err is a good thing. Fortunately, Modula-3's garbage collector didn't care about this, but some other applications do. Alan