cvs commit: src/sys/i386/i386 trap.c

John Baldwin jhb at freebsd.org
Fri Jul 27 20:46:25 UTC 2007


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


More information about the cvs-src mailing list