| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <4AB29DDF.301@gmail.com> |
| Date: | Thu, 17 Sep 2009 21:36:47 +0100 |
| From: | Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com> |
| User-Agent: | Thunderbird 2.0.0.17 (Windows/20080914) |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: I want my FPE! |
| References: | <loom DOT 20090917T213422-417 AT post DOT gmane DOT org> |
| In-Reply-To: | <loom.20090917T213422-417@post.gmane.org> |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
Mark Geisert wrote:
> Is there something I need to do to "condition" the Cygwin environment to
> generate FP exceptions? I saw the code in winsup/something/or/other to map x86
> FP exceptions to SIGFPE but it seems somehow the exceptions aren't being
> generated in the first place.
Very possibly not. There's probably a bit in the FPUCW you need to set or
something. Ah, yes: see winsup/cygwin/crt0.c:
> /* In the following ifdef'd i386 code, the FPU precision is set to 80 bits
> and all FPU exceptions are masked. The former is needed to make long
> doubles work correctly. The latter causes the FPU to generate NaNs and
> Infinities instead of signals for certain operations.
> */
> #define FPU_RESERVED 0xF0C0
> #define FPU_DEFAULT 0x033f
> {
> volatile unsigned short cw;
>
> /* Get Control Word */
> __asm__ volatile ("fnstcw %0" : "=m" (cw) : );
>
> /* mask in */
> cw &= FPU_RESERVED;
> cw |= FPU_DEFAULT;
>
> /* set cw */
> __asm__ volatile ("fldcw %0" :: "m" (cw));
> }
You can copy and paste that hunk into your own main() and change the
constants to anything you like.
cheers,
DaveK
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |