Module Name:    src
Committed By:   mrg
Date:           Mon Feb 19 08:31:13 UTC 2018

Modified Files:
        src/sys/arch/sparc/include: mcontext.h
        src/sys/arch/sparc64/include: mcontext.h

Log Message:
fix _UC_MACHINE32_FP() -- use 32 bit pointer value so that [15] is
the right offset.  do this by using __greg32_t, which is only in
the sparc64 version, and these are only useful there, so move them.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc/include/mcontext.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/include/mcontext.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/sparc/include/mcontext.h
diff -u src/sys/arch/sparc/include/mcontext.h:1.16 src/sys/arch/sparc/include/mcontext.h:1.17
--- src/sys/arch/sparc/include/mcontext.h:1.16	Sun Feb 18 15:29:29 2018
+++ src/sys/arch/sparc/include/mcontext.h	Mon Feb 19 08:31:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.16 2018/02/18 15:29:29 christos Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.17 2018/02/19 08:31:13 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,11 +30,11 @@
  */
 
 #ifndef _SPARC_MCONTEXT_H_
-#define _SPARC_MCONTEXT_H_
+#define	_SPARC_MCONTEXT_H_
 
-#define _UC_SETSTACK	0x00010000
-#define _UC_CLRSTACK	0x00020000
-#define _UC_TLSBASE	0x00080000
+#define	_UC_SETSTACK	0x00010000
+#define	_UC_CLRSTACK	0x00020000
+#define	_UC_TLSBASE	0x00080000
 
 /*
  * Layout of mcontext_t according the System V Application Binary Interface,
@@ -144,14 +144,11 @@ typedef struct {
 } mcontext_t;
 
 #ifdef __arch64__
-#define _UC_MACHINE_PAD	8		/* Padding appended to ucontext_t */
+#define	_UC_MACHINE_PAD	8		/* Padding appended to ucontext_t */
 #define	_UC_MACHINE_SP(uc)	(((uc)->uc_mcontext.__gregs[_REG_O6]) + 0x7ff)
 #define	_UC_MACHINE_FP(uc)	(((__greg_t *)_UC_MACHINE_SP(uc))[15])
-#define _UC_MACHINE32_PAD	43	/* compat_netbsd32 variant */
-#define	_UC_MACHINE32_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_O6])
-#define	_UC_MACHINE32_FP(uc)	(((__greg_t *)_UC_MACHINE32_SP(uc))[15])
 #else
-#define _UC_MACHINE_PAD	43		/* Padding appended to ucontext_t */
+#define	_UC_MACHINE_PAD	43		/* Padding appended to ucontext_t */
 #define	_UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_O6])
 #define	_UC_MACHINE_FP(uc)	(((__greg_t *)_UC_MACHINE_SP(uc))[15])
 #endif

Index: src/sys/arch/sparc64/include/mcontext.h
diff -u src/sys/arch/sparc64/include/mcontext.h:1.9 src/sys/arch/sparc64/include/mcontext.h:1.10
--- src/sys/arch/sparc64/include/mcontext.h:1.9	Wed Sep 12 02:00:54 2012
+++ src/sys/arch/sparc64/include/mcontext.h	Mon Feb 19 08:31:13 2018
@@ -1,11 +1,11 @@
-/*	$NetBSD: mcontext.h,v 1.9 2012/09/12 02:00:54 manu Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.10 2018/02/19 08:31:13 mrg Exp $	*/
 
 #ifndef _SPARC64_MCONTEXT_H_
-#define _SPARC64_MCONTEXT_H_
+#define	_SPARC64_MCONTEXT_H_
 
 #include <sparc/mcontext.h>
 
-#define _NGREG32	19	/* %psr, pc, npc, %g1-7, %o0-7 */
+#define	_NGREG32	19	/* %psr, pc, npc, %g1-7, %o0-7 */
 typedef	int	__greg32_t;
 typedef	__greg32_t	__gregset32_t[_NGREG32];
 
@@ -76,4 +76,8 @@ typedef struct {
 #define	_UC_CLRSTACK	0x00020000
 #define	_UC_TLSBASE	0x00080000
 
+#define	_UC_MACHINE32_PAD	43	/* compat_netbsd32 variant */
+#define	_UC_MACHINE32_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_O6])
+#define	_UC_MACHINE32_FP(uc)	(((__greg32_t *)_UC_MACHINE32_SP(uc))[15])
+
 #endif /* _SPARC64_MCONTEXT_H_ */

Reply via email to