aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/sys-i386/ptrace.c')
-rw-r--r--arch/um/sys-i386/ptrace.c79
1 files changed, 0 insertions, 79 deletions
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 178f894384f..cb899dd1c6b 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -144,85 +144,6 @@ int peek_user(struct task_struct *child, long addr, long data)
144 return put_user(tmp, (unsigned long __user *) data); 144 return put_user(tmp, (unsigned long __user *) data);
145} 145}
146 146
147struct i387_fxsave_struct {
148 unsigned short cwd;
149 unsigned short swd;
150 unsigned short twd;
151 unsigned short fop;
152 long fip;
153 long fcs;
154 long foo;
155 long fos;
156 long mxcsr;
157 long reserved;
158 long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
159 long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
160 long padding[56];
161};
162
163/*
164 * FPU tag word conversions.
165 */
166
167static inline unsigned short twd_i387_to_fxsr( unsigned short twd )
168{
169 unsigned int tmp; /* to avoid 16 bit prefixes in the code */
170
171 /* Transform each pair of bits into 01 (valid) or 00 (empty) */
172 tmp = ~twd;
173 tmp = (tmp | (tmp>>1)) & 0x5555; /* 0V0V0V0V0V0V0V0V */
174 /* and move the valid bits to the lower byte. */
175 tmp = (tmp | (tmp >> 1)) & 0x3333; /* 00VV00VV00VV00VV */
176 tmp = (tmp | (tmp >> 2)) & 0x0f0f; /* 0000VVVV0000VVVV */
177 tmp = (tmp | (tmp >> 4)) & 0x00ff; /* 00000000VVVVVVVV */
178 return tmp;
179}
180
181static inline unsigned long twd_fxsr_to_i387( struct i387_fxsave_struct *fxsave )
182{
183 struct _fpxreg *st = NULL;
184 unsigned long twd = (unsigned long) fxsave->twd;
185 unsigned long tag;
186 unsigned long ret = 0xffff0000;
187 int i;
188
189#define FPREG_ADDR(f, n) ((char *)&(f)->st_space + (n) * 16);
190
191 for ( i = 0 ; i < 8 ; i++ ) {
192 if ( twd & 0x1 ) {
193 st = (struct _fpxreg *) FPREG_ADDR( fxsave, i );
194
195 switch ( st->exponent & 0x7fff ) {
196 case 0x7fff:
197 tag = 2; /* Special */
198 break;
199 case 0x0000:
200 if ( !st->significand[0] &&
201 !st->significand[1] &&
202 !st->significand[2] &&
203 !st->significand[3] ) {
204 tag = 1; /* Zero */
205 } else {
206 tag = 2; /* Special */
207 }
208 break;
209 default:
210 if ( st->significand[3] & 0x8000 ) {
211 tag = 0; /* Valid */
212 } else {
213 tag = 2; /* Special */
214 }
215 break;
216 }
217 } else {
218 tag = 3; /* Empty */
219 }
220 ret |= (tag << (2 * i));
221 twd = twd >> 1;
222 }
223 return ret;
224}
225
226static inline int convert_fxsr_to_user(struct _fpstate __user *buf, 147static inline int convert_fxsr_to_user(struct _fpstate __user *buf,
227 struct pt_regs *regs) 148 struct pt_regs *regs)
228{ 149{