Module Name:    src
Committed By:   joerg
Date:           Wed Feb 23 02:58:40 UTC 2011

Modified Files:
        src/sys/arch/amd64/amd64: netbsd32_machdep.c
        src/sys/arch/amd64/include: mcontext.h
        src/sys/arch/arm/include: mcontext.h
        src/sys/arch/i386/include: mcontext.h
        src/sys/arch/m68k/include: mcontext.h
        src/sys/compat/sys: ucontext.h
        src/sys/sys: ucontext.h

Log Message:
Fix ucontext32_t on AMD64. Add optional compile time assertions for
ucontext_t and ucontext32_t to ensure that they don't change.
Provide the constants for AMD64, ARM, i386, and M68K.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/amd64/include/mcontext.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/include/mcontext.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/include/mcontext.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/m68k/include/mcontext.h
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/sys/ucontext.h
cvs rdiff -u -r1.12 -r1.13 src/sys/sys/ucontext.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.70 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.71
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.70	Mon Feb  7 03:54:45 2011
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Wed Feb 23 02:58:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.70 2011/02/07 03:54:45 chs Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.71 2011/02/23 02:58:38 joerg Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.70 2011/02/07 03:54:45 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.71 2011/02/23 02:58:38 joerg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -870,7 +870,7 @@
 			fpusave_lwp(l, false);
 		}
 		memcpy(&pcb->pcb_savefpu.fp_fxsave, &mcp->__fpregs,
-		    sizeof (mcp->__fpregs));
++		    sizeof (pcb->pcb_savefpu.fp_fxsave));
 		/* If not set already. */
 		l->l_md.md_flags |= MDP_USEDFPU;
 	}

Index: src/sys/arch/amd64/include/mcontext.h
diff -u src/sys/arch/amd64/include/mcontext.h:1.11 src/sys/arch/amd64/include/mcontext.h:1.12
--- src/sys/arch/amd64/include/mcontext.h:1.11	Sun Oct 26 00:08:15 2008
+++ src/sys/arch/amd64/include/mcontext.h	Wed Feb 23 02:58:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.11 2008/10/26 00:08:15 mrg Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.12 2011/02/23 02:58:39 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -80,6 +80,7 @@
 #define _UC_SETSTACK	0x00010000
 #define _UC_CLRSTACK	0x00020000
 
+#define	__UCONTEXT_SIZE	784
 
 #ifdef _KERNEL
 
@@ -116,14 +117,31 @@
 /*
  * Floating point register state
  */
-typedef struct fxsave64 __fpregset32_t;
+typedef struct {
+	union {
+		struct {
+			int	__fp_state[27];	/* Environment and registers */
+			int	__fp_status;	/* Software status word */
+		} __fpchip_state;
+		struct {
+			char	__fp_emul[246];
+			char	__fp_epad[2];
+		} __fp_emul_space;
+		struct {
+			char	__fp_xmm[512];
+		} __fp_xmm_state;
+		int	__fp_fpregs[128];
+	} __fp_reg_set;
+	int	__fp_wregs[33];			/* Weitek? */
+} __fpregset32_t;
 
 typedef struct {
 	__gregset32_t	__gregs;
 	__fpregset32_t	__fpregs;
 } mcontext32_t;
 
-#define _UC_MACHINE_PAD32	5
+#define _UC_MACHINE32_PAD	5
+#define	__UCONTEXT32_SIZE	776
 
 struct trapframe;
 struct lwp;

Index: src/sys/arch/arm/include/mcontext.h
diff -u src/sys/arch/arm/include/mcontext.h:1.6 src/sys/arch/arm/include/mcontext.h:1.7
--- src/sys/arch/arm/include/mcontext.h:1.6	Mon Apr 28 20:23:14 2008
+++ src/sys/arch/arm/include/mcontext.h	Wed Feb 23 02:58:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.6 2008/04/28 20:23:14 martin Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.7 2011/02/23 02:58:39 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -104,4 +104,6 @@
 
 #define	_UC_MACHINE_SET_PC(uc, pc)	_UC_MACHINE_PC(uc) = (pc)
 
+#define	__UCONTEXT_SIZE	256
+
 #endif	/* !_ARM_MCONTEXT_H_ */

Index: src/sys/arch/i386/include/mcontext.h
diff -u src/sys/arch/i386/include/mcontext.h:1.7 src/sys/arch/i386/include/mcontext.h:1.8
--- src/sys/arch/i386/include/mcontext.h:1.7	Mon Apr 28 20:23:24 2008
+++ src/sys/arch/i386/include/mcontext.h	Wed Feb 23 02:58:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.7 2008/04/28 20:23:24 martin Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.8 2011/02/23 02:58:39 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -123,4 +123,6 @@
 
 #define	_UC_MACHINE_SET_PC(uc, pc)	_UC_MACHINE_PC(uc) = (pc)
 
+#define	__UCONTEXT_SIZE	776
+
 #endif	/* !_I386_MCONTEXT_H_ */

Index: src/sys/arch/m68k/include/mcontext.h
diff -u src/sys/arch/m68k/include/mcontext.h:1.6 src/sys/arch/m68k/include/mcontext.h:1.7
--- src/sys/arch/m68k/include/mcontext.h:1.6	Mon Apr 28 20:23:26 2008
+++ src/sys/arch/m68k/include/mcontext.h	Wed Feb 23 02:58:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.6 2008/04/28 20:23:26 martin Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.7 2011/02/23 02:58:39 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -105,4 +105,6 @@
 
 #define	_UC_MACHINE_SET_PC(uc, pc)	_UC_MACHINE_PC(uc) = (pc)
 
+#define	__UCONTEXT_SIZE	1024
+
 #endif	/* !_M68K_MCONTEXT_H_ */

Index: src/sys/compat/sys/ucontext.h
diff -u src/sys/compat/sys/ucontext.h:1.3 src/sys/compat/sys/ucontext.h:1.4
--- src/sys/compat/sys/ucontext.h:1.3	Mon Apr 28 20:23:46 2008
+++ src/sys/compat/sys/ucontext.h	Wed Feb 23 02:58:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.3 2008/04/28 20:23:46 martin Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.4 2011/02/23 02:58:39 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2003 The NetBSD Foundation, Inc.
@@ -53,6 +53,10 @@
 #endif
 };
 
+#ifdef __UCONTEXT32_SIZE
+__CTASSERT(sizeof(ucontext32_t) == __UCONTEXT32_SIZE)
+#endif
+
 #endif /* COMPAT_NETBSD32 && _KERNEL */
 
 #ifdef _KERNEL

Index: src/sys/sys/ucontext.h
diff -u src/sys/sys/ucontext.h:1.12 src/sys/sys/ucontext.h:1.13
--- src/sys/sys/ucontext.h:1.12	Wed Nov 18 12:29:22 2009
+++ src/sys/sys/ucontext.h	Wed Feb 23 02:58:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.12 2009/11/18 12:29:22 yamt Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.13 2011/02/23 02:58:40 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2003 The NetBSD Foundation, Inc.
@@ -77,6 +77,10 @@
 #ifdef _KERNEL
 struct lwp;
 
+#ifdef __UCONTEXT_SIZE
+__CTASSERT(sizeof(ucontext_t) == __UCONTEXT_SIZE)
+#endif
+
 void	getucontext(struct lwp *, ucontext_t *);
 void	getucontext_sa(struct lwp *, ucontext_t *);
 int	setucontext(struct lwp *, const ucontext_t *);

Reply via email to