]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix mcontext_t sigcontext namespace (bug 21457).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 30 Aug 2017 22:02:04 +0000 (22:02 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 30 Aug 2017 22:02:04 +0000 (22:02 +0000)
This patch completes the ucontext.h namespace fixes by fixing issues
related to the use of struct sigcontext as mcontext_t, and inclusion
of <bits/sigcontext.h> even when struct sigcontext is not so used.

Inclusion of <bits/sigcontext.h> by <sys/ucontext.h> is removed; the
way to get the sigcontext structure is by including <signal.h> (in a
context where __USE_MISC is defined); the sysdeps/generic version of
sys/ucontext.h keeps the inclusion by necessity, with a comment about
how this is not namespace-clean, but the only configuration that used
it, MicroBlaze, gets its own version of the header in this patch.
Where mcontext_t was typedefed to struct sigcontext, the contents of
struct sigcontext are inserted (with appropriate namespace handling to
prefix fields with __ when __USE_MISC is not defined); review should
check that this has been done correctly in each case, whether the
definition of struct sigcontext comes from glibc headers or from the
Linux kernel.  This changes C++ name mangling on affected
architectures (which do not include x86_64/x86).

Tested for x86_64, and with build-many-glibcs.py.

2017-08-14  Joseph Myers  <joseph@codesourcery.com>

[BZ #21457]
* sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>.
* sysdeps/generic/sys/ucontext.h: Add comment about use of struct
sigcontext and namespace requirements.
* sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>.
* sysdeps/m68k/sys/ucontext.h: Likewise.
* sysdeps/mips/sys/ucontext.h: Likewise.  Include <bits/types.h>.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use
__glibc_reserved1 instead of __reserved.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use
mcontext_t instead of struct sigcontext.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): New macro.
(struct __ia64_fpreg_mcontext): New type.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
(_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext.
(uc_sigmask): Define using __ctx.
(uc_stack): Likewise.
* sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
<bits/sigcontext.h>.
(__ctx): Define earlier.
(mcontext_t): Define structure contents rather than using struct
sigcontext.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
<bits/sigcontext.h>.  Include <bits/types.h>.
* conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove.
(test-xfail-XPG42/sys/wait.h/conform): Likewise.
(test-xfail-XPG42/ucontext.h/conform): Likewise.
(test-xfail-UNIX98/signal.h/conform): Likewise.
(test-xfail-UNIX98/sys/wait.h/conform): Likewise.
(test-xfail-UNIX98/ucontext.h/conform): Likewise.
(test-xfail-XOPEN2K/signal.h/conform): Likewise.
(test-xfail-XOPEN2K/sys/wait.h/conform): Likewise.
(test-xfail-XOPEN2K/ucontext.h/conform): Likewise.
(test-xfail-POSIX2008/signal.h/conform): Likewise.
(test-xfail-POSIX2008/sys/wait.h/conform): Likewise.
(test-xfail-XOPEN2K8/signal.h/conform): Likewise.
(test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.

29 files changed:
ChangeLog
NEWS
conform/Makefile
sysdeps/arm/sys/ucontext.h
sysdeps/generic/sys/ucontext.h
sysdeps/i386/sys/ucontext.h
sysdeps/m68k/sys/ucontext.h
sysdeps/mips/sys/ucontext.h
sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym
sysdeps/unix/sysv/linux/alpha/sys/ucontext.h
sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym
sysdeps/unix/sysv/linux/arm/sys/ucontext.h
sysdeps/unix/sysv/linux/hppa/sys/ucontext.h
sysdeps/unix/sysv/linux/ia64/makecontext.c
sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym
sysdeps/unix/sysv/linux/ia64/sys/procfs.h
sysdeps/unix/sysv/linux/ia64/sys/ptrace.h
sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
sysdeps/unix/sysv/linux/m68k/sys/ucontext.h
sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/mips/sys/ucontext.h
sysdeps/unix/sysv/linux/nios2/sys/ucontext.h
sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h
sysdeps/unix/sysv/linux/s390/sys/ucontext.h
sysdeps/unix/sysv/linux/sh/sys/ucontext.h
sysdeps/unix/sysv/linux/sparc/sys/ucontext.h
sysdeps/unix/sysv/linux/tile/sys/ucontext.h
sysdeps/unix/sysv/linux/x86/sys/ucontext.h

index 1d8bcde330a51e1b3697ead746bc91eb91cf16ff..988c4024d702920ab5c9d00c59b3b8aa2377964f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,88 @@
+2017-08-30  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #21457]
+       * sysdeps/arm/sys/ucontext.h: Do not include <bits/sigcontext.h>.
+       * sysdeps/generic/sys/ucontext.h: Add comment about use of struct
+       sigcontext and namespace requirements.
+       * sysdeps/i386/sys/ucontext.h: Do not include <bits/sigcontext.h>.
+       * sysdeps/m68k/sys/ucontext.h: Likewise.
+       * sysdeps/mips/sys/ucontext.h: Likewise.  Include <bits/types.h>.
+       * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       (__ctx): Define earlier.
+       (mcontext_t): Define structure contents rather than using struct
+       sigcontext.
+       * sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym (oEXTENSION): Use
+       __glibc_reserved1 instead of __reserved.
+       * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       (__ctx): Define earlier.
+       (mcontext_t): Define structure contents rather than using struct
+       sigcontext.
+       * sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym: Use
+       mcontext_t instead of struct sigcontext.
+       * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       (__ctx): Define earlier.
+       (mcontext_t): Define structure contents rather than using struct
+       sigcontext.
+       * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       (__ctx): Define earlier.
+       (mcontext_t): Define structure contents rather than using struct
+       sigcontext.
+       * sysdeps/unix/sysv/linux/ia64/makecontext.c (__makecontext): Use
+       mcontext_t instead of struct sigcontext.
+       * sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym: Use
+       mcontext_t instead of struct sigcontext.
+       * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       (__ctx): New macro.
+       (struct __ia64_fpreg_mcontext): New type.
+       (mcontext_t): Define structure contents rather than using struct
+       sigcontext.
+       (_SC_GR0_OFFSET): Use mcontext_t instead of struct sigcontext.
+       (uc_sigmask): Define using __ctx.
+       (uc_stack): Likewise.
+       * sysdeps/unix/sysv/linux/ia64/sys/procfs.h: Include
+       <bits/sigcontext.h>.
+       * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise.
+       * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       * sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file.
+       * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.
+       (__ctx): Define earlier.
+       (mcontext_t): Define structure contents rather than using struct
+       sigcontext.
+       * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
+       <bits/sigcontext.h>.  Include <bits/types.h>.
+       * conform/Makefile (test-xfail-XPG42/signal.h/conform): Remove.
+       (test-xfail-XPG42/sys/wait.h/conform): Likewise.
+       (test-xfail-XPG42/ucontext.h/conform): Likewise.
+       (test-xfail-UNIX98/signal.h/conform): Likewise.
+       (test-xfail-UNIX98/sys/wait.h/conform): Likewise.
+       (test-xfail-UNIX98/ucontext.h/conform): Likewise.
+       (test-xfail-XOPEN2K/signal.h/conform): Likewise.
+       (test-xfail-XOPEN2K/sys/wait.h/conform): Likewise.
+       (test-xfail-XOPEN2K/ucontext.h/conform): Likewise.
+       (test-xfail-POSIX2008/signal.h/conform): Likewise.
+       (test-xfail-POSIX2008/sys/wait.h/conform): Likewise.
+       (test-xfail-XOPEN2K8/signal.h/conform): Likewise.
+       (test-xfail-XOPEN2K8/sys/wait.h/conform): Likewise.
+
 2017-08-30  Florian Weimer  <fweimer@redhat.com>
 
        * malloc/dynarray_emplace_enlarge.c
diff --git a/NEWS b/NEWS
index 625bcc60b64206c3b2e5d5f9ffb024ab5972d13d..dce514dac7cd7290b5abea02e234a34eeb3f5aa4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,10 @@ Deprecated and removed features, and other changes affecting compatibility:
   exception, or the macros X_TLOSS, DOMAIN, SING, OVERFLOW, UNDERFLOW,
   TLOSS, PLOSS and HUGE.
 
+* The mcontext_t type is no longer the same as struct sigcontext.  On
+  platforms where it was previously the same, this changes the C++ name
+  mangling for interfaces involving this type.
+
 Changes to build and runtime requirements:
 
   [Add changes to build and runtime requirements here]
index 9ec41c7244ad10f87f6073e6731c981efa2d4d45..3883a4bcf27934d58acc2057b45eedc10d0054a7 100644 (file)
@@ -160,21 +160,6 @@ test-xfail-UNIX98/ndbm.h/conform = yes
 test-xfail-XOPEN2K/ndbm.h/conform = yes
 test-xfail-XOPEN2K8/ndbm.h/conform = yes
 
-# Unsorted expected failures.
-test-xfail-XPG42/signal.h/conform = yes
-test-xfail-XPG42/sys/wait.h/conform = yes
-test-xfail-XPG42/ucontext.h/conform = yes
-test-xfail-UNIX98/signal.h/conform = yes
-test-xfail-UNIX98/sys/wait.h/conform = yes
-test-xfail-UNIX98/ucontext.h/conform = yes
-test-xfail-XOPEN2K/signal.h/conform = yes
-test-xfail-XOPEN2K/sys/wait.h/conform = yes
-test-xfail-XOPEN2K/ucontext.h/conform = yes
-test-xfail-POSIX2008/signal.h/conform = yes
-test-xfail-POSIX2008/sys/wait.h/conform = yes
-test-xfail-XOPEN2K8/signal.h/conform = yes
-test-xfail-XOPEN2K8/sys/wait.h/conform = yes
-
 conformtest-cc-flags = -I../include $(+sysdep-includes) $(sysincludes) -I..
 # conformtest-xfail-conds may be set by a sysdeps Makefile fragment to
 # a list of conditions that are considered to be true when encountered
index da749a96dab0667b82a580df3955b1a7bb076363..512d51fa7ac58783e9bba882301d5f015c51df04 100644 (file)
@@ -23,7 +23,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
index ec5ab943cc92b9ec59a2984f6925437e16b72790..d497297e2ea5eb3d5a9da6daeb33469d38c9d450 100644 (file)
@@ -17,7 +17,9 @@
    <http://www.gnu.org/licenses/>.  */
 
 /* This file's definitions suffice for any platform where all
-   the machine-specific state is described in `struct sigcontext'.  */
+   the machine-specific state is described in `struct sigcontext', but
+   use of struct sigcontext does not conform to POSIX namespace
+   requirements.  */
 
 #ifndef _SYS_UCONTEXT_H
 #define _SYS_UCONTEXT_H        1
index 27f5e48559846a3cf024a855b8c4acaa3fc750bc..440075cb99af235194a02260fe542384bcf7a919 100644 (file)
@@ -23,7 +23,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
index 9d2b2c6c2c60d57604d0f64ca1959975b3298f77..0dbdca6dcaaa45112e594b4d631ec8e9ac2e3790 100644 (file)
@@ -23,7 +23,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
index 8248f5935d92bc7035fece8ff4217902944d25a4..d2a7ae33542ff8c5e340b4ee05f08f2559063c56 100644 (file)
@@ -22,8 +22,8 @@
 
 #include <features.h>
 
+#include <bits/types.h>
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 #include <sgidefs.h>
index 62ba382f0deb6674492f6eed4cba35e253dfcc41..3de801133a40423d1e95c19836c1bea0a1d7077c 100644 (file)
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
 #ifdef __USE_MISC
 # include <sys/procfs.h>
 
@@ -44,13 +49,15 @@ typedef elf_fpregset_t      fpregset_t;
    the core registers; coprocessor registers get saved elsewhere
    (e.g. in uc_regspace, or somewhere unspecified on the stack
    during non-RT signal handlers).  */
-typedef struct sigcontext mcontext_t;
-
-#ifdef __USE_MISC
-# define __ctx(fld) fld
-#else
-# define __ctx(fld) __ ## fld
-#endif
+typedef struct
+  {
+    unsigned long long int __ctx(fault_address);
+    unsigned long long int __ctx(regs)[31];
+    unsigned long long int __ctx(sp);
+    unsigned long long int __ctx(pc);
+    unsigned long long int __ctx(pstate);
+    unsigned char __glibc_reserved1[4096] __attribute__ ((__aligned__ (16)));
+  } mcontext_t;
 
 /* Userlevel context.  */
 typedef struct ucontext_t
index ab3930c173c87c620447d1578f21322ea9fc11b8..479bdda5c674b9b5d8977a37ab02333efe4969cc 100644 (file)
@@ -38,7 +38,7 @@ oX0                           mcontext (regs)
 oSP                            mcontext (sp)
 oPC                            mcontext (pc)
 oPSTATE                                mcontext (pstate)
-oEXTENSION                      mcontext (__reserved)
+oEXTENSION                      mcontext (__glibc_reserved1)
 
 #define fpsimd_context(member)  offsetof (struct fpsimd_context, member)
 
index af201775566d2bf038fce6850b81c12b8a39c6fd..a51d9b2d5e50441c22c1077ff610d7d0ec6200b0 100644 (file)
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
 /* Type for general register.  */
 typedef long int greg_t;
 
@@ -51,13 +56,27 @@ typedef fpreg_t fpregset_t[__NFPREG];
 
 
 /* A machine context is exactly a sigcontext.  */
-typedef struct sigcontext mcontext_t;
-
-#ifdef __USE_MISC
-# define __ctx(fld) fld
-#else
-# define __ctx(fld) __ ## fld
-#endif
+typedef struct
+  {
+    long int __ctx(sc_onstack);
+    long int __ctx(sc_mask);
+    long int __ctx(sc_pc);
+    long int __ctx(sc_ps);
+    long int __ctx(sc_regs)[32];
+    long int __ctx(sc_ownedfp);
+    long int __ctx(sc_fpregs)[32];
+    unsigned long int __ctx(sc_fpcr);
+    unsigned long int __ctx(sc_fp_control);
+    unsigned long int __glibc_reserved1, __glibc_reserved2;
+    unsigned long int __ctx(sc_ssize);
+    char *__ctx(sc_sbase);
+    unsigned long int __ctx(sc_traparg_a0);
+    unsigned long int __ctx(sc_traparg_a1);
+    unsigned long int __ctx(sc_traparg_a2);
+    unsigned long int __ctx(sc_fp_trap_pc);
+    unsigned long int __ctx(sc_fp_trigger_sum);
+    unsigned long int __ctx(sc_fp_trigger_inst);
+  } mcontext_t;
 
 /* Userlevel context.  */
 typedef struct ucontext_t
index f95ff756363bdc7a22fd89db1b84e80cc9b9d19e..9e86f8a7ca66ba87d3098d48c52e8ae2f674e0db 100644 (file)
@@ -7,12 +7,12 @@ UC_OSF_SIGMASK        offsetof (ucontext_t, __uc_osf_sigmask)
 UC_STACK       offsetof (ucontext_t, uc_stack)
 UC_SIGCTX      offsetof (ucontext_t, uc_mcontext)
 UC_SIGMASK     offsetof (ucontext_t, uc_sigmask)
-SC_REGS                offsetof (struct sigcontext, sc_regs)
-SC_FPREGS      offsetof (struct sigcontext, sc_fpregs)
-SC_PC          offsetof (struct sigcontext, sc_pc)
-SC_PS          offsetof (struct sigcontext, sc_ps)
-SC_FPCRS       offsetof (struct sigcontext, sc_fpcr)
-SC_MASK                offsetof (struct sigcontext, sc_mask)
-SC_FPCR                offsetof (struct sigcontext, sc_fpcr)
+SC_REGS                offsetof (mcontext_t, sc_regs)
+SC_FPREGS      offsetof (mcontext_t, sc_fpregs)
+SC_PC          offsetof (mcontext_t, sc_pc)
+SC_PS          offsetof (mcontext_t, sc_ps)
+SC_FPCRS       offsetof (mcontext_t, sc_fpcr)
+SC_MASK                offsetof (mcontext_t, sc_mask)
+SC_FPCR                offsetof (mcontext_t, sc_fpcr)
 SS_SP          offsetof (stack_t, ss_sp)
 SS_SIZE                offsetof (stack_t, ss_size)
index 2abceef2a4ca9bbb6e42208eaee548228b041e5b..192d1bdeac3e62e13110f68614f7af624047c3a9 100644 (file)
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
 #ifdef __USE_MISC
 typedef int greg_t;
 
@@ -98,13 +103,30 @@ typedef struct _libc_fpstate fpregset_t;
    the core registers; coprocessor registers get saved elsewhere
    (e.g. in uc_regspace, or somewhere unspecified on the stack
    during non-RT signal handlers).  */
-typedef struct sigcontext mcontext_t;
-
-#ifdef __USE_MISC
-# define __ctx(fld) fld
-#else
-# define __ctx(fld) __ ## fld
-#endif
+typedef struct
+  {
+    unsigned long int __ctx(trap_no);
+    unsigned long int __ctx(error_code);
+    unsigned long int __ctx(oldmask);
+    unsigned long int __ctx(arm_r0);
+    unsigned long int __ctx(arm_r1);
+    unsigned long int __ctx(arm_r2);
+    unsigned long int __ctx(arm_r3);
+    unsigned long int __ctx(arm_r4);
+    unsigned long int __ctx(arm_r5);
+    unsigned long int __ctx(arm_r6);
+    unsigned long int __ctx(arm_r7);
+    unsigned long int __ctx(arm_r8);
+    unsigned long int __ctx(arm_r9);
+    unsigned long int __ctx(arm_r10);
+    unsigned long int __ctx(arm_fp);
+    unsigned long int __ctx(arm_ip);
+    unsigned long int __ctx(arm_sp);
+    unsigned long int __ctx(arm_lr);
+    unsigned long int __ctx(arm_pc);
+    unsigned long int __ctx(arm_cpsr);
+    unsigned long int __ctx(fault_address);
+  } mcontext_t;
 
 /* Userlevel context.  */
 typedef struct ucontext_t
index 91b7b16fde0bf54349ff7d2dc9b7212ae8701d21..c8b54264e023057239b7370054ac7e42b598db2f 100644 (file)
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
 #ifdef __USE_MISC
 /* Type for general register.  */
 typedef unsigned long int greg_t;
@@ -52,13 +57,15 @@ typedef struct fpregset
 #endif
 
 /* Context to describe whole processor state.  */
-typedef struct sigcontext mcontext_t;
-
-#ifdef __USE_MISC
-# define __ctx(fld) fld
-#else
-# define __ctx(fld) __ ## fld
-#endif
+typedef struct
+  {
+    unsigned long int __ctx(sc_flags);
+    unsigned long int __ctx(sc_gr)[32];
+    unsigned long long int __ctx(sc_fr)[32];
+    unsigned long int __ctx(sc_iasq)[2];
+    unsigned long int __ctx(sc_iaoq)[2];
+    unsigned long int __ctx(sc_sar);
+  } mcontext_t;
 
 /* Userlevel context.  */
 typedef struct ucontext_t
index 299f9a85ae7749eef62a2416437f220ae304175b..cb98e7cb13aedbd045c5bfdab57d6050d4dc57e7 100644 (file)
@@ -40,7 +40,7 @@ do {                                          \
 void
 __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
 {
-  struct sigcontext *sc = &ucp->uc_mcontext;
+  mcontext_t *sc = &ucp->uc_mcontext;
   extern void __start_context (ucontext_t *link, long gp, ...);
   unsigned long stack_start, stack_end;
   va_list ap;
index 943e68a667bf1926c12a715b5302cbc522a0d04a..ac3e3c8dea1744215226caf79fdbafa4396687f6 100644 (file)
@@ -2,15 +2,15 @@
 #include <sys/ucontext.h>
 
 --
-SC_NAT         offsetof (struct sigcontext, sc_nat)
-SC_BSP         offsetof (struct sigcontext, sc_ar_bsp)
-SC_RNAT                offsetof (struct sigcontext, sc_ar_rnat)
-SC_UNAT                offsetof (struct sigcontext, sc_ar_unat)
-SC_FPSR                offsetof (struct sigcontext, sc_ar_fpsr)
-SC_PFS         offsetof (struct sigcontext, sc_ar_pfs)
-SC_LC          offsetof (struct sigcontext, sc_ar_lc)
-SC_PR          offsetof (struct sigcontext, sc_pr)
-SC_BR          offsetof (struct sigcontext, sc_br)
-SC_GR          offsetof (struct sigcontext, sc_gr)
-SC_FR          offsetof (struct sigcontext, sc_fr)
-SC_MASK                offsetof (struct sigcontext, sc_mask)
+SC_NAT         offsetof (mcontext_t, sc_nat)
+SC_BSP         offsetof (mcontext_t, sc_ar_bsp)
+SC_RNAT                offsetof (mcontext_t, sc_ar_rnat)
+SC_UNAT                offsetof (mcontext_t, sc_ar_unat)
+SC_FPSR                offsetof (mcontext_t, sc_ar_fpsr)
+SC_PFS         offsetof (mcontext_t, sc_ar_pfs)
+SC_LC          offsetof (mcontext_t, sc_ar_lc)
+SC_PR          offsetof (mcontext_t, sc_pr)
+SC_BR          offsetof (mcontext_t, sc_br)
+SC_GR          offsetof (mcontext_t, sc_gr)
+SC_FR          offsetof (mcontext_t, sc_fr)
+SC_MASK                offsetof (mcontext_t, sc_mask)
index afe54fbd539aac4bec41a65da012bacb4b3b7aba..4847f2d59b064968dec07f51d884c1b217129e67 100644 (file)
@@ -27,6 +27,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/ucontext.h>
+#include <bits/sigcontext.h>
 #include <sys/user.h>
 
 __BEGIN_DECLS
index 681dc8913a9f6da40eb5186960e9b07afb23bd59..9de2f9431b6fdcb86fb74e1e64ab047e447a2a4c 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <features.h>
 #include <sys/ucontext.h>
+#include <bits/sigcontext.h>
 #include <bits/types.h>
 
 __BEGIN_DECLS
index 9cd686c40cc02834f6cc28f320384c82b360bd0f..8929e093a0540090e6972762857fff0772257a1b 100644 (file)
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
 /*
  * These are here mostly for backwards compatibility with older Unices.
- * IA-64 Linux does not distinguish between "struct sigcontext" and
+ * IA-64 Linux does not distinguish between "mcontext_t" and
  * "ucontext_t" as all the necessary info is inside the former.
  */
 
-typedef struct sigcontext mcontext_t;
+struct __ia64_fpreg_mcontext
+  {
+    union
+      {
+       unsigned long __ctx(bits)[2];
+      } __ctx(u);
+  } __attribute__ ((__aligned__ (16)));
+
+typedef struct
+  {
+    unsigned long int __ctx(sc_flags);
+    unsigned long int __ctx(sc_nat);
+    stack_t __ctx(sc_stack);
+    unsigned long int __ctx(sc_ip);
+    unsigned long int __ctx(sc_cfm);
+    unsigned long int __ctx(sc_um);
+    unsigned long int __ctx(sc_ar_rsc);
+    unsigned long int __ctx(sc_ar_bsp);
+    unsigned long int __ctx(sc_ar_rnat);
+    unsigned long int __ctx(sc_ar_ccv);
+    unsigned long int __ctx(sc_ar_unat);
+    unsigned long int __ctx(sc_ar_fpsr);
+    unsigned long int __ctx(sc_ar_pfs);
+    unsigned long int __ctx(sc_ar_lc);
+    unsigned long int __ctx(sc_pr);
+    unsigned long int __ctx(sc_br)[8];
+    unsigned long int __ctx(sc_gr)[32];
+    struct __ia64_fpreg_mcontext __ctx(sc_fr)[128];
+    unsigned long int __ctx(sc_rbs_base);
+    unsigned long int __ctx(sc_loadrs);
+    unsigned long int __ctx(sc_ar25);
+    unsigned long int __ctx(sc_ar26);
+    unsigned long int __ctx(sc_rsvd)[12];
+    unsigned long int __ctx(sc_mask);
+  } mcontext_t;
 
 #if __GNUC_PREREQ (3, 5)
 # define _SC_GR0_OFFSET        \
-       __builtin_offsetof (struct sigcontext, sc_gr[0])
+       __builtin_offsetof (mcontext_t, __ctx(sc_gr)[0])
 #elif defined __GNUC__
 # define _SC_GR0_OFFSET        \
-       (((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)
+       (((char *) &((mcontext_t *) 0)->__ctx(sc_gr)[0]) - (char *) 0)
 #else
 # define _SC_GR0_OFFSET        0xc8    /* pray that this is correct... */
 #endif
@@ -60,8 +99,8 @@ typedef struct ucontext_t
 ucontext_t;
 
 #define uc_mcontext    _u._mc
-#define uc_sigmask     _u._mc.sc_mask
-#define uc_stack       _u._mc.sc_stack
+#define uc_sigmask     _u._mc.__ctx(sc_mask)
+#define uc_stack       _u._mc.__ctx(sc_stack)
 #define uc_link                _u._uc._link
 
 #endif /* sys/ucontext.h */
index 3d3e8d4b7976dfe25eb67c4c4e9cdb5f4733d899..436b1865912ac1103ec3eaf096c6fbd2c4172892 100644 (file)
@@ -23,7 +23,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
diff --git a/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h b/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h
new file mode 100644 (file)
index 0000000..9824654
--- /dev/null
@@ -0,0 +1,92 @@
+/* Data structures for user-level context switching.  MicroBlaze version.
+   Copyright (C) 1997-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H        1
+
+#include <features.h>
+
+#include <bits/types/sigset_t.h>
+#include <bits/types/stack_t.h>
+
+
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
+typedef struct
+  {
+    struct
+      {
+       unsigned long int __ctx(r0);
+       unsigned long int __ctx(r1);
+       unsigned long int __ctx(r2);
+       unsigned long int __ctx(r3);
+       unsigned long int __ctx(r4);
+       unsigned long int __ctx(r5);
+       unsigned long int __ctx(r6);
+       unsigned long int __ctx(r7);
+       unsigned long int __ctx(r8);
+       unsigned long int __ctx(r9);
+       unsigned long int __ctx(r10);
+       unsigned long int __ctx(r11);
+       unsigned long int __ctx(r12);
+       unsigned long int __ctx(r13);
+       unsigned long int __ctx(r14);
+       unsigned long int __ctx(r15);
+       unsigned long int __ctx(r16);
+       unsigned long int __ctx(r17);
+       unsigned long int __ctx(r18);
+       unsigned long int __ctx(r19);
+       unsigned long int __ctx(r20);
+       unsigned long int __ctx(r21);
+       unsigned long int __ctx(r22);
+       unsigned long int __ctx(r23);
+       unsigned long int __ctx(r24);
+       unsigned long int __ctx(r25);
+       unsigned long int __ctx(r26);
+       unsigned long int __ctx(r27);
+       unsigned long int __ctx(r28);
+       unsigned long int __ctx(r29);
+       unsigned long int __ctx(r30);
+       unsigned long int __ctx(r31);
+       unsigned long int __ctx(pc);
+       unsigned long int __ctx(msr);
+       unsigned long int __ctx(ear);
+       unsigned long int __ctx(esr);
+       unsigned long int __ctx(fsr);
+       int __ctx(pt_mode);
+      } __ctx(regs);
+    unsigned long int __ctx(oldmask);
+  } mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext_t
+  {
+    unsigned long int __ctx(uc_flags);
+    struct ucontext_t *uc_link;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    sigset_t uc_sigmask;
+  } ucontext_t;
+
+#undef __ctx
+
+#endif /* sys/ucontext.h */
index 27ae9a911fce88480bace22ac93bd83394891f7c..5dd3481a6e8503035044ea983f88dd26d23dba85 100644 (file)
@@ -22,7 +22,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 #include <sgidefs.h>
index b6ad1a30e1124a0d5a4df5279fc1761a2c27df9f..6feffb6c33974f1e12705f273cfccf280c075b3d 100644 (file)
@@ -24,7 +24,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
index 3a5608260b8d20a6c5d1dcc70689bf7accc5b91b..61961029719d7e6a37792c0608efa211d78c801a 100644 (file)
@@ -20,7 +20,6 @@
 
 #include <features.h>
 
-#include <bits/sigcontext.h>
 #include <bits/types/sigset_t.h>
 #include <bits/types/stack_t.h>
 
index 88b74b66fc91ba1626865c88e22ff5444d439d44..50ce6a8a0c998a5143a01f7dc7fb25ae855aa508 100644 (file)
@@ -22,7 +22,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
index c838d801d81ed319ce25c6e095a2e5747bb2bbae..ff8e401dc1cac704d3cb93c738dacd993c9dcb2f 100644 (file)
@@ -23,7 +23,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 
index 9a3eacdeec35c3808ea053fb277296ff459cd3a8..12e4cd69d530c7d58ab8ca8ad6cdee64cd613d09 100644 (file)
@@ -21,7 +21,6 @@
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
 #include <bits/wordsize.h>
index b70dae77685c8f9ba13d8356a3a315060f323b73..7c5ed5097707cde3f446c9cd9ef269a8ac7e825f 100644 (file)
 #include <features.h>
 
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>
 
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
 #ifdef __USE_MISC
 /* Get register type and register names. */
 # include <arch/abi.h>
@@ -56,14 +61,28 @@ enum
 };
 #endif
 
-/* A machine context is exactly a sigcontext.  */
-typedef struct sigcontext mcontext_t;
+#define __need_int_reg_t
+#include <arch/abi.h>
 
-#ifdef __USE_MISC
-# define __ctx(fld) fld
-#else
-# define __ctx(fld) __ ## fld
-#endif
+/* A machine context is exactly a sigcontext.  */
+typedef struct
+  {
+    __extension__ union
+      {
+       __uint_reg_t __ctx(gregs)[56];
+       __extension__ struct
+         {
+           __uint_reg_t __ctx(__gregs)[53];
+           __uint_reg_t __ctx(tp);
+           __uint_reg_t __ctx(sp);
+           __uint_reg_t __ctx(lr);
+         };
+      };
+    __uint_reg_t __ctx(pc);
+    __uint_reg_t __ctx(ics);
+    __uint_reg_t __ctx(faultnum);
+    __uint_reg_t __glibc_reserved1[5];
+  } mcontext_t;
 
 /* Userlevel context.  */
 typedef struct ucontext_t
index 6d8137e42e453b51a15338a8741b7844281ce21a..c1b82a853eac6c582defbac3bcd8ed1e11d8936c 100644 (file)
@@ -20,8 +20,8 @@
 
 #include <features.h>
 
+#include <bits/types.h>
 #include <bits/types/sigset_t.h>
-#include <bits/sigcontext.h>
 #include <bits/types/stack_t.h>