Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Fix ucontext32_t on AMD64. Add optional compile time ass...
details: https://anonhg.NetBSD.org/src/rev/d36e1cd4065d
branches: trunk
changeset: 762558:d36e1cd4065d
user: joerg <joerg%NetBSD.org@localhost>
date: Wed Feb 23 02:58:38 2011 +0000
description:
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.
diffstat:
sys/arch/amd64/amd64/netbsd32_machdep.c | 6 +++---
sys/arch/amd64/include/mcontext.h | 24 +++++++++++++++++++++---
sys/arch/arm/include/mcontext.h | 4 +++-
sys/arch/i386/include/mcontext.h | 4 +++-
sys/arch/m68k/include/mcontext.h | 4 +++-
sys/compat/sys/ucontext.h | 6 +++++-
sys/sys/ucontext.h | 6 +++++-
7 files changed, 43 insertions(+), 11 deletions(-)
diffs (166 lines):
diff -r a6f8482c9453 -r d36e1cd4065d sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c Wed Feb 23 02:49:54 2011 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c Wed Feb 23 02:58:38 2011 +0000
@@ -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;
}
diff -r a6f8482c9453 -r d36e1cd4065d sys/arch/amd64/include/mcontext.h
--- a/sys/arch/amd64/include/mcontext.h Wed Feb 23 02:49:54 2011 +0000
+++ b/sys/arch/amd64/include/mcontext.h Wed Feb 23 02:58:38 2011 +0000
@@ -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;
diff -r a6f8482c9453 -r d36e1cd4065d sys/arch/arm/include/mcontext.h
--- a/sys/arch/arm/include/mcontext.h Wed Feb 23 02:49:54 2011 +0000
+++ b/sys/arch/arm/include/mcontext.h Wed Feb 23 02:58:38 2011 +0000
@@ -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_ */
diff -r a6f8482c9453 -r d36e1cd4065d sys/arch/i386/include/mcontext.h
--- a/sys/arch/i386/include/mcontext.h Wed Feb 23 02:49:54 2011 +0000
+++ b/sys/arch/i386/include/mcontext.h Wed Feb 23 02:58:38 2011 +0000
@@ -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_ */
diff -r a6f8482c9453 -r d36e1cd4065d sys/arch/m68k/include/mcontext.h
--- a/sys/arch/m68k/include/mcontext.h Wed Feb 23 02:49:54 2011 +0000
+++ b/sys/arch/m68k/include/mcontext.h Wed Feb 23 02:58:38 2011 +0000
@@ -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_ */
diff -r a6f8482c9453 -r d36e1cd4065d sys/compat/sys/ucontext.h
--- a/sys/compat/sys/ucontext.h Wed Feb 23 02:49:54 2011 +0000
+++ b/sys/compat/sys/ucontext.h Wed Feb 23 02:58:38 2011 +0000
@@ -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
diff -r a6f8482c9453 -r d36e1cd4065d sys/sys/ucontext.h
--- a/sys/sys/ucontext.h Wed Feb 23 02:49:54 2011 +0000
+++ b/sys/sys/ucontext.h Wed Feb 23 02:58:38 2011 +0000
@@ -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 *);
Home |
Main Index |
Thread Index |
Old Index