Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 130028 | Differences between
and this patch

Collapse All | Expand All

(-)linux-2.4.32-work/arch/i386/kernel/i387.c (-1 / +6 lines)
Lines 11-16 Link Here
11
#include <linux/config.h>
11
#include <linux/config.h>
12
#include <linux/sched.h>
12
#include <linux/sched.h>
13
#include <linux/init.h>
13
#include <linux/init.h>
14
#include <linux/kernel_stat.h>
14
#include <asm/processor.h>
15
#include <asm/processor.h>
15
#include <asm/i387.h>
16
#include <asm/i387.h>
16
#include <asm/math_emu.h>
17
#include <asm/math_emu.h>
Lines 70-77 void init_fpu(void) Link Here
70
static inline void __save_init_fpu( struct task_struct *tsk )
71
static inline void __save_init_fpu( struct task_struct *tsk )
71
{
72
{
72
	if ( cpu_has_fxsr ) {
73
	if ( cpu_has_fxsr ) {
73
		asm volatile( "fxsave %0 ; fnclex"
74
		asm volatile( "fxsave %0"
74
			      : "=m" (tsk->thread.i387.fxsave) );
75
			      : "=m" (tsk->thread.i387.fxsave) );
76
		if (tsk->thread.i387.fxsave.swd & (1<<7))
77
			asm volatile("fnclex");
78
		/* AMD CPUs leak F?P. Clear it here */
79
		asm volatile("ffree %%st(7) ; fildl %0" :: "m" (kstat.context_swtch));
75
	} else {
80
	} else {
76
		asm volatile( "fnsave %0 ; fwait"
81
		asm volatile( "fnsave %0 ; fwait"
77
			      : "=m" (tsk->thread.i387.fsave) );
82
			      : "=m" (tsk->thread.i387.fsave) );
(-)linux-2.4.32-work/include/asm-x86_64/i387.h (-1 / +5 lines)
Lines 125-132 static inline void kernel_fpu_begin(void Link Here
125
125
126
static inline void save_init_fpu( struct task_struct *tsk )
126
static inline void save_init_fpu( struct task_struct *tsk )
127
{
127
{
128
	asm volatile( "fxsave %0 ; fnclex"
128
	asm volatile( "fxsave %0"
129
		      : "=m" (tsk->thread.i387.fxsave));
129
		      : "=m" (tsk->thread.i387.fxsave));
130
	if (tsk->thread.i387.fxsave.swd & (1<<7))
131
		asm volatile("fnclex");
132
	/* AMD CPUs leak F?P through FXSAVE. Clear it here */
133
	asm volatile("ffree %st(7) ; fildl %gs:0");
130
	tsk->flags &= ~PF_USEDFPU;
134
	tsk->flags &= ~PF_USEDFPU;
131
	stts();
135
	stts();
132
}
136
}
(-)linux-2.4.32-work/arch/x86_64/kernel/process.c (-2 / +5 lines)
Lines 564-571 struct task_struct *__switch_to(struct t Link Here
564
				 *next = &next_p->thread;
564
				 *next = &next_p->thread;
565
	struct tss_struct *tss = init_tss + smp_processor_id();
565
	struct tss_struct *tss = init_tss + smp_processor_id();
566
566
567
	unlazy_fpu(prev_p);
568
569
	/*
567
	/*
570
	 * Reload rsp0, LDT and the page table pointer:
568
	 * Reload rsp0, LDT and the page table pointer:
571
	 */
569
	 */
Lines 583-588 struct task_struct *__switch_to(struct t Link Here
583
		loadsegment(ds, next->ds);
581
		loadsegment(ds, next->ds);
584
582
585
	/* 
583
	/* 
584
  	 * Must be after DS reload for AMD workaround.
585
	 */
586
	unlazy_fpu(prev_p);
587
588
	/* 
586
	 * Switch FS and GS.
589
	 * Switch FS and GS.
587
	 */
590
	 */
588
	{ 
591
	{ 

Return to bug 130028