From patchwork Tue Jun 20 17:53:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 21147 Received: (qmail 84424 invoked by alias); 20 Jun 2017 17:53:41 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 84414 invoked by uid 89); 20 Jun 2017 17:53:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=ics X-HELO: relay1.mentorg.com Date: Tue, 20 Jun 2017 17:53:27 +0000 From: Joseph Myers To: Subject: Fix mcontext_t sigcontext namespace (bug 21457) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) This patch continues the ucontext.h namespace fixes by fixing issues related to the use of struct sigcontext as mcontext_t, and inclusion of even when struct sigcontext is not so used. Inclusion of by is removed; the way to get the sigcontext structure is by including (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). This patch is relative to a tree with (pending review) applied (fixed as noted in ), although the dependencies are fairly trivial. The XFAIL removals (11 of the 13 miscellaneous conform/ XFAILs) also depend on and (pending review) to avoid various architecture-specific failures appearing. Tested for x86_64, and with build-many-glibcs.py. 2017-06-20 Joseph Myers [BZ #21457] * sysdeps/arm/sys/ucontext.h: Do not include . * sysdeps/generic/sys/ucontext.h: Add comment about use of struct sigcontext and namespace requirements. * sysdeps/i386/sys/ucontext.h: Do not include . * sysdeps/m68k/sys/ucontext.h: Likewise. * sysdeps/mips/sys/ucontext.h: Likewise. Include . * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include . (__ctx): New macro. (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 . (__ctx): New macro. (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 . (__ctx): New macro. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include . (__ctx): New macro. (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 . (__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 . * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include . * sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: New file. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include . * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include . * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include . * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include . * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include . * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include . * sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include . (__ctx): New macro. (mcontext_t): Define structure contents rather than using struct sigcontext. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include . Include . * conform/Makefile (test-xfail-XPG42/ucontext.h/conform): Remove. (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. diff --git a/NEWS b/NEWS index e263385..2444bc4 100644 --- a/NEWS +++ b/NEWS @@ -96,6 +96,10 @@ Version 2.26 fpregset_t type no longer has the name struct fpu. This changes the C++ name mangling for interfaces involving those types. +* 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. + * The synchronization that pthread_spin_unlock performs has been changed to now be equivalent to a C11 atomic store with release memory order to the spin lock's memory location. This ensures correct synchronization diff --git a/conform/Makefile b/conform/Makefile index 9ec41c7..3f1e5f9 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -163,17 +163,6 @@ 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 diff --git a/sysdeps/arm/sys/ucontext.h b/sysdeps/arm/sys/ucontext.h index 464a353..7bf208f 100644 --- a/sysdeps/arm/sys/ucontext.h +++ b/sysdeps/arm/sys/ucontext.h @@ -23,7 +23,6 @@ #include #include -#include #include diff --git a/sysdeps/generic/sys/ucontext.h b/sysdeps/generic/sys/ucontext.h index e4679d3..9a67791 100644 --- a/sysdeps/generic/sys/ucontext.h +++ b/sysdeps/generic/sys/ucontext.h @@ -17,7 +17,9 @@ . */ /* 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 diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/sys/ucontext.h index be8c7e5..782fa30 100644 --- a/sysdeps/i386/sys/ucontext.h +++ b/sysdeps/i386/sys/ucontext.h @@ -23,7 +23,6 @@ #include #include -#include #include diff --git a/sysdeps/m68k/sys/ucontext.h b/sysdeps/m68k/sys/ucontext.h index 00c4af4..6e511e4 100644 --- a/sysdeps/m68k/sys/ucontext.h +++ b/sysdeps/m68k/sys/ucontext.h @@ -23,7 +23,6 @@ #include #include -#include #include diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/sys/ucontext.h index d69656b..5a6be03 100644 --- a/sysdeps/mips/sys/ucontext.h +++ b/sysdeps/mips/sys/ucontext.h @@ -22,8 +22,8 @@ #include +#include #include -#include #include #include diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h index 4f602fc..90d0c42 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h @@ -24,10 +24,15 @@ #include #include -#include #include #ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +#ifdef __USE_MISC # include @@ -44,7 +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; +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 @@ -56,4 +69,6 @@ typedef struct ucontext_t mcontext_t uc_mcontext; } ucontext_t; +#undef __ctx + #endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym b/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym index ab3930c..479bdda 100644 --- a/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym @@ -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) diff --git a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h b/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h index bf95205..4711277 100644 --- a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h @@ -21,10 +21,15 @@ #include #include -#include #include +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + /* Type for general register. */ typedef long int greg_t; @@ -51,7 +56,27 @@ typedef fpreg_t fpregset_t[__NFPREG]; /* A machine context is exactly a sigcontext. */ -typedef struct sigcontext mcontext_t; +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 @@ -64,4 +89,6 @@ typedef struct ucontext_t sigset_t uc_sigmask; } ucontext_t; +#undef __ctx + #endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym b/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym index f95ff75..9e86f8a 100644 --- a/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym +++ b/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym @@ -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) diff --git a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h b/sysdeps/unix/sysv/linux/arm/sys/ucontext.h index 1083d66..b166f2c 100644 --- a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/arm/sys/ucontext.h @@ -23,11 +23,16 @@ #include #include -#include #include #ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +#ifdef __USE_MISC typedef int greg_t; /* Number of general registers. */ @@ -98,7 +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; +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 @@ -111,4 +139,6 @@ typedef struct ucontext_t unsigned long uc_regspace[128] __attribute__((__aligned__(8))); } ucontext_t; +#undef __ctx + #endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h index 2fd7e91..d463368 100644 --- a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h @@ -23,11 +23,16 @@ #include #include -#include #include #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,7 +57,15 @@ typedef struct fpregset #endif /* Context to describe whole processor state. */ -typedef struct sigcontext mcontext_t; +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 @@ -64,4 +77,6 @@ typedef struct ucontext_t sigset_t uc_sigmask; } ucontext_t; +#undef __ctx + #endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/ia64/makecontext.c b/sysdeps/unix/sysv/linux/ia64/makecontext.c index 299f9a8..cb98e7c 100644 --- a/sysdeps/unix/sysv/linux/ia64/makecontext.c +++ b/sysdeps/unix/sysv/linux/ia64/makecontext.c @@ -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; diff --git a/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym b/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym index 943e68a..ac3e3c8 100644 --- a/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym +++ b/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym @@ -2,15 +2,15 @@ #include -- -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) diff --git a/sysdeps/unix/sysv/linux/ia64/sys/procfs.h b/sysdeps/unix/sysv/linux/ia64/sys/procfs.h index afe54fb..4847f2d 100644 --- a/sysdeps/unix/sysv/linux/ia64/sys/procfs.h +++ b/sysdeps/unix/sysv/linux/ia64/sys/procfs.h @@ -27,6 +27,7 @@ #include #include #include +#include #include __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h index c77e6dc..c718f87 100644 --- a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h @@ -21,6 +21,7 @@ #include #include +#include #include __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h b/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h index 9cd686c..8929e09 100644 --- a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h @@ -21,24 +21,63 @@ #include #include -#include #include +#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 */ diff --git a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h index 1f807b5..7a92ab3 100644 --- a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h @@ -23,7 +23,6 @@ #include #include -#include #include diff --git a/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h b/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h new file mode 100644 index 0000000..ea87330 --- /dev/null +++ b/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h @@ -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 + . */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include + +#include +#include + + +#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 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 */ diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h index d17aa71..dac5751 100644 --- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h b/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h index 09e473c..5ddae7f 100644 --- a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h @@ -24,7 +24,6 @@ #include #include -#include #include diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h index 54fe9df..26b032c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h @@ -20,7 +20,6 @@ #include -#include #include #include diff --git a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h index d6bf4d8..368ea9d 100644 --- a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h @@ -22,7 +22,6 @@ #include #include -#include #include diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h index 2f42d3a..53691b5 100644 --- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h @@ -23,7 +23,6 @@ #include #include -#include #include diff --git a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h b/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h index 9932ed4..126d844 100644 --- a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h @@ -21,7 +21,6 @@ #include #include -#include #include #include diff --git a/sysdeps/unix/sysv/linux/tile/sys/ucontext.h b/sysdeps/unix/sysv/linux/tile/sys/ucontext.h index fcbe3ff..aac020c 100644 --- a/sysdeps/unix/sysv/linux/tile/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/tile/sys/ucontext.h @@ -22,10 +22,15 @@ #include #include -#include #include #ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +#ifdef __USE_MISC /* Get register type and register names. */ # include @@ -56,8 +61,28 @@ enum }; #endif +#define __need_int_reg_t +#include + /* A machine context is exactly a sigcontext. */ -typedef struct sigcontext mcontext_t; +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 @@ -69,4 +94,6 @@ typedef struct ucontext_t sigset_t uc_sigmask; } ucontext_t; +#undef __ctx + #endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86/sys/ucontext.h index f4f5c94..5d8050a 100644 --- a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h +++ b/sysdeps/unix/sysv/linux/x86/sys/ucontext.h @@ -20,8 +20,8 @@ #include +#include #include -#include #include