[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Wed Feb 1 10:56:47 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/319d2099782e
changeset: 315:319d2099782e
user:      ray at terran.dlink.ua
date:      Wed Feb 01 11:33:42 2012 +0200
description:
Update sys/i386

diffstat:

 head/sys/i386/conf/GENERIC         |   3 +-
 head/sys/i386/conf/NOTES           |   7 ++++-
 head/sys/i386/i386/initcpu.c       |   5 +++-
 head/sys/i386/i386/machdep.c       |   7 ++---
 head/sys/i386/include/float.h      |  18 +++++++++++++-
 head/sys/i386/include/npx.h        |  39 ++++++++++++++++++++++++------
 head/sys/i386/include/ptrace.h     |   4 ++-
 head/sys/i386/include/signal.h     |   9 ++++--
 head/sys/i386/include/specialreg.h |   3 +-
 head/sys/i386/include/sysarch.h    |   8 +++++-
 head/sys/i386/include/ucontext.h   |  16 +++++++++---
 head/sys/i386/isa/npx.c            |  48 ++++++++++++++++++++++++++++++++++++-
 12 files changed, 139 insertions(+), 28 deletions(-)

diffs (458 lines):

diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/conf/GENERIC
--- a/head/sys/i386/conf/GENERIC	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/conf/GENERIC	Wed Feb 01 11:33:42 2012 +0200
@@ -16,7 +16,7 @@
 # If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
-# $FreeBSD: head/sys/i386/conf/GENERIC 229997 2012-01-12 00:34:33Z ken $
+# $FreeBSD: head/sys/i386/conf/GENERIC 230843 2012-01-31 19:38:18Z jimharris $
 
 cpu		I486_CPU
 cpu		I586_CPU
@@ -130,6 +130,7 @@
 device		ncv		# NCR 53C500
 device		nsp		# Workbit Ninja SCSI-3
 device		stg		# TMC 18C30/18C50
+device		isci		# Intel C600 SAS controller
 
 # ATA/SCSI peripherals
 device		scbus		# SCSI bus (required for ATA/SCSI)
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/conf/NOTES
--- a/head/sys/i386/conf/NOTES	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/conf/NOTES	Wed Feb 01 11:33:42 2012 +0200
@@ -4,7 +4,7 @@
 # This file contains machine dependent kernel configuration notes.  For
 # machine independent notes, look in /sys/conf/NOTES.
 #
-# $FreeBSD: head/sys/i386/conf/NOTES 228940 2011-12-28 23:26:58Z delphij $
+# $FreeBSD: head/sys/i386/conf/NOTES 230843 2012-01-31 19:38:18Z jimharris $
 #
 
 #
@@ -727,6 +727,11 @@
 device		ips
 
 #
+# Intel C600 (Patsburg) integrated SAS controller
+device		isci
+options		ISCI_LOGGING	# enable debugging in isci HAL
+
+#
 # SafeNet crypto driver: can be moved to the MI NOTES as soon as
 # it's tested on a big-endian machine
 #
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/i386/initcpu.c
--- a/head/sys/i386/i386/initcpu.c	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/i386/initcpu.c	Wed Feb 01 11:33:42 2012 +0200
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/sys/i386/i386/initcpu.c 230767 2012-01-30 07:56:00Z kib $");
 
 #include "opt_cpu.h"
 
@@ -650,6 +650,8 @@
 #endif
 }
 
+extern int elf32_nxstack;
+
 void
 initializecpu(void)
 {
@@ -739,6 +741,7 @@
 			msr = rdmsr(MSR_EFER) | EFER_NXE;
 			wrmsr(MSR_EFER, msr);
 			pg_nx = PG_NX;
+			elf32_nxstack = 1;
 		}
 #endif
 		break;
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/i386/machdep.c
--- a/head/sys/i386/i386/machdep.c	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/i386/machdep.c	Wed Feb 01 11:33:42 2012 +0200
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/i386/i386/machdep.c 229085 2011-12-31 13:24:53Z gavin $");
+__FBSDID("$FreeBSD: head/sys/i386/i386/machdep.c 230426 2012-01-21 17:45:27Z kib $");
 
 #include "opt_atalk.h"
 #include "opt_compat.h"
@@ -653,8 +653,7 @@
 	sdp = &td->td_pcb->pcb_gsd;
 	sf.sf_uc.uc_mcontext.mc_gsbase = sdp->sd_hibase << 24 |
 	    sdp->sd_lobase;
-	bzero(sf.sf_uc.uc_mcontext.mc_spare1,
-	    sizeof(sf.sf_uc.uc_mcontext.mc_spare1));
+	sf.sf_uc.uc_mcontext.mc_flags = 0;
 	bzero(sf.sf_uc.uc_mcontext.mc_spare2,
 	    sizeof(sf.sf_uc.uc_mcontext.mc_spare2));
 	bzero(sf.sf_uc.__spare__, sizeof(sf.sf_uc.__spare__));
@@ -3382,7 +3381,7 @@
 	mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
 	sdp = &td->td_pcb->pcb_gsd;
 	mcp->mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
-	bzero(mcp->mc_spare1, sizeof(mcp->mc_spare1));
+	mcp->mc_flags = 0;
 	bzero(mcp->mc_spare2, sizeof(mcp->mc_spare2));
 	return (0);
 }
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/include/float.h
--- a/head/sys/i386/include/float.h	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/include/float.h	Wed Feb 01 11:33:42 2012 +0200
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)float.h	7.1 (Berkeley) 5/8/90
- * $FreeBSD$
+ * $FreeBSD: head/sys/i386/include/float.h 230475 2012-01-23 06:36:41Z das $
  */
 
 #ifndef _MACHINE_FLOAT_H_
@@ -55,6 +55,11 @@
 #define FLT_MAX_EXP	128		/* emax */
 #define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */
 #define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */
+#if __ISO_C_VISIBLE >= 2011
+#define	FLT_TRUE_MIN	1.40129846E-45F	/* b**(emin-p) */
+#define	FLT_DECIMAL_DIG	9		/* ceil(1+p*log10(b)) */
+#define	FLT_HAS_SUBNORM	1
+#endif /* __ISO_C_VISIBLE >= 2011 */
 
 #define DBL_MANT_DIG	53
 #define DBL_EPSILON	2.2204460492503131E-16
@@ -65,6 +70,11 @@
 #define DBL_MAX_EXP	1024
 #define DBL_MAX		1.7976931348623157E+308
 #define DBL_MAX_10_EXP	308
+#if __ISO_C_VISIBLE >= 2011
+#define	DBL_TRUE_MIN	4.9406564584124654E-324
+#define	DBL_DECIMAL_DIG	17
+#define	DBL_HAS_SUBNORM	1
+#endif /* __ISO_C_VISIBLE >= 2011 */
 
 #define LDBL_MANT_DIG	64
 #define LDBL_EPSILON	1.0842021724855044340E-19L
@@ -75,4 +85,10 @@
 #define LDBL_MAX_EXP	16384
 #define LDBL_MAX	1.1897314953572317650E+4932L
 #define LDBL_MAX_10_EXP	4932
+#if __ISO_C_VISIBLE >= 2011
+#define	LDBL_TRUE_MIN	3.6451995318824746025E-4951L
+#define	LDBL_DECIMAL_DIG 21
+#define	LDBL_HAS_SUBNORM 1
+#endif /* __ISO_C_VISIBLE >= 2011 */
+
 #endif /* _MACHINE_FLOAT_H_ */
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/include/npx.h
--- a/head/sys/i386/include/npx.h	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/include/npx.h	Wed Feb 01 11:33:42 2012 +0200
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)npx.h	5.3 (Berkeley) 1/18/91
- * $FreeBSD$
+ * $FreeBSD: head/sys/i386/include/npx.h 230426 2012-01-21 17:45:27Z kib $
  */
 
 /*
@@ -101,6 +101,11 @@
 	u_char	xmm_bytes[16];
 };
 
+/* Contents of the upper 16 bytes of each AVX extended accumulator */
+struct  ymmacc {
+	uint8_t  ymm_bytes[16];
+};
+
 struct  savexmm {
 	struct	envxmm	sv_env;
 	struct {
@@ -116,6 +121,28 @@
 	struct	savexmm	sv_xmm;
 };
 
+struct xstate_hdr {
+	uint64_t xstate_bv;
+	uint8_t xstate_rsrv0[16];
+	uint8_t	xstate_rsrv[40];
+};
+
+struct savexmm_xstate {
+	struct xstate_hdr sx_hd;
+	struct ymmacc	sx_ymm[16];
+};
+
+struct savexmm_ymm {
+	struct	envxmm	sv_env;
+	struct {
+		struct fpacc87	fp_acc;
+		int8_t		fp_pad[6];      /* padding */
+	} sv_fp[8];
+	struct xmmacc	sv_xmm[16];
+	uint8_t sv_pad[96];
+	struct savexmm_xstate sv_xstate;
+} __aligned(64);
+
 /*
  * The hardware default control word for i387's and later coprocessors is
  * 0x37F, giving:
@@ -138,13 +165,6 @@
 
 #ifdef _KERNEL
 
-struct fpu_kern_ctx {
-	union savefpu hwstate;
-	union savefpu *prev;
-	uint32_t flags;
-};
-#define	FPU_KERN_CTX_NPXINITDONE 0x01
-
 #define	PCB_USER_FPU(pcb) (((pcb)->pcb_flags & PCB_KERNNPX) == 0)
 
 int	npxdna(void);
@@ -157,6 +177,8 @@
 void	npxsetregs(struct thread *td, union savefpu *addr);
 int	npxtrap(void);
 void	npxuserinited(struct thread *);
+struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags);
+void	fpu_kern_free_ctx(struct fpu_kern_ctx *ctx);
 int	fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx,
 	    u_int flags);
 int	fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx);
@@ -167,6 +189,7 @@
  * Flags for fpu_kern_enter() and fpu_kern_thread().
  */
 #define	FPU_KERN_NORMAL	0x0000
+#define	FPU_KERN_NOWAIT	0x0001
 
 #endif
 
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/include/ptrace.h
--- a/head/sys/i386/include/ptrace.h	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/include/ptrace.h	Wed Feb 01 11:33:42 2012 +0200
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ptrace.h	8.1 (Berkeley) 6/11/93
- * $FreeBSD$
+ * $FreeBSD: head/sys/i386/include/ptrace.h 230426 2012-01-21 17:45:27Z kib $
  */
 
 #ifndef _MACHINE_PTRACE_H_
@@ -37,5 +37,7 @@
 
 #define PT_GETXMMREGS	(PT_FIRSTMACH + 0)
 #define PT_SETXMMREGS	(PT_FIRSTMACH + 1)
+#define PT_GETXSTATE	(PT_FIRSTMACH + 2)
+#define PT_SETXSTATE	(PT_FIRSTMACH + 3)
 
 #endif
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/include/signal.h
--- a/head/sys/i386/include/signal.h	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/include/signal.h	Wed Feb 01 11:33:42 2012 +0200
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)signal.h	8.1 (Berkeley) 6/11/93
- * $FreeBSD: head/sys/i386/include/signal.h 227399 2011-11-09 18:25:50Z kib $
+ * $FreeBSD: head/sys/i386/include/signal.h 230765 2012-01-30 07:51:52Z kib $
  */
 
 #ifndef _MACHINE_SIGNAL_H_
@@ -115,13 +115,16 @@
 	 */
 	int	sc_fpformat;
 	int	sc_ownedfp;
-	int	sc_spare1[1];
+	int	sc_flags;
 	int	sc_fpstate[128] __aligned(16);
 
 	int	sc_fsbase;
 	int	sc_gsbase;
 
-	int	sc_spare2[6];
+	int	sc_xfpustate;
+	int	sc_xfpustate_len;
+
+	int	sc_spare2[4];
 };
 
 #define	sc_sp		sc_esp
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/include/specialreg.h
--- a/head/sys/i386/include/specialreg.h	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/include/specialreg.h	Wed Feb 01 11:33:42 2012 +0200
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)specialreg.h	7.1 (Berkeley) 5/9/91
- * $FreeBSD: head/sys/i386/include/specialreg.h 222043 2011-05-17 22:36:16Z jkim $
+ * $FreeBSD: head/sys/i386/include/specialreg.h 230261 2012-01-17 07:23:43Z kib $
  */
 
 #ifndef _MACHINE_SPECIALREG_H_
@@ -66,6 +66,7 @@
 #define	CR4_PCE	0x00000100	/* Performance monitoring counter enable */
 #define	CR4_FXSR 0x00000200	/* Fast FPU save/restore used by OS */
 #define	CR4_XMM	0x00000400	/* enable SIMD/MMX2 to use except 16 */
+#define	CR4_XSAVE 0x00040000	/* XSETBV/XGETBV */
 
 /*
  * Bits in AMD64 special registers.  EFER is 64 bits wide.
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/include/sysarch.h
--- a/head/sys/i386/include/sysarch.h	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/include/sysarch.h	Wed Feb 01 11:33:42 2012 +0200
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: head/sys/i386/include/sysarch.h 230426 2012-01-21 17:45:27Z kib $
  */
 
 /*
@@ -47,6 +47,7 @@
 #define I386_SET_FSBASE	8
 #define I386_GET_GSBASE	9
 #define I386_SET_GSBASE	10
+#define	I386_GET_XFPUSTATE 11
 
 /* These four only exist when running an i386 binary on amd64 */
 #define	_AMD64_GET_FSBASE	128
@@ -71,6 +72,11 @@
 	char	*sub_args;		/* args */
 };
 
+struct i386_get_xfpustate {
+	void *addr;
+	int len;
+};
+
 #ifndef _KERNEL
 #include <sys/cdefs.h>
 
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/include/ucontext.h
--- a/head/sys/i386/include/ucontext.h	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/include/ucontext.h	Wed Feb 01 11:33:42 2012 +0200
@@ -25,12 +25,18 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/i386/include/ucontext.h 229104 2011-12-31 14:44:42Z kib $
+ * $FreeBSD: head/sys/i386/include/ucontext.h 230426 2012-01-21 17:45:27Z kib $
  */
 
 #ifndef _MACHINE_UCONTEXT_H_
 #define	_MACHINE_UCONTEXT_H_
 
+/* Keep _MC_* values similar to amd64 */
+#define	_MC_HASSEGS	0x1
+#define	_MC_HASBASES	0x2
+#define	_MC_HASFPXSTATE	0x4
+#define	_MC_FLAG_MASK	(_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE)
+
 typedef struct __mcontext {
 	/*
 	 * The definition of mcontext_t must match the layout of
@@ -68,7 +74,7 @@
 #define	_MC_FPOWNED_FPU		0x20001	/* FP state came from FPU */
 #define	_MC_FPOWNED_PCB		0x20002	/* FP state came from PCB */
 	int	mc_ownedfp;
-	int	mc_spare1[1];		/* align next field to 16 bytes */
+	__register_t mc_flags;
 	/*
 	 * See <machine/npx.h> for the internals of mc_fpstate[].
 	 */
@@ -77,11 +83,13 @@
 	__register_t mc_fsbase;
 	__register_t mc_gsbase;
 
-	int	mc_spare2[6];
+	__register_t mc_xfpustate;
+	__register_t mc_xfpustate_len;
+
+	int	mc_spare2[4];
 } mcontext_t;
 
 #if defined(_KERNEL) && defined(COMPAT_FREEBSD4)
-
 struct mcontext4 {
 	__register_t	mc_onstack;	/* XXX - sigcontext compat. */
 	__register_t	mc_gs;		/* machine state (struct trapframe) */
diff -r b35ed53dbff9 -r 319d2099782e head/sys/i386/isa/npx.c
--- a/head/sys/i386/isa/npx.c	Wed Feb 01 11:33:29 2012 +0200
+++ b/head/sys/i386/isa/npx.c	Wed Feb 01 11:33:42 2012 +0200
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/sys/i386/isa/npx.c 230426 2012-01-21 17:45:27Z kib $");
 
 #include "opt_cpu.h"
 #include "opt_isa.h"
@@ -985,6 +985,50 @@
 #endif
 #endif /* DEV_ISA */
 
+static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx",
+    "Kernel contexts for FPU state");
+
+#define	XSAVE_AREA_ALIGN	64
+
+#define	FPU_KERN_CTX_NPXINITDONE 0x01
+
+struct fpu_kern_ctx {
+	union savefpu *prev;
+	uint32_t flags;
+	char hwstate1[];
+};
+
+struct fpu_kern_ctx *
+fpu_kern_alloc_ctx(u_int flags)
+{
+	struct fpu_kern_ctx *res;
+	size_t sz;
+
+	sz = sizeof(struct fpu_kern_ctx) + XSAVE_AREA_ALIGN +
+	    sizeof(union savefpu);
+	res = malloc(sz, M_FPUKERN_CTX, ((flags & FPU_KERN_NOWAIT) ?
+	    M_NOWAIT : M_WAITOK) | M_ZERO);
+	return (res);
+}
+
+void
+fpu_kern_free_ctx(struct fpu_kern_ctx *ctx)
+{
+
+	/* XXXKIB clear the memory ? */
+	free(ctx, M_FPUKERN_CTX);
+}
+
+static union savefpu *
+fpu_kern_ctx_savefpu(struct fpu_kern_ctx *ctx)
+{
+	vm_offset_t p;
+
+	p = (vm_offset_t)&ctx->hwstate1;
+	p = roundup2(p, XSAVE_AREA_ALIGN);
+	return ((union savefpu *)p);
+}
+
 int
 fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags)
 {
@@ -998,7 +1042,7 @@
 		ctx->flags |= FPU_KERN_CTX_NPXINITDONE;
 	npxexit(td);
 	ctx->prev = pcb->pcb_save;
-	pcb->pcb_save = &ctx->hwstate;
+	pcb->pcb_save = fpu_kern_ctx_savefpu(ctx);
 	pcb->pcb_flags |= PCB_KERNNPX;
 	pcb->pcb_flags &= ~PCB_NPXINITDONE;
 	return (0);


More information about the Zrouter-src-freebsd mailing list