--- linux/include/asm-i386/i387.h.p3 Sun Mar 26 10:12:43 2000
+++ linux/include/asm-i386/i387.h Sun Mar 26 10:14:12 2000
@@ -68,6 +68,15 @@ do { \
} \
} while(0)
+#define i387_get_swd(v,x) \
+do { \
+ if (boot_cpu_data.x86_capability & X86_FEATURE_FXSR) { \
+ v = (unsigned long) (x).fxsave.fxswd; \
+ } else { \
+ v = (unsigned long) (x).fsave.swd; \
+ } \
+} while(0)
+
#define i387_set_twd(x,v) \
do { \
if (boot_cpu_data.x86_capability & X86_FEATURE_FXSR) { \
@@ -114,6 +123,9 @@ do { (x).fsave.cwd = ((long)(v) | 0xffff
#define i387_set_swd(x,v) \
do { (x).fsave.swd = ((long)(v) | 0xffff0000); } while(0)
+
+#define i387_get_swd(v,x) \
+do { v = (unsigned long) (x).fsave.swd; } while(0)
#define i387_set_twd(x,v) \
do { (x).fsave.twd = ((long)(v) | 0xffff0000); } while(0)
--- linux/arch/i386/kernel/signal.c.p3 Sun Mar 26 10:12:43 2000
+++ linux/arch/i386/kernel/signal.c Sun Mar 26 10:12:50 2000
@@ -154,14 +154,11 @@ struct rt_sigframe
static inline int restore_i387_hard(struct _fpstate *buf)
{
- int err = 0;
struct task_struct *tsk = current;
clear_fpu(tsk);
- err = i387_user_to_hard(&tsk->tss.i387.hard,
- (struct user_i387_struct *)buf);
- err |= get_user(tsk->tss.i387.hard.fsave.swd, &buf->status);
- return err;
+ return i387_user_to_hard(&tsk->tss.i387.hard,
+ (struct user_i387_struct *)buf);
}
static inline int restore_i387(struct _fpstate *buf)
@@ -312,12 +309,14 @@ badframe:
static inline int save_i387_hard(struct _fpstate * buf)
{
int err = 0;
+ unsigned long status;
struct task_struct *tsk = current;
unlazy_fpu(tsk);
err = i387_hard_to_user((struct user_i387_struct *)buf,
&tsk->tss.i387.hard);
- err |= put_user(tsk->tss.i387.hard.fsave.swd, &buf->status);
+ i387_get_swd(status, tsk->tss.i387.hard);
+ err |= put_user(status, &buf->status);
if (err)
return -1;
return 1;