patch-2.4.0-test2 linux/include/asm-i386/processor.h

Next file: linux/include/asm-i386/ptrace.h
Previous file: linux/include/asm-i386/pci.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test1/linux/include/asm-i386/processor.h linux/include/asm-i386/processor.h
@@ -83,24 +83,22 @@
 #define X86_FEATURE_PGE		0x00002000	/* Page Global Enable */
 #define X86_FEATURE_MCA		0x00004000	/* Machine Check Architecture */
 #define X86_FEATURE_CMOV	0x00008000	/* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */
-#define X86_FEATURE_PAT	0x00010000	/* Page Attribute Table */
+#define X86_FEATURE_PAT		0x00010000	/* Page Attribute Table */
 #define X86_FEATURE_PSE36	0x00020000	/* 36-bit PSEs */
 #define X86_FEATURE_18		0x00040000
 #define X86_FEATURE_19		0x00080000
 #define X86_FEATURE_20		0x00100000
 #define X86_FEATURE_21		0x00200000
 #define X86_FEATURE_22		0x00400000
-#define X86_FEATURE_MMX		0x00800000	/* multimedia extensions */
+#define X86_FEATURE_MMX		0x00800000	/* Multimedia Extensions */
 #define X86_FEATURE_FXSR	0x01000000	/* FXSAVE and FXRSTOR instructions (fast save and restore of FPU context), and CR4.OSFXSR (OS uses these instructions) available */
-#define X86_FEATURE_XMM         0x02000000      /* Intel MMX2 instruction set */
+#define X86_FEATURE_XMM		0x02000000      /* Streaming SIMD Extensions */
 #define X86_FEATURE_26		0x04000000
 #define X86_FEATURE_27		0x08000000
 #define X86_FEATURE_28		0x10000000
 #define X86_FEATURE_29		0x20000000
 #define X86_FEATURE_30		0x40000000
 #define X86_FEATURE_AMD3D	0x80000000
-#define X86_CR4_OSFXSR		0x0200 		/* fast FPU save/restore */
-#define X86_CR4_OSXMMEXCPT	0x0400 		/* KNI (MMX2) unmasked exception 16 */
 
 extern struct cpuinfo_x86 boot_cpu_data;
 extern struct tss_struct init_tss[NR_CPUS];
@@ -125,6 +123,10 @@
 		(boot_cpu_data.x86_capability & X86_FEATURE_DE)
 #define cpu_has_vme \
 		(boot_cpu_data.x86_capability & X86_FEATURE_VME)
+#define cpu_has_fxsr \
+		(boot_cpu_data.x86_capability & X86_FEATURE_FXSR)
+#define cpu_has_xmm \
+		(boot_cpu_data.x86_capability & X86_FEATURE_XMM)
 
 extern char ignore_irq13;
 
@@ -150,15 +152,17 @@
 /*
  * Intel CPU features in CR4
  */
-#define X86_CR4_VME	0x0001	/* enable vm86 extensions */
-#define X86_CR4_PVI	0x0002	/* virtual interrupts flag enable */
-#define X86_CR4_TSD	0x0004	/* disable time stamp at ipl 3 */
-#define X86_CR4_DE	0x0008	/* enable debugging extensions */
-#define X86_CR4_PSE	0x0010	/* enable page size extensions */
-#define X86_CR4_PAE	0x0020	/* enable physical address extensions */
-#define X86_CR4_MCE	0x0040	/* Machine check enable */
-#define X86_CR4_PGE	0x0080	/* enable global pages */
-#define X86_CR4_PCE	0x0100	/* enable performance counters at ipl 3 */
+#define X86_CR4_VME		0x0001	/* enable vm86 extensions */
+#define X86_CR4_PVI		0x0002	/* virtual interrupts flag enable */
+#define X86_CR4_TSD		0x0004	/* disable time stamp at ipl 3 */
+#define X86_CR4_DE		0x0008	/* enable debugging extensions */
+#define X86_CR4_PSE		0x0010	/* enable page size extensions */
+#define X86_CR4_PAE		0x0020	/* enable physical address extensions */
+#define X86_CR4_MCE		0x0040	/* Machine check enable */
+#define X86_CR4_PGE		0x0080	/* enable global pages */
+#define X86_CR4_PCE		0x0100	/* enable performance counters at ipl 3 */
+#define X86_CR4_OSFXSR		0x0200	/* enable fast FPU save and restore */
+#define X86_CR4_OSXMMEXCPT	0x0400	/* enable unmasked SSE exceptions */
 
 /*
  * Save the cr4 feature set we're using (ie
@@ -244,23 +248,7 @@
 #define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
 #define INVALID_IO_BITMAP_OFFSET 0x8000
 
-#ifndef CONFIG_X86_FX
-
-#define i387_save_hard(x) \
-	__asm__("fnsave %0\n\tfwait": :"m" (x))
-#define i387_restore_hard(x) \
-	__asm__("frstor %0": :"m" (x))
-
-#define i387_hard_to_user(uaddr, x) \
-	__copy_to_user((uaddr), (x), sizeof(struct i387_hard_struct))
-#define i387_user_to_hard(x, uaddr) \
-	__copy_from_user((x), (uaddr), sizeof(struct i387_hard_struct))
-
-#define i387_set_cwd(x,v) do { (x).cwd = 0xffff0000 | (v); } while (0)
-#define i387_set_swd(x,v) do { (x).swd = 0xffff0000 | (v); } while (0)
-#define i387_set_twd(x,v) do { (x).twd = 0xffff0000 | (v); } while (0)
-
-struct i387_hard_struct {
+struct i387_fsave_struct {
 	long	cwd;
 	long	swd;
 	long	twd;
@@ -272,69 +260,22 @@
 	long	status;		/* software status information */
 };
 
-#else
-
-/*
- * has to be 128-bit aligned
- */
-struct i387_hard_struct {
+struct i387_fxsave_struct {
 	unsigned short	cwd;
 	unsigned short	swd;
 	unsigned short	twd;
-	unsigned short	fopcode;
-	unsigned int	fip;
-	unsigned short	fcs;
-	unsigned short	__reserved_01;
-	unsigned int	fdp;
-	unsigned short	fds;
-	unsigned short	__reserved_02;
-	unsigned int	mxcsr;
-	unsigned int	__reserved_03;
-	unsigned int	st_space[32]; /* 8*16 bytes for each FP/MMX-reg = 128 bytes */
-	unsigned int	xmm_space[22*4]; /* 22 cachelines for MMX2 registers */
-	unsigned long	status;
+	unsigned short	fop;
+	long	fip;
+	long	fcs;
+	long	foo;
+	long	fos;
+	long	mxcsr;
+	long	reserved;
+	long	st_space[32];	/* 8*16 bytes for each FP-reg = 128 bytes */
+	long	xmm_space[32];	/* 8*16 bytes for each XMM-reg = 128 bytes */
+	long	padding[56];
 } __attribute__ ((aligned (16)));
 
-/*
- * tag word conversion (thanks to Gabriel Paubert for noticing the
- * subtle format difference and implementing these functions)
- *
- * there are several erratas wrt. the tag word in the i387, thus
- * any software relying on it's value is questionable, but we
- * definitely want to be as close as possible.
- */
-static inline unsigned short fputag_KNIto387(unsigned char tb) {
-	unsigned short tw = tb;
-	tw = ((tw<<4) | tw) &0x0f0f; /* zzzz7654zzzz3210 */
-	tw = ((tw<<2) | tw) &0x3333; /* zz76zz54zz32zz10 */
-	tw = ((tw<<1) | tw) &0x5555; /* z7z6z5z4z3z2z1z0 */
-	return ~(tw*3);
-}
-
-static inline unsigned char fputag_387toKNI(unsigned short tw) {
-	tw = ~tw;
-	tw = (tw | (tw>>1)) & 0x5555; /* z7z6z5z4z3z2z1z0 */
-	tw = (tw | (tw>>1)) & 0x3333; /* zz76zz54zz32zz10 */
-	tw = (tw | (tw>>3)) & 0x0f0f; /* zzzz7654zzzz3210 */
-	return (tw|(tw>>4)) & 0x00ff; /* zzzzzzzz76543210 */
-}
-
-#define i387_set_cwd(x,v) do { (x).cwd = (short)(v); } while (0)
-#define i387_set_swd(x,v) do { (x).swd = (short)(v); } while (0)
-#define i387_set_twd(x,v) do { (x).twd = fputag_387toKNI(v); } while (0)
-
-#define i387_save_hard(x) \
- { __asm__ __volatile__(".byte 0x0f, 0xae, 0x06": :"S" (&(x))); } while (0)
-
-#define i387_restore_hard(x) \
-do { __asm__ __volatile__(".byte 0x0f, 0xae, 0x4f, 0x00": :"D" (&(x))); } while(0)
-
-extern int i387_hard_to_user ( struct _fpstate * user,
-			      struct i387_hard_struct * hard);
-extern int i387_user_to_hard (struct i387_hard_struct * hard,
-			      struct _fpstate * user);
-#endif
-
 struct i387_soft_struct {
 	long	cwd;
 	long	swd;
@@ -350,7 +291,8 @@
 };
 
 union i387_union {
-	struct i387_hard_struct hard;
+	struct i387_fsave_struct	fsave;
+	struct i387_fxsave_struct	fxsave;
 	struct i387_soft_struct soft;
 };
 
@@ -467,27 +409,6 @@
 extern void forget_segments(void);
 
 /*
- * FPU lazy state save handling..
- */
-#define save_fpu(tsk) do { \
-        i387_save_hard(tsk->thread.i387); \
-	tsk->flags &= ~PF_USEDFPU; \
-	stts(); \
-} while (0)
-
-#define unlazy_fpu(tsk) do { \
-	if (tsk->flags & PF_USEDFPU) \
-		save_fpu(tsk); \
-} while (0)
-
-#define clear_fpu(tsk) do { \
-	if (tsk->flags & PF_USEDFPU) { \
-		tsk->flags &= ~PF_USEDFPU; \
-		stts(); \
-	} \
-} while (0)
-
-/*
  * Return saved PC of a blocked thread.
  */
 extern inline unsigned long thread_saved_pc(struct thread_struct *t)
@@ -518,5 +439,7 @@
 	unsigned int reserved[5];
 	unsigned int bits[500];
 };
+
+#define MICROCODE_IOCFREE	_IO('6',0) /* because it is for P6 */
 
 #endif /* __ASM_I386_PROCESSOR_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)