2017-01-01 00:14:16 +00:00
|
|
|
/* Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
2002-03-04 13:40:44 +00:00
|
|
|
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
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2002-03-04 13:40:44 +00:00
|
|
|
|
|
|
|
#ifndef _BITS_SIGCONTEXT_H
|
|
|
|
#define _BITS_SIGCONTEXT_H 1
|
|
|
|
|
|
|
|
#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
|
|
|
|
# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
|
|
|
|
#endif
|
|
|
|
|
Fix sys/ucontext.h namespace from signal.h etc. inclusion (bug 21457).
The various sys/ucontext.h headers include <signal.h> and all the
headers split out of <bits/sigstack.h>. (Except that the powerpc
version does not include <signal.h>.)
None of the standard versions defining ucontext.h require or permit
such inclusions; rather, they all say that the stack_t and sigset_t
types from signal.h are defined. This patch fixes the headers to
include just the bits/ headers for those types (and the existing
includes of bits/sigcontext.h). Since bits/types/sigset_t.h is now
being included instead of bits/types/__sigset_t.h, __sigset_t uses in
the headers are replaced by direct use of the public sigset_t type.
sysdeps/unix/sysv/linux/x86/bits/sigcontext.h was relying on the prior
inclusion of <signal.h> to define types such as __uint32_t, so gets a
bits/types.h include added to provide those types.
Although one could keep some or all of the includes under a __USE_MISC
conditional, that seems unnecessary to me, especially given the lack
of a <signal.h> include in the powerpc version meaning that portable
programs already cannot rely on such an include.
Tested for x86_64 and x86, and with build-many-glibcs.py. As with
other such fixes, more namespace issues remain so this does not permit
any XFAILs to be removed or bugs to be closed.
[BZ #21457]
* sysdeps/arm/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/generic/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/i386/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/m68k/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/mips/sys/ucontext.h: Do not include <signal.h>,
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h>.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Do not include
<bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/tile/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
* sysdeps/unix/sysv/linux/x86/bits/sigcontext.h: Include
<bits/types.h>.
* sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Do not include
<signal.h>, <bits/sigstack.h>, <bits/types/struct_sigstack.h> or
<bits/ss_flags.h>. Include <bits/types/sigset_t.h> instead of
<bits/types/__sigset_t.h>.
(ucontext_t): Use sigset_t instead of __sigset_t.
2017-05-23 11:49:48 +00:00
|
|
|
#include <bits/types.h>
|
|
|
|
|
2012-06-04 19:40:46 +00:00
|
|
|
#define FP_XSTATE_MAGIC1 0x46505853U
|
|
|
|
#define FP_XSTATE_MAGIC2 0x46505845U
|
|
|
|
#define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
|
|
|
|
|
|
|
|
struct _fpx_sw_bytes
|
|
|
|
{
|
|
|
|
__uint32_t magic1;
|
|
|
|
__uint32_t extended_size;
|
|
|
|
__uint64_t xstate_bv;
|
|
|
|
__uint32_t xstate_size;
|
2017-05-04 11:26:33 +00:00
|
|
|
__uint32_t __glibc_reserved1[7];
|
2012-06-04 19:40:46 +00:00
|
|
|
};
|
|
|
|
|
2002-03-04 13:40:44 +00:00
|
|
|
struct _fpreg
|
|
|
|
{
|
|
|
|
unsigned short significand[4];
|
|
|
|
unsigned short exponent;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _fpxreg
|
|
|
|
{
|
|
|
|
unsigned short significand[4];
|
|
|
|
unsigned short exponent;
|
2017-05-04 11:26:33 +00:00
|
|
|
unsigned short __glibc_reserved1[3];
|
2002-03-04 13:40:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _xmmreg
|
|
|
|
{
|
|
|
|
__uint32_t element[4];
|
|
|
|
};
|
|
|
|
|
2002-03-21 16:03:56 +00:00
|
|
|
|
|
|
|
|
2012-05-18 11:10:55 +00:00
|
|
|
#ifndef __x86_64__
|
2002-03-21 16:03:56 +00:00
|
|
|
|
2002-03-04 13:40:44 +00:00
|
|
|
struct _fpstate
|
|
|
|
{
|
|
|
|
/* Regular FPU environment. */
|
|
|
|
__uint32_t cw;
|
|
|
|
__uint32_t sw;
|
|
|
|
__uint32_t tag;
|
|
|
|
__uint32_t ipoff;
|
|
|
|
__uint32_t cssel;
|
|
|
|
__uint32_t dataoff;
|
|
|
|
__uint32_t datasel;
|
|
|
|
struct _fpreg _st[8];
|
|
|
|
unsigned short status;
|
|
|
|
unsigned short magic;
|
|
|
|
|
|
|
|
/* FXSR FPU environment. */
|
|
|
|
__uint32_t _fxsr_env[6];
|
|
|
|
__uint32_t mxcsr;
|
2017-05-04 11:26:33 +00:00
|
|
|
__uint32_t __glibc_reserved1;
|
2002-03-22 12:59:21 +00:00
|
|
|
struct _fpxreg _fxsr_st[8];
|
2002-03-26 12:38:27 +00:00
|
|
|
struct _xmmreg _xmm[8];
|
2017-05-04 11:26:33 +00:00
|
|
|
__uint32_t __glibc_reserved2[56];
|
2002-03-04 13:40:44 +00:00
|
|
|
};
|
|
|
|
|
2006-01-20 19:37:46 +00:00
|
|
|
#ifndef sigcontext_struct
|
|
|
|
/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
|
|
|
|
we need sigcontext. Some packages have come to rely on
|
|
|
|
sigcontext_struct being defined on 32-bit x86, so define this for
|
|
|
|
their benefit. */
|
|
|
|
# define sigcontext_struct sigcontext
|
|
|
|
#endif
|
|
|
|
|
2012-06-04 19:40:46 +00:00
|
|
|
#define X86_FXSR_MAGIC 0x0000
|
|
|
|
|
2002-03-04 13:40:44 +00:00
|
|
|
struct sigcontext
|
|
|
|
{
|
|
|
|
unsigned short gs, __gsh;
|
|
|
|
unsigned short fs, __fsh;
|
|
|
|
unsigned short es, __esh;
|
|
|
|
unsigned short ds, __dsh;
|
|
|
|
unsigned long edi;
|
|
|
|
unsigned long esi;
|
|
|
|
unsigned long ebp;
|
|
|
|
unsigned long esp;
|
|
|
|
unsigned long ebx;
|
|
|
|
unsigned long edx;
|
|
|
|
unsigned long ecx;
|
|
|
|
unsigned long eax;
|
|
|
|
unsigned long trapno;
|
|
|
|
unsigned long err;
|
|
|
|
unsigned long eip;
|
|
|
|
unsigned short cs, __csh;
|
|
|
|
unsigned long eflags;
|
|
|
|
unsigned long esp_at_signal;
|
|
|
|
unsigned short ss, __ssh;
|
|
|
|
struct _fpstate * fpstate;
|
|
|
|
unsigned long oldmask;
|
|
|
|
unsigned long cr2;
|
|
|
|
};
|
|
|
|
|
2012-05-18 11:10:55 +00:00
|
|
|
#else /* __x86_64__ */
|
2002-03-04 13:40:44 +00:00
|
|
|
|
2002-03-21 16:03:56 +00:00
|
|
|
struct _fpstate
|
|
|
|
{
|
2002-03-21 16:11:18 +00:00
|
|
|
/* FPU environment matching the 64-bit FXSAVE layout. */
|
2002-03-21 16:03:56 +00:00
|
|
|
__uint16_t cwd;
|
|
|
|
__uint16_t swd;
|
2002-03-22 12:17:21 +00:00
|
|
|
__uint16_t ftw;
|
2002-03-21 16:03:56 +00:00
|
|
|
__uint16_t fop;
|
|
|
|
__uint64_t rip;
|
|
|
|
__uint64_t rdp;
|
|
|
|
__uint32_t mxcsr;
|
|
|
|
__uint32_t mxcr_mask;
|
2002-03-22 12:59:21 +00:00
|
|
|
struct _fpxreg _st[8];
|
2002-03-26 12:38:27 +00:00
|
|
|
struct _xmmreg _xmm[16];
|
2017-05-04 11:26:33 +00:00
|
|
|
__uint32_t __glibc_reserved1[24];
|
2002-03-21 16:03:56 +00:00
|
|
|
};
|
|
|
|
|
2002-03-04 13:40:44 +00:00
|
|
|
struct sigcontext
|
|
|
|
{
|
2012-05-18 11:10:55 +00:00
|
|
|
__uint64_t r8;
|
|
|
|
__uint64_t r9;
|
|
|
|
__uint64_t r10;
|
|
|
|
__uint64_t r11;
|
|
|
|
__uint64_t r12;
|
|
|
|
__uint64_t r13;
|
|
|
|
__uint64_t r14;
|
|
|
|
__uint64_t r15;
|
|
|
|
__uint64_t rdi;
|
|
|
|
__uint64_t rsi;
|
|
|
|
__uint64_t rbp;
|
|
|
|
__uint64_t rbx;
|
|
|
|
__uint64_t rdx;
|
|
|
|
__uint64_t rax;
|
|
|
|
__uint64_t rcx;
|
|
|
|
__uint64_t rsp;
|
|
|
|
__uint64_t rip;
|
|
|
|
__uint64_t eflags;
|
2002-03-27 11:08:02 +00:00
|
|
|
unsigned short cs;
|
|
|
|
unsigned short gs;
|
|
|
|
unsigned short fs;
|
|
|
|
unsigned short __pad0;
|
2012-05-18 11:10:55 +00:00
|
|
|
__uint64_t err;
|
|
|
|
__uint64_t trapno;
|
|
|
|
__uint64_t oldmask;
|
|
|
|
__uint64_t cr2;
|
|
|
|
__extension__ union
|
|
|
|
{
|
|
|
|
struct _fpstate * fpstate;
|
|
|
|
__uint64_t __fpstate_word;
|
|
|
|
};
|
|
|
|
__uint64_t __reserved1 [8];
|
2002-03-04 13:40:44 +00:00
|
|
|
};
|
|
|
|
|
2012-05-18 11:10:55 +00:00
|
|
|
#endif /* __x86_64__ */
|
2002-03-04 13:40:44 +00:00
|
|
|
|
2012-06-04 19:40:46 +00:00
|
|
|
struct _xsave_hdr
|
|
|
|
{
|
|
|
|
__uint64_t xstate_bv;
|
2017-05-04 11:26:33 +00:00
|
|
|
__uint64_t __glibc_reserved1[2];
|
|
|
|
__uint64_t __glibc_reserved2[5];
|
2012-06-04 19:40:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _ymmh_state
|
|
|
|
{
|
|
|
|
__uint32_t ymmh_space[64];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _xstate
|
|
|
|
{
|
|
|
|
struct _fpstate fpstate;
|
|
|
|
struct _xsave_hdr xstate_hdr;
|
|
|
|
struct _ymmh_state ymmh;
|
|
|
|
};
|
|
|
|
|
2002-03-04 13:40:44 +00:00
|
|
|
#endif /* _BITS_SIGCONTEXT_H */
|