52 extern void __fex_update_te(void);
53
54 /* auxiliary functions in __fex_sym.c */
55 extern void __fex_sym_init(void);
56 extern char *__fex_sym(char *, char **);
57
58 /* auxiliary functions in fex_log.c */
59 extern void __fex_mklog(ucontext_t *, char *, int, enum fex_exception,
60 int, void *);
61
62 /* system-dependent auxiliary functions */
63 extern enum fex_exception __fex_get_invalid_type(siginfo_t *, ucontext_t *);
64 extern void __fex_get_op(siginfo_t *, ucontext_t *, fex_info_t *);
65 extern void __fex_st_result(siginfo_t *, ucontext_t *, fex_info_t *);
66
67 /* inline templates and macros for accessing fp state */
68 extern void __fenv_getfsr(unsigned long *);
69 extern void __fenv_setfsr(const unsigned long *);
70
71 #if defined(__sparc)
72
73 #define __fenv_get_rd(X) ((X>>30)&0x3)
74 #define __fenv_set_rd(X,Y) X=(X&~0xc0000000ul)|((Y)<<30)
75
76 #define __fenv_get_te(X) ((X>>23)&0x1f)
77 #define __fenv_set_te(X,Y) X=(X&~0x0f800000ul)|((Y)<<23)
78
79 #define __fenv_get_ex(X) ((X>>5)&0x1f)
80 #define __fenv_set_ex(X,Y) X=(X&~0x000003e0ul)|((Y)<<5)
81
82 #elif defined(__x86)
83
84 extern void __fenv_getcwsw(unsigned int *);
85 extern void __fenv_setcwsw(const unsigned int *);
86
87 extern void __fenv_getmxcsr(unsigned int *);
88 extern void __fenv_setmxcsr(const unsigned int *);
89
90 #define __fenv_get_rd(X) ((X>>26)&3)
91 #define __fenv_set_rd(X,Y) X=(X&~0x0c000000)|((Y)<<26)
92
93 #define __fenv_get_rp(X) ((X>>24)&3)
94 #define __fenv_set_rp(X,Y) X=(X&~0x03000000)|((Y)<<24)
95
96 #define __fenv_get_te(X) ((X>>16)&0x3d)
97 #define __fenv_set_te(X,Y) X=(X&~0x003d0000)|((Y)<<16)
98
99 #define __fenv_get_ex(X) (X&0x3d)
100 #define __fenv_set_ex(X,Y) X=(X&~0x0000003d)|(Y)
101
102 /*
103 * These macros define some useful distinctions between various
104 * SSE instructions. In some cases, distinctions are made for
105 * the purpose of simplifying the decoding of instructions, while
106 * in other cases, they are made for the purpose of simplying the
107 * emulation. Note that these values serve as bit flags within
108 * the enum values in sseinst_t.
109 */
110 #define DOUBLE 0x100
111 #define SIMD 0x080
112 #define INTREG 0x040
113
114 typedef union {
115 double d[2];
116 long long l[2];
117 float f[4];
118 int i[4];
119 } sseoperand_t;
120
192 cvtpi2pd = DOUBLE + SIMD + INTREG + 0,
193 cvttpd2pi = DOUBLE + SIMD + INTREG + 1,
194 cvtpd2pi = DOUBLE + SIMD + INTREG + 2,
195 } op;
196 int imm;
197 sseoperand_t *op1, *op2;
198 } sseinst_t;
199
200 /* x86-specific auxiliary functions */
201 extern int *__fex_accrued(void);
202 extern void __fex_get_x86_exc(siginfo_t *, ucontext_t *);
203 extern int __fex_parse_sse(ucontext_t *, sseinst_t *);
204 extern enum fex_exception __fex_get_sse_op(ucontext_t *, sseinst_t *,
205 fex_info_t *);
206 extern void __fex_get_simd_op(ucontext_t *, sseinst_t *,
207 enum fex_exception *, fex_info_t *);
208 extern void __fex_st_sse_result(ucontext_t *, sseinst_t *,
209 enum fex_exception, fex_info_t *);
210 extern void __fex_st_simd_result(ucontext_t *, sseinst_t *,
211 enum fex_exception *, fex_info_t *);
212
213 #else
214 #error Unknown architecture
215 #endif
216
217 #endif /* _M9X_FEX_HANDLER_H */
|
52 extern void __fex_update_te(void);
53
54 /* auxiliary functions in __fex_sym.c */
55 extern void __fex_sym_init(void);
56 extern char *__fex_sym(char *, char **);
57
58 /* auxiliary functions in fex_log.c */
59 extern void __fex_mklog(ucontext_t *, char *, int, enum fex_exception,
60 int, void *);
61
62 /* system-dependent auxiliary functions */
63 extern enum fex_exception __fex_get_invalid_type(siginfo_t *, ucontext_t *);
64 extern void __fex_get_op(siginfo_t *, ucontext_t *, fex_info_t *);
65 extern void __fex_st_result(siginfo_t *, ucontext_t *, fex_info_t *);
66
67 /* inline templates and macros for accessing fp state */
68 extern void __fenv_getfsr(unsigned long *);
69 extern void __fenv_setfsr(const unsigned long *);
70
71 #if defined(__sparc)
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 #elif defined(__x86)
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
87 #define __fenv_get_rd(X) ((X >> 26) & 3)
88 #define __fenv_set_rd(X, Y) X = (X & ~0x0c000000) | ((Y) << 26)
89
90 #define __fenv_get_rp(X) ((X >> 24) & 3)
91 #define __fenv_set_rp(X, Y) X = (X & ~0x03000000) | ((Y) << 24)
92
93 #define __fenv_get_te(X) ((X >> 16) & 0x3d)
94 #define __fenv_set_te(X, Y) X = (X & ~0x003d0000) |((Y) << 16)
95
96 #define __fenv_get_ex(X) (X & 0x3d)
97 #define __fenv_set_ex(X, Y) X = (X & ~0x0000003d) | (Y)
98
99 /*
100 * These macros define some useful distinctions between various
101 * SSE instructions. In some cases, distinctions are made for
102 * the purpose of simplifying the decoding of instructions, while
103 * in other cases, they are made for the purpose of simplying the
104 * emulation. Note that these values serve as bit flags within
105 * the enum values in sseinst_t.
106 */
107 #define DOUBLE 0x100
108 #define SIMD 0x080
109 #define INTREG 0x040
110
111 typedef union {
112 double d[2];
113 long long l[2];
114 float f[4];
115 int i[4];
116 } sseoperand_t;
117
189 cvtpi2pd = DOUBLE + SIMD + INTREG + 0,
190 cvttpd2pi = DOUBLE + SIMD + INTREG + 1,
191 cvtpd2pi = DOUBLE + SIMD + INTREG + 2,
192 } op;
193 int imm;
194 sseoperand_t *op1, *op2;
195 } sseinst_t;
196
197 /* x86-specific auxiliary functions */
198 extern int *__fex_accrued(void);
199 extern void __fex_get_x86_exc(siginfo_t *, ucontext_t *);
200 extern int __fex_parse_sse(ucontext_t *, sseinst_t *);
201 extern enum fex_exception __fex_get_sse_op(ucontext_t *, sseinst_t *,
202 fex_info_t *);
203 extern void __fex_get_simd_op(ucontext_t *, sseinst_t *,
204 enum fex_exception *, fex_info_t *);
205 extern void __fex_st_sse_result(ucontext_t *, sseinst_t *,
206 enum fex_exception, fex_info_t *);
207 extern void __fex_st_simd_result(ucontext_t *, sseinst_t *,
208 enum fex_exception *, fex_info_t *);
209 #else
210 #error Unknown architecture
211 #endif
212 #endif /* _M9X_FEX_HANDLER_H */
|