* [PATCH] sanitize intel movsl selection
@ 2002-10-29 19:07 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2002-10-29 19:07 UTC (permalink / raw)
To: torvalds, akpm; +Cc: linux-kernel
umm, the ifdef <actual cpu selection> is very bad style, we usually
introduce feature CONFIG_ options in config.in instead.
--- 1.60/arch/i386/config.in Thu Oct 24 12:58:07 2002
+++ edited/arch/i386/config.in Tue Oct 29 18:44:36 2002
@@ -83,6 +83,7 @@
define_bool CONFIG_X86_GOOD_APIC y
define_bool CONFIG_X86_PPRO_FENCE y
define_bool CONFIG_X86_F00F_BUG y
+ define_bool CONFIG_X86_INTEL_USERCOPY y
fi
if [ "$CONFIG_M686" = "y" ]; then
define_int CONFIG_X86_L1_CACHE_SHIFT 5
@@ -96,12 +97,14 @@
define_bool CONFIG_X86_TSC y
define_bool CONFIG_X86_GOOD_APIC y
define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+ define_bool CONFIG_X86_INTEL_USERCOPY y
fi
if [ "$CONFIG_MPENTIUM4" = "y" ]; then
define_int CONFIG_X86_L1_CACHE_SHIFT 7
define_bool CONFIG_X86_TSC y
define_bool CONFIG_X86_GOOD_APIC y
define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
+ define_bool CONFIG_X86_INTEL_USERCOPY y
fi
if [ "$CONFIG_MK6" = "y" ]; then
define_int CONFIG_X86_L1_CACHE_SHIFT 5
--- 1.11/arch/i386/kernel/cpu/intel.c Mon Oct 28 19:34:38 2002
+++ edited/arch/i386/kernel/cpu/intel.c Tue Oct 29 18:43:08 2002
@@ -14,9 +14,11 @@
static int disable_P4_HT __initdata = 0;
extern int trap_init_f00f_bug(void);
-#ifdef INTEL_MOVSL
-struct movsl_mask movsl_mask; /* alignment at which movsl is preferred for
- bulk memory copies */
+#ifdef CONFIG_X86_INTEL_USERCOPY
+/*
+ * Alignment at which movsl is preferred for bulk memory copies.
+ */
+struct movsl_mask movsl_mask;
#endif
/*
@@ -355,7 +357,7 @@
/* Work around errata */
Intel_errata_workarounds(c);
-#ifdef INTEL_MOVSL
+#ifdef CONFIG_X86_INTEL_USERCOPY
/*
* Set up the preferred alignment for movsl bulk memory moves
*/
@@ -372,7 +374,6 @@
break;
}
#endif
-
}
--- 1.6/arch/i386/lib/usercopy.c Mon Oct 28 19:34:41 2002
+++ edited/arch/i386/lib/usercopy.c Tue Oct 29 18:42:59 2002
@@ -9,21 +9,14 @@
#include <asm/uaccess.h>
#include <asm/mmx.h>
-#ifdef INTEL_MOVSL
-static inline int movsl_is_ok(const void *a1, const void *a2, unsigned long n)
-{
- if (n < 64)
- return 1;
- if ((((const long)a1 ^ (const long)a2) & movsl_mask.mask) == 0)
- return 1;
- return 0;
-}
-#else
static inline int movsl_is_ok(const void *a1, const void *a2, unsigned long n)
{
+#ifdef CONFIG_X86_INTEL_USERCOPY
+ if (n >= 64 || (((const long)a1 ^ (const long)a2) & movsl_mask.mask))
+ return 0;
+#endif
return 1;
}
-#endif
/*
* Copy a null terminated string from userspace.
@@ -151,8 +144,7 @@
return res & mask;
}
-#ifdef INTEL_MOVSL
-
+#ifdef CONFIG_X86_INTEL_USERCOPY
static unsigned long
__copy_user_intel(void *to, const void *from,unsigned long size)
{
@@ -334,8 +326,7 @@
: "eax", "edx", "memory");
return size;
}
-#else /* INTEL_MOVSL */
-
+#else
/*
* Leave these declared but undefined. They should not be any references to
* them
@@ -344,8 +335,7 @@
__copy_user_zeroing_intel(void *to, const void *from, unsigned long size);
unsigned long
__copy_user_intel(void *to, const void *from,unsigned long size);
-
-#endif /* INTEL_MOVSL */
+#endif /* CONFIG_X86_INTEL_USERCOPY */
/* Generic arbitrary sized copy. */
#define __copy_user(to,from,size) \
--- 1.10/include/asm-i386/uaccess.h Mon Oct 28 19:34:41 2002
+++ edited/include/asm-i386/uaccess.h Tue Oct 29 18:43:21 2002
@@ -36,12 +36,7 @@
/*
* movsl can be slow when source and dest are not both 8-byte aligned
*/
-#if defined(CONFIG_M586MMX) || defined(CONFIG_M686) || \
- defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUM4)
-#define INTEL_MOVSL
-#endif
-
-#ifdef INTEL_MOVSL
+#ifdef CONFIG_X86_INTEL_USERCOPY
extern struct movsl_mask {
int mask;
} ____cacheline_aligned_in_smp movsl_mask;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-29 19:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-29 19:07 [PATCH] sanitize intel movsl selection Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.