Date: Tue, 17 Jul 2001 14:10:01 -0700 (PDT) From: Jim Pirzyk <Jim.Pirzyk@disney.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/28966: math libraries in linux emulation do not return sameresults Message-ID: <200107172110.f6HLA1E86961@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/28966; it has been noted by GNATS.
From: Jim Pirzyk <Jim.Pirzyk@disney.com>
To: freebsd-gnats-submit@FreeBSD.ORG
Cc:
Subject: Re: kern/28966: math libraries in linux emulation do not return sameresults
Date: Tue, 17 Jul 2001 14:02:10 -0700
On Sunday 15 July 2001 04:06 am, you wrote:
> On Sat, 14 Jul 2001, Jim Pirzyk wrote:
> > So the solution to my problem was to set the __INITIAL_NPXCW__ to
> > 0x37F. What I can think of is that the freebsd binary sets
> > the Control Word to this before running but the linux binary
> > does not (because it is assumed to already be set by the kernel
> > at boot time).
>
> It's sort of the opposite. The FreeBSD kernel sets the control
> word to __INITIAL_NPXCW__. Most FreeBSD binaries have never set it.
> They depend on the kernel setting it. Linux C binaries used to set
> it to 0x37F in the C startup code (except very old Linux C binaries
> set it to 0x272 IIRC, and there at least used to be a linking option
> to unmask exceptions (control word 0x372?). Linux C binaries stopped
> setting it a few years ago.
Not sure if this patch is technically correct in that it does not
save off the existing value of cw, but just sets to to the
default.
*** ./sys/i386/linux/linux.h.orig Tue Jul 17 13:59:10 2001
--- ./sys/i386/linux/linux.h Tue Jul 17 13:27:26 2001
***************
*** 167,172 ****
--- 167,175 ----
#define LINUX_SS_DISABLE 2
+ /* sigvec */
+ #define __INITAL_LINUX_NPXCW__ 0x37F
+
int linux_to_bsd_sigaltstack(int lsa);
int bsd_to_linux_sigaltstack(int bsa);
*** ./sys/i386/linux/linux_sysvec.c.orig Sat Jul 14 22:32:48 2001
--- ./sys/i386/linux/linux_sysvec.c Tue Jul 17 13:30:59 2001
***************
*** 429,434 ****
--- 429,441 ----
bzero(&frame.sf_fpstate, sizeof(struct linux_fpstate));
+ /*
+ * Need to set the NXP Code Word to match what linux uses. This used
+ * to be in each linux binary, but more receintly, it was moved to
+ * the kernel and so we need to emulate that here.
+ */
+ frame.sf_fpstate.cw = __INITAL_LINUX_NPXCW__;
+
for (i = 0; i < (LINUX_NSIG_WORDS-1); i++)
frame.sf_extramask[i] = lmask.__bits[i+1];
- JimP
--
--- @(#) $Id: dot.signature,v 1.10 2001/05/17 23:38:49 Jim.Pirzyk Exp $
__o Jim.Pirzyk@disney.com ------------- pirzyk@freebsd.org
_'\<,_ Senior Systems Engineer, Walt Disney Feature Animation
(*)/ (*)
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107172110.f6HLA1E86961>
