Print this page




  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24  */
  25 /*
  26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 /* #include <sys/isa_defs.h> */
  31 
  32 /* the following enums must match the bit positions in fenv.h */
  33 enum fex_exception {
  34         fex_inexact             = 0,
  35         fex_division    = 1,
  36         fex_underflow   = 2,
  37         fex_overflow    = 3,
  38         fex_inv_zdz             = 4,
  39         fex_inv_idi             = 5,
  40         fex_inv_isi             = 6,
  41         fex_inv_zmi             = 7,
  42         fex_inv_sqrt    = 8,
  43         fex_inv_snan    = 9,
  44         fex_inv_int             = 10,
  45         fex_inv_cmp             = 11
  46 };
  47 
  48 
  49 /* auxiliary functions in __fex_hdlr.c */
  50 extern struct fex_handler_data *__fex_get_thr_handlers(void);
  51 extern void __fex_update_te(void);
  52 
  53 /* auxiliary functions in __fex_sym.c */
  54 extern void __fex_sym_init(void);
  55 extern char *__fex_sym(char *, char **);
  56 
  57 /* auxiliary functions in fex_log.c */
  58 extern void __fex_mklog(ucontext_t *, char *, int, enum fex_exception,
  59         int, void *);
  60 
  61 /* system-dependent auxiliary functions */
  62 extern enum fex_exception __fex_get_invalid_type(siginfo_t *, ucontext_t *);
  63 extern void __fex_get_op(siginfo_t *, ucontext_t *, fex_info_t *);
  64 extern void __fex_st_result(siginfo_t *, ucontext_t *, fex_info_t *);
  65 
  66 /* inline templates and macros for accessing fp state */
  67 extern void __fenv_getfsr(unsigned long *);
  68 extern void __fenv_setfsr(unsigned const long *);
  69 
  70 #if defined(__sparc)
  71 
  72 #define __fenv_get_rd(X)        ((X>>30)&0x3)
  73 #define __fenv_set_rd(X,Y)      X=(X&~0xc0000000ul)|((Y)<<30)
  74 
  75 #define __fenv_get_te(X)        ((X>>23)&0x1f)
  76 #define __fenv_set_te(X,Y)      X=(X&~0x0f800000ul)|((Y)<<23)
  77 
  78 #define __fenv_get_ex(X)        ((X>>5)&0x1f)
  79 #define __fenv_set_ex(X,Y)      X=(X&~0x000003e0ul)|((Y)<<5)
  80 
  81 #elif defined(__x86)
  82 
  83 extern void __fenv_getcwsw(unsigned int *);
  84 extern void __fenv_setcwsw(const unsigned int *);
  85 
  86 extern void __fenv_getmxcsr(unsigned int *);
  87 extern void __fenv_setmxcsr(const unsigned int *);
  88 




  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24  */
  25 /*
  26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 


  30 /* the following enums must match the bit positions in fenv.h */
  31 enum fex_exception {
  32         fex_inexact             = 0,
  33         fex_division    = 1,
  34         fex_underflow   = 2,
  35         fex_overflow    = 3,
  36         fex_inv_zdz             = 4,
  37         fex_inv_idi             = 5,
  38         fex_inv_isi             = 6,
  39         fex_inv_zmi             = 7,
  40         fex_inv_sqrt    = 8,
  41         fex_inv_snan    = 9,
  42         fex_inv_int             = 10,
  43         fex_inv_cmp             = 11
  44 };
  45 
  46 
  47 /* auxiliary functions in __fex_hdlr.c */
  48 extern struct fex_handler_data *__fex_get_thr_handlers(void);
  49 extern void __fex_update_te(void);
  50 
  51 /* auxiliary functions in __fex_sym.c */
  52 extern void __fex_sym_init(void);
  53 extern char *__fex_sym(char *, char **);
  54 
  55 /* auxiliary functions in fex_log.c */
  56 extern void __fex_mklog(ucontext_t *, char *, int, enum fex_exception,
  57         int, void *);
  58 
  59 /* system-dependent auxiliary functions */
  60 extern enum fex_exception __fex_get_invalid_type(siginfo_t *, ucontext_t *);
  61 extern void __fex_get_op(siginfo_t *, ucontext_t *, fex_info_t *);
  62 extern void __fex_st_result(siginfo_t *, ucontext_t *, fex_info_t *);
  63 
  64 /* inline templates and macros for accessing fp state */
  65 extern void __fenv_getfsr(unsigned long *);
  66 extern void __fenv_setfsr(const unsigned long *);
  67 
  68 #if defined(__sparc)
  69 
  70 #define __fenv_get_rd(X)        ((X>>30)&0x3)
  71 #define __fenv_set_rd(X,Y)      X=(X&~0xc0000000ul)|((Y)<<30)
  72 
  73 #define __fenv_get_te(X)        ((X>>23)&0x1f)
  74 #define __fenv_set_te(X,Y)      X=(X&~0x0f800000ul)|((Y)<<23)
  75 
  76 #define __fenv_get_ex(X)        ((X>>5)&0x1f)
  77 #define __fenv_set_ex(X,Y)      X=(X&~0x000003e0ul)|((Y)<<5)
  78 
  79 #elif defined(__x86)
  80 
  81 extern void __fenv_getcwsw(unsigned int *);
  82 extern void __fenv_setcwsw(const unsigned int *);
  83 
  84 extern void __fenv_getmxcsr(unsigned int *);
  85 extern void __fenv_setmxcsr(const unsigned int *);
  86