diff options
Diffstat (limited to 'arch/x86/math-emu/fpu_emu.h')
-rw-r--r-- | arch/x86/math-emu/fpu_emu.h | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/arch/x86/math-emu/fpu_emu.h b/arch/x86/math-emu/fpu_emu.h index 65120f523853..656dd4c04b1b 100644 --- a/arch/x86/math-emu/fpu_emu.h +++ b/arch/x86/math-emu/fpu_emu.h | |||
@@ -7,7 +7,6 @@ | |||
7 | | | | 7 | | | |
8 | +---------------------------------------------------------------------------*/ | 8 | +---------------------------------------------------------------------------*/ |
9 | 9 | ||
10 | |||
11 | #ifndef _FPU_EMU_H_ | 10 | #ifndef _FPU_EMU_H_ |
12 | #define _FPU_EMU_H_ | 11 | #define _FPU_EMU_H_ |
13 | 12 | ||
@@ -28,15 +27,15 @@ | |||
28 | #endif | 27 | #endif |
29 | 28 | ||
30 | #define EXP_BIAS Const(0) | 29 | #define EXP_BIAS Const(0) |
31 | #define EXP_OVER Const(0x4000) /* smallest invalid large exponent */ | 30 | #define EXP_OVER Const(0x4000) /* smallest invalid large exponent */ |
32 | #define EXP_UNDER Const(-0x3fff) /* largest invalid small exponent */ | 31 | #define EXP_UNDER Const(-0x3fff) /* largest invalid small exponent */ |
33 | #define EXP_WAY_UNDER Const(-0x6000) /* Below the smallest denormal, but | 32 | #define EXP_WAY_UNDER Const(-0x6000) /* Below the smallest denormal, but |
34 | still a 16 bit nr. */ | 33 | still a 16 bit nr. */ |
35 | #define EXP_Infinity EXP_OVER | 34 | #define EXP_Infinity EXP_OVER |
36 | #define EXP_NaN EXP_OVER | 35 | #define EXP_NaN EXP_OVER |
37 | 36 | ||
38 | #define EXTENDED_Ebias Const(0x3fff) | 37 | #define EXTENDED_Ebias Const(0x3fff) |
39 | #define EXTENDED_Emin (-0x3ffe) /* smallest valid exponent */ | 38 | #define EXTENDED_Emin (-0x3ffe) /* smallest valid exponent */ |
40 | 39 | ||
41 | #define SIGN_POS Const(0) | 40 | #define SIGN_POS Const(0) |
42 | #define SIGN_NEG Const(0x80) | 41 | #define SIGN_NEG Const(0x80) |
@@ -44,10 +43,9 @@ | |||
44 | #define SIGN_Positive Const(0) | 43 | #define SIGN_Positive Const(0) |
45 | #define SIGN_Negative Const(0x8000) | 44 | #define SIGN_Negative Const(0x8000) |
46 | 45 | ||
47 | |||
48 | /* Keep the order TAG_Valid, TAG_Zero, TW_Denormal */ | 46 | /* Keep the order TAG_Valid, TAG_Zero, TW_Denormal */ |
49 | /* The following fold to 2 (Special) in the Tag Word */ | 47 | /* The following fold to 2 (Special) in the Tag Word */ |
50 | #define TW_Denormal Const(4) /* De-normal */ | 48 | #define TW_Denormal Const(4) /* De-normal */ |
51 | #define TW_Infinity Const(5) /* + or - infinity */ | 49 | #define TW_Infinity Const(5) /* + or - infinity */ |
52 | #define TW_NaN Const(6) /* Not a Number */ | 50 | #define TW_NaN Const(6) /* Not a Number */ |
53 | #define TW_Unsupported Const(7) /* Not supported by an 80486 */ | 51 | #define TW_Unsupported Const(7) /* Not supported by an 80486 */ |
@@ -67,14 +65,13 @@ | |||
67 | #define DEST_RM 0x20 | 65 | #define DEST_RM 0x20 |
68 | #define LOADED 0x40 | 66 | #define LOADED 0x40 |
69 | 67 | ||
70 | #define FPU_Exception Const(0x80000000) /* Added to tag returns. */ | 68 | #define FPU_Exception Const(0x80000000) /* Added to tag returns. */ |
71 | |||
72 | 69 | ||
73 | #ifndef __ASSEMBLY__ | 70 | #ifndef __ASSEMBLY__ |
74 | 71 | ||
75 | #include "fpu_system.h" | 72 | #include "fpu_system.h" |
76 | 73 | ||
77 | #include <asm/sigcontext.h> /* for struct _fpstate */ | 74 | #include <asm/sigcontext.h> /* for struct _fpstate */ |
78 | #include <asm/math_emu.h> | 75 | #include <asm/math_emu.h> |
79 | #include <linux/linkage.h> | 76 | #include <linux/linkage.h> |
80 | 77 | ||
@@ -112,30 +109,33 @@ extern u_char emulating; | |||
112 | #define PREFIX_DEFAULT 7 | 109 | #define PREFIX_DEFAULT 7 |
113 | 110 | ||
114 | struct address { | 111 | struct address { |
115 | unsigned int offset; | 112 | unsigned int offset; |
116 | unsigned int selector:16; | 113 | unsigned int selector:16; |
117 | unsigned int opcode:11; | 114 | unsigned int opcode:11; |
118 | unsigned int empty:5; | 115 | unsigned int empty:5; |
119 | }; | 116 | }; |
120 | struct fpu__reg { | 117 | struct fpu__reg { |
121 | unsigned sigl; | 118 | unsigned sigl; |
122 | unsigned sigh; | 119 | unsigned sigh; |
123 | short exp; | 120 | short exp; |
124 | }; | 121 | }; |
125 | 122 | ||
126 | typedef void (*FUNC)(void); | 123 | typedef void (*FUNC) (void); |
127 | typedef struct fpu__reg FPU_REG; | 124 | typedef struct fpu__reg FPU_REG; |
128 | typedef void (*FUNC_ST0)(FPU_REG *st0_ptr, u_char st0_tag); | 125 | typedef void (*FUNC_ST0) (FPU_REG * st0_ptr, u_char st0_tag); |
129 | typedef struct { u_char address_size, operand_size, segment; } | 126 | typedef struct { |
130 | overrides; | 127 | u_char address_size, operand_size, segment; |
128 | } overrides; | ||
131 | /* This structure is 32 bits: */ | 129 | /* This structure is 32 bits: */ |
132 | typedef struct { overrides override; | 130 | typedef struct { |
133 | u_char default_mode; } fpu_addr_modes; | 131 | overrides override; |
132 | u_char default_mode; | ||
133 | } fpu_addr_modes; | ||
134 | /* PROTECTED has a restricted meaning in the emulator; it is used | 134 | /* PROTECTED has a restricted meaning in the emulator; it is used |
135 | to signal that the emulator needs to do special things to ensure | 135 | to signal that the emulator needs to do special things to ensure |
136 | that protection is respected in a segmented model. */ | 136 | that protection is respected in a segmented model. */ |
137 | #define PROTECTED 4 | 137 | #define PROTECTED 4 |
138 | #define SIXTEEN 1 /* We rely upon this being 1 (true) */ | 138 | #define SIXTEEN 1 /* We rely upon this being 1 (true) */ |
139 | #define VM86 SIXTEEN | 139 | #define VM86 SIXTEEN |
140 | #define PM16 (SIXTEEN | PROTECTED) | 140 | #define PM16 (SIXTEEN | PROTECTED) |
141 | #define SEG32 PROTECTED | 141 | #define SEG32 PROTECTED |
@@ -166,10 +166,10 @@ extern u_char const data_sizes_16[32]; | |||
166 | #define signpositive(a) ( (signbyte(a) & 0x80) == 0 ) | 166 | #define signpositive(a) ( (signbyte(a) & 0x80) == 0 ) |
167 | #define signnegative(a) (signbyte(a) & 0x80) | 167 | #define signnegative(a) (signbyte(a) & 0x80) |
168 | 168 | ||
169 | static inline void reg_copy(FPU_REG const *x, FPU_REG *y) | 169 | static inline void reg_copy(FPU_REG const *x, FPU_REG * y) |
170 | { | 170 | { |
171 | *(short *)&(y->exp) = *(const short *)&(x->exp); | 171 | *(short *)&(y->exp) = *(const short *)&(x->exp); |
172 | *(long long *)&(y->sigl) = *(const long long *)&(x->sigl); | 172 | *(long long *)&(y->sigl) = *(const long long *)&(x->sigl); |
173 | } | 173 | } |
174 | 174 | ||
175 | #define exponent(x) (((*(short *)&((x)->exp)) & 0x7fff) - EXTENDED_Ebias) | 175 | #define exponent(x) (((*(short *)&((x)->exp)) & 0x7fff) - EXTENDED_Ebias) |
@@ -184,29 +184,28 @@ static inline void reg_copy(FPU_REG const *x, FPU_REG *y) | |||
184 | 184 | ||
185 | #define significand(x) ( ((unsigned long long *)&((x)->sigl))[0] ) | 185 | #define significand(x) ( ((unsigned long long *)&((x)->sigl))[0] ) |
186 | 186 | ||
187 | |||
188 | /*----- Prototypes for functions written in assembler -----*/ | 187 | /*----- Prototypes for functions written in assembler -----*/ |
189 | /* extern void reg_move(FPU_REG *a, FPU_REG *b); */ | 188 | /* extern void reg_move(FPU_REG *a, FPU_REG *b); */ |
190 | 189 | ||
191 | asmlinkage int FPU_normalize(FPU_REG *x); | 190 | asmlinkage int FPU_normalize(FPU_REG * x); |
192 | asmlinkage int FPU_normalize_nuo(FPU_REG *x); | 191 | asmlinkage int FPU_normalize_nuo(FPU_REG * x); |
193 | asmlinkage int FPU_u_sub(FPU_REG const *arg1, FPU_REG const *arg2, | 192 | asmlinkage int FPU_u_sub(FPU_REG const *arg1, FPU_REG const *arg2, |
194 | FPU_REG *answ, unsigned int control_w, u_char sign, | 193 | FPU_REG * answ, unsigned int control_w, u_char sign, |
195 | int expa, int expb); | 194 | int expa, int expb); |
196 | asmlinkage int FPU_u_mul(FPU_REG const *arg1, FPU_REG const *arg2, | 195 | asmlinkage int FPU_u_mul(FPU_REG const *arg1, FPU_REG const *arg2, |
197 | FPU_REG *answ, unsigned int control_w, u_char sign, | 196 | FPU_REG * answ, unsigned int control_w, u_char sign, |
198 | int expon); | 197 | int expon); |
199 | asmlinkage int FPU_u_div(FPU_REG const *arg1, FPU_REG const *arg2, | 198 | asmlinkage int FPU_u_div(FPU_REG const *arg1, FPU_REG const *arg2, |
200 | FPU_REG *answ, unsigned int control_w, u_char sign); | 199 | FPU_REG * answ, unsigned int control_w, u_char sign); |
201 | asmlinkage int FPU_u_add(FPU_REG const *arg1, FPU_REG const *arg2, | 200 | asmlinkage int FPU_u_add(FPU_REG const *arg1, FPU_REG const *arg2, |
202 | FPU_REG *answ, unsigned int control_w, u_char sign, | 201 | FPU_REG * answ, unsigned int control_w, u_char sign, |
203 | int expa, int expb); | 202 | int expa, int expb); |
204 | asmlinkage int wm_sqrt(FPU_REG *n, int dummy1, int dummy2, | 203 | asmlinkage int wm_sqrt(FPU_REG * n, int dummy1, int dummy2, |
205 | unsigned int control_w, u_char sign); | 204 | unsigned int control_w, u_char sign); |
206 | asmlinkage unsigned FPU_shrx(void *l, unsigned x); | 205 | asmlinkage unsigned FPU_shrx(void *l, unsigned x); |
207 | asmlinkage unsigned FPU_shrxs(void *v, unsigned x); | 206 | asmlinkage unsigned FPU_shrxs(void *v, unsigned x); |
208 | asmlinkage unsigned long FPU_div_small(unsigned long long *x, unsigned long y); | 207 | asmlinkage unsigned long FPU_div_small(unsigned long long *x, unsigned long y); |
209 | asmlinkage int FPU_round(FPU_REG *arg, unsigned int extent, int dummy, | 208 | asmlinkage int FPU_round(FPU_REG * arg, unsigned int extent, int dummy, |
210 | unsigned int control_w, u_char sign); | 209 | unsigned int control_w, u_char sign); |
211 | 210 | ||
212 | #ifndef MAKING_PROTO | 211 | #ifndef MAKING_PROTO |