fex_handler.h revision 25c28e83beb90e7c80452a7c818c5e6f73a07dc8
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _M9X_FEX_HANDLER_H
#define _M9X_FEX_HANDLER_H
/* the following enums must match the bit positions in fenv.h */
enum fex_exception {
fex_inexact = 0,
fex_division = 1,
fex_underflow = 2,
fex_overflow = 3,
fex_inv_zdz = 4,
fex_inv_idi = 5,
fex_inv_isi = 6,
fex_inv_zmi = 7,
fex_inv_sqrt = 8,
fex_inv_snan = 9,
fex_inv_int = 10,
fex_inv_cmp = 11
};
/* auxiliary functions in __fex_hdlr.c */
extern struct fex_handler_data *__fex_get_thr_handlers(void);
extern void __fex_update_te(void);
/* auxiliary functions in __fex_sym.c */
extern void __fex_sym_init(void);
extern char *__fex_sym(char *, char **);
/* auxiliary functions in fex_log.c */
int, void *);
/* system-dependent auxiliary functions */
/* inline templates and macros for accessing fp state */
extern void __fenv_getfsr(unsigned long *);
extern void __fenv_setfsr(const unsigned long *);
#if defined(__sparc)
extern void __fenv_getcwsw(unsigned int *);
extern void __fenv_setcwsw(const unsigned int *);
extern void __fenv_getmxcsr(unsigned int *);
extern void __fenv_setmxcsr(const unsigned int *);
#define __fenv_get_ex(X) (X&0x3d)
#define __fenv_set_ex(X,Y) X=(X&~0x0000003d)|(Y)
/*
* These macros define some useful distinctions between various
* SSE instructions. In some cases, distinctions are made for
* the purpose of simplifying the decoding of instructions, while
* in other cases, they are made for the purpose of simplying the
* emulation. Note that these values serve as bit flags within
* the enum values in sseinst_t.
*/
#define DOUBLE 0x100
#define SIMD 0x080
#define INTREG 0x040
typedef union {
double d[2];
long long l[2];
float f[4];
int i[4];
} sseoperand_t;
/* structure to hold a decoded SSE instruction */
typedef struct {
enum {
/* single precision scalar instructions */
cmpss = 0,
minss = 1,
maxss = 2,
addss = 3,
subss = 4,
mulss = 5,
divss = 6,
sqrtss = 7,
ucomiss = 16,
comiss = 17,
cvtss2sd = 32,
/* single precision SIMD instructions */
/* double precision scalar instructions */
/* double precision SIMD instructions */
} op;
int imm;
} sseinst_t;
/* x86-specific auxiliary functions */
extern int *__fex_accrued(void);
fex_info_t *);
enum fex_exception *, fex_info_t *);
enum fex_exception, fex_info_t *);
enum fex_exception *, fex_info_t *);
#else
#endif
#endif /* _M9X_FEX_HANDLER_H */