patch-2.1.54 linux/include/asm-i386/uaccess.h

Next file: linux/include/asm-mips/floppy.h
Previous file: linux/include/asm-i386/pgtable.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.53/linux/include/asm-i386/uaccess.h linux/include/asm-i386/uaccess.h
@@ -18,9 +18,19 @@
  * For historical reasons, these macros are grossly misnamed.
  */
 
+extern unsigned long __bad_fs_size(void);
+
 #define get_fs()	(current->tss.segment)
-#define set_fs(x)	(current->tss.segment = (x))
 #define get_ds()	(KERNEL_DS)
+
+/* Some architectures -- Alpha for one -- use "segment" schemes that 
+   require all bits to be preserved, thus the i386 traditional `ushort'
+   doesn't work.  To head off problems early, force the Intel folks
+   to do it Right as well.  */
+
+#define set_fs(x)	(current->tss.segment =				\
+			 sizeof(x) == sizeof(unsigned long) ? (x) 	\
+			 : __bad_fs_size())
 
 /*
  * Address Ok:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov