fpstart.c revision 2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. 2N/A * Copyright (c) 1988 AT&T 2N/A * All Rights Reserved 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Establish the default settings for the floating-point state for a C language 2N/A * rounding mode -- round to nearest default by OS, 2N/A * exceptions enabled -- all masked 2N/A * sticky bits -- all clear by default by OS. 2N/A * precision control -- double extended 2N/A#
include <
sys/
fp.h>
/* for FPU_CW_INIT and SSE_MXCSR_INIT */ 2N/A int _fp_hw;
/* default: bss: 0 == no hardware */ 2N/A * query OS for HW status and ensure the x87 and (optional) 2N/A * SSE control words are (will be) set correctly. 2N/A * This "cannot fail". 2N/A * At this point the x87 fp environment that has been (or more 2N/A * hopefully, will be) established by the kernel is: 2N/A * affine infinity 0x1000 2N/A * round to nearest 0x0000 2N/A * 64-bit doubles 0x0300 2N/A * precision, underflow, overflow, zero-divide, denorm, invalid masked 2N/A * which conforms to the 4th edition i386 ABI definition. 2N/A * Additionally, if we have SSE hardware, we've also masked all 2N/A * the same traps, and have round to nearest.