Re: 2.4.1-pre1 breaks XFree 4.0.2 and "w"

Andrea Arcangeli
2001-01-11T18:54:53Z

On Thu, Jan 11, 2001 at 06:48:21PM +0100, Andrea Arcangeli wrote:
> Ah no, I even better, just pass `nofxsr` to the 2.4.1-pre2 kernel. (no
> need to recompile)

Ok here the right fix against 2.4.1-pre2 so now you can use 3dnow and fxsr
at the same time (and nofxsr can still dynamically disable fxsr and xmm):

diff -urN -X /home/andrea/bin/dontdiff 2.4.1-pre2/arch/i386/kernel/i386_ksyms.c 2.4.1-pre2-fxsr/arch/i386/kernel/i386_ksyms.c
--- 2.4.1-pre2/arch/i386/kernel/i386_ksyms.c Thu Dec 14 22:33:59 2000
+++ 2.4.1-pre2-fxsr/arch/i386/kernel/i386_ksyms.c Thu Jan 11 18:07:53 2001
@@ -116,6 +116,7 @@
EXPORT_SYMBOL(mmx_clear_page);
EXPORT_SYMBOL(mmx_copy_page);
#endif
+EXPORT_SYMBOL(mmu_cr4_features);

#ifdef CONFIG_SMP
EXPORT_SYMBOL(cpu_data);
diff -urN -X /home/andrea/bin/dontdiff 2.4.1-pre2/arch/i386/kernel/i387.c 2.4.1-pre2-fxsr/arch/i386/kernel/i387.c
--- 2.4.1-pre2/arch/i386/kernel/i387.c Thu Jan 11 17:52:05 2001
+++ 2.4.1-pre2-fxsr/arch/i386/kernel/i387.c Thu Jan 11 18:55:52 2001
@@ -43,7 +43,7 @@
* FPU lazy state save handling.
*/

-void save_init_fpu( struct task_struct *tsk )
+inline void __save_init_fpu( struct task_struct *tsk )
{
if ( HAVE_FXSR ) {
asm volatile( "fxsave %0 ; fnclex"
@@ -53,6 +53,11 @@
: "=m" (tsk->thread.i387.fsave) );
}
tsk->flags &= ~PF_USEDFPU;
+}
+
+void save_init_fpu( struct task_struct *tsk )
+{
+ __save_init_fpu(tsk);
stts();
}

diff -urN -X /home/andrea/bin/dontdiff 2.4.1-pre2/arch/i386/lib/mmx.c 2.4.1-pre2-fxsr/arch/i386/lib/mmx.c
--- 2.4.1-pre2/arch/i386/lib/mmx.c Tue Nov 28 18:39:59 2000
+++ 2.4.1-pre2-fxsr/arch/i386/lib/mmx.c Thu Jan 11 19:23:53 2001
@@ -29,10 +29,7 @@
if (!(current->flags & PF_USEDFPU))
clts();
else
- {
- __asm__ __volatile__ ( " fnsave %0; fwait\n"::"m"(current->thread.i387));
- current->flags &= ~PF_USEDFPU;
- }
+ __save_init_fpu(current);

__asm__ __volatile__ (
"1: prefetch (%0)\n" /* This set is 28 bytes */
@@ -98,10 +95,7 @@
if (!(current->flags & PF_USEDFPU))
clts();
else
- {
- __asm__ __volatile__ ( " fnsave %0; fwait\n"::"m"(current->thread.i387));
- current->flags &= ~PF_USEDFPU;
- }
+ __save_init_fpu(current);

__asm__ __volatile__ (
" pxor %%mm0, %%mm0\n" : :
@@ -136,10 +130,7 @@
if (!(current->flags & PF_USEDFPU))
clts();
else
- {
- __asm__ __volatile__ ( " fnsave %0; fwait\n"::"m"(current->thread.i387));
- current->flags &= ~PF_USEDFPU;
- }
+ __save_init_fpu(current);

/* maybe the prefetch stuff can go before the expensive fnsave...
* but that is for later. -AV
diff -urN -X /home/andrea/bin/dontdiff 2.4.1-pre2/include/asm-i386/i387.h 2.4.1-pre2-fxsr/include/asm-i386/i387.h
--- 2.4.1-pre2/include/asm-i386/i387.h Thu Jan 11 17:59:31 2001
+++ 2.4.1-pre2-fxsr/include/asm-i386/i387.h Thu Jan 11 18:56:32 2001
@@ -20,6 +20,7 @@
/*
* FPU lazy state save handling...
*/
+extern void __save_init_fpu( struct task_struct *tsk );
extern void save_init_fpu( struct task_struct *tsk );
extern void restore_fpu( struct task_struct *tsk );

Andrea