10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*6812Sraf * Common Development and Distribution License (the "License").
6*6812Sraf * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
20*6812Sraf */
21*6812Sraf
22*6812Sraf /*
23*6812Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
240Sstevel@tonic-gate * Use is subject to license terms.
25*6812Sraf */
26*6812Sraf
27*6812Sraf /*
280Sstevel@tonic-gate * Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T
290Sstevel@tonic-gate * All Rights Reserved
300Sstevel@tonic-gate *
310Sstevel@tonic-gate * Portions of this source code were derived from Berkeley
320Sstevel@tonic-gate * 4.3 BSD under license from the regents of the University of
330Sstevel@tonic-gate * California.
340Sstevel@tonic-gate */
350Sstevel@tonic-gate
360Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
370Sstevel@tonic-gate
380Sstevel@tonic-gate /*
390Sstevel@tonic-gate * contains definitions for variables for IEEE floating-point arithmetic
400Sstevel@tonic-gate * modes; IEEE floating-point arithmetic exception handling;
410Sstevel@tonic-gate */
420Sstevel@tonic-gate
43*6812Sraf #include "lint.h"
440Sstevel@tonic-gate #include <thread.h>
450Sstevel@tonic-gate #include <synch.h>
460Sstevel@tonic-gate #include <mtlib.h>
470Sstevel@tonic-gate #include "tsd.h"
480Sstevel@tonic-gate
490Sstevel@tonic-gate int __inf_read, __inf_written, __nan_read, __nan_written;
500Sstevel@tonic-gate
510Sstevel@tonic-gate /*
520Sstevel@tonic-gate * Per-thread instances (thread-specific data) of the above globals.
530Sstevel@tonic-gate */
540Sstevel@tonic-gate typedef struct {
550Sstevel@tonic-gate int __inf_read;
560Sstevel@tonic-gate int __inf_written;
570Sstevel@tonic-gate int __nan_read;
580Sstevel@tonic-gate int __nan_written;
590Sstevel@tonic-gate } fpvars_t;
600Sstevel@tonic-gate
610Sstevel@tonic-gate #define fpvars ((fpvars_t *)tsdalloc(_T_FP_GET, sizeof (fpvars_t), NULL))
620Sstevel@tonic-gate
630Sstevel@tonic-gate int *
_thrp_get_nan_written()64*6812Sraf _thrp_get_nan_written()
650Sstevel@tonic-gate {
66*6812Sraf return (thr_main() ? &__nan_written : &fpvars->__nan_written);
670Sstevel@tonic-gate }
680Sstevel@tonic-gate
690Sstevel@tonic-gate int *
_thrp_get_nan_read()70*6812Sraf _thrp_get_nan_read()
710Sstevel@tonic-gate {
72*6812Sraf return (thr_main() ? &__nan_read : &fpvars->__nan_read);
730Sstevel@tonic-gate }
740Sstevel@tonic-gate
750Sstevel@tonic-gate int *
_thrp_get_inf_written()76*6812Sraf _thrp_get_inf_written()
770Sstevel@tonic-gate {
78*6812Sraf return (thr_main() ? &__inf_written : &fpvars->__inf_written);
790Sstevel@tonic-gate }
800Sstevel@tonic-gate
810Sstevel@tonic-gate int *
_thrp_get_inf_read()82*6812Sraf _thrp_get_inf_read()
830Sstevel@tonic-gate {
84*6812Sraf return (thr_main() ? &__inf_read : &fpvars->__inf_read);
850Sstevel@tonic-gate }
86