Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jul 2007 08:19:07 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Don Lewis <truckman@freebsd.org>
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/i386/i386 trap.c
Message-ID:  <200707270819.08197.jhb@freebsd.org>
In-Reply-To: <200707271042.l6RAgKhZ082086@gw.catspoiler.org>
References:  <200707271042.l6RAgKhZ082086@gw.catspoiler.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 27 July 2007 06:42:20 am Don Lewis wrote:
> On 13 Jun, John Baldwin wrote:
> > jhb         2007-06-13 22:37:48 UTC
> > 
> >   FreeBSD src repository
> > 
> >   Modified files:
> >     sys/i386/i386        trap.c 
> >   Log:
> >   Don't clobber tf_err with the eva from a page fault as the page fault
> >   address is saved in ksi_addr already.
> >   
> >   PR:             i386/101379
> >   Submitted by:   Tijl Coosemans : tijl ulyssis org
> >   
> >   Revision  Changes    Path
> >   1.306     +0 -3      src/sys/i386/i386/trap.c
> 
> This change appears to have broken the garbage collector in
> ports/lang/pm3-base, which means that cvsup no longer works on -CURRENT.
> The garbage collector uses the old sigvec() interface, and counts on
> getting the fault address from the sc_err field in struct sigcontext,
> which is copied from tf_err.
> 
> The Modula-3 source code for the handler and the sigvec() call is in
> pm3-1.1.15/libs/m3core/src/runtime/FreeBSD4/RTHeapDep.m3 under the port
> work directory. Since Modula-3 compiler uses this code, the compiler is
> bootstrapped from a version of this file that has already been
> translated to i386 assembly language. The latter lives in
> pm3-1.1.15/boot-FreeBSD4/m3core/FreeBSD4/RTHeapDep.ms.
> 
> Modifying the assembly code to convert it to use sigaction() and to pull
> the fault address out of the siginfo structure is left as an exercise
> for someone more masochistic than me.

Assuming wine doesn't use sigvec() this should work.  I noticed while looking 
at this that ddb's backtrace had some special handling that assumes tf_err == 
faulting address as well. :-/

Index: machdep.c
===================================================================
RCS file: /usr/cvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.657
diff -u -r1.657 machdep.c
--- machdep.c   6 Jun 2007 07:35:07 -0000       1.657
+++ machdep.c   27 Jul 2007 12:17:22 -0000
@@ -352,7 +352,12 @@
        sf.sf_siginfo.si_sc.sc_pc = regs->tf_eip;
        sf.sf_siginfo.si_sc.sc_ps = regs->tf_eflags;
        sf.sf_siginfo.si_sc.sc_trapno = regs->tf_trapno;
-       sf.sf_siginfo.si_sc.sc_err = regs->tf_err;
+
+       /*
+        * XXX: Some old binaries using sigvec() such as cvsup depend
+        * on this.
+        */
+       sf.sf_siginfo.si_sc.sc_err = (register_t)ksi->ksi_addr;

        /*
         * If we're a vm86 process, we want to save the segment registers.


-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707270819.08197.jhb>