Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch fix _UC_MACHINE32_FP() -- use 32 bit pointer value ...



details:   https://anonhg.NetBSD.org/src/rev/3c04aa8415e0
branches:  trunk
changeset: 359646:3c04aa8415e0
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Feb 19 08:31:13 2018 +0000

description:
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.

diffstat:

 sys/arch/sparc/include/mcontext.h   |  17 +++++++----------
 sys/arch/sparc64/include/mcontext.h |  10 +++++++---
 2 files changed, 14 insertions(+), 13 deletions(-)

diffs (69 lines):

diff -r cf0b6c7649af -r 3c04aa8415e0 sys/arch/sparc/include/mcontext.h
--- a/sys/arch/sparc/include/mcontext.h Sun Feb 18 23:51:20 2018 +0000
+++ b/sys/arch/sparc/include/mcontext.h Mon Feb 19 08:31:13 2018 +0000
@@ -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 @@
 } 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
diff -r cf0b6c7649af -r 3c04aa8415e0 sys/arch/sparc64/include/mcontext.h
--- a/sys/arch/sparc64/include/mcontext.h       Sun Feb 18 23:51:20 2018 +0000
+++ b/sys/arch/sparc64/include/mcontext.h       Mon Feb 19 08:31:13 2018 +0000
@@ -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 @@
 #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_ */



Home | Main Index | Thread Index | Old Index