From 536eef52c5c6bae9939aa5b591b914273e731a13 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 11 Jun 2019 13:05:02 -0400 Subject: Rename sys/ucontext.h to bits/ucontext.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sys/ucontext.h is effectively a bits header. Its contents are extremely system-specific, and it’s strongly associated with a specific public header (ucontext.h) that provides a superset of its definitions, but there are other public headers that also require some of its definitions. This patch therefore moves it into the bits/ namespace and adjusts all the headers that refer to it. In case there are external users, a stub is added that includes ucontext.h. Most of the fallout changes are trivial, but aarch64, ia64 and riscv need a little more work. aarch64 sys/ucontext.h (now bits/ucontext.h) was including sys/procfs.h for the definition of elf_greg_t etc; the simplest fix is to have it include bits/procfs.h instead (and then that needs to include sys/user.h for user_regs_struct). This is not ideal but fixing it properly would require disentangling all of the debugger interface headers which is more than I’m up for at the moment. ia64 bits/ptrace.h and bits/procfs.h were both including bits/sigcontext.h, which is only licensed to be included from signal.h. (I’m not sure how this ever worked, or why it broke with this patch and not some previous one.) This is fixed by creating another single-type header, bits/types/__ia64_fpreg.h, which provides the only thing they need from bits/sigcontext.h. s/u/s/l/riscv/makecontext.c was defining makecontext with a function head that didn’t agree with its official prototype (in ucontext.h); formerly that file did not include ucontext.h, only sys/ucontext.h, so we were getting away with it, but it’s still wrong. Making the function head match the prototype actually simplifies the code. * sysdeps/generic/sys/ucontext.h: Move to top level bits/ucontext.h. Adjust multiple inclusion guard. * sysdeps/arm/sys/ucontext.h: Move to sysdeps/arm/bits/ucontext.h. Adjust multiple inclusion guard. * sysdeps/i386/sys/ucontext.h: Similarly. * sysdeps/m68k/sys/ucontext.h: Similarly. * sysdeps/mips/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/alpha/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/arm/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/csky/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/hppa/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/m68k/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/nios2/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/riscv/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/sparc/sys/ucontext.h: Similarly. * sysdeps/unix/sysv/linux/x86/sys/ucontext.h: Similarly. * stdlib/Makefile: Install bits/ucontext.h. * stdlib/sys/ucontext.h: New backward compatibility stub header, includes ucontext.h. * include/sys/ucontext.h: New wrapper. * sysdeps/unix/sysv/linux/aarch64/bits/procfs.h: Allow inclusion by bits/ucontext.h as well as sys/procfs.h. Include sys/user.h. * sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h: Include bits/procfs.h instead of sys/procfs.h. * sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h: New file, contents factored out of ia64/bits/sigcontext.h and ia64/bits/ucontext.h. * sysdeps/unix/sysv/linux/ia64/Makefile: Install bits/types/__ia64_fpreg.h. Merge subdir=misc blocks. * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h * sysdeps/unix/sysv/linux/ia64/bits/ucontext.h: Include bits/types/__ia64_fpreg.h for struct ia64_fpreg. * sysdeps/unix/sysv/linux/ia64/bits/procfs.h: Include bits/types/__ia64_fpreg.h for struct ia64_fpreg. Don’t include bits/sigcontext.h or bits/ucontext.h. * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h: Don’t include bits/sigcontext.h. * sysdeps/unix/sysv/linux/riscv/makecontext.c: Include ucontext.h, not sys/ucontext.h. Correct function head to match prototype in ucontext.h. Use va_arg to retrieve all arguments past argc. * sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c: Sort list of includes. * signal/signal.h, stdlib/ucontext.h * sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h * sysdeps/unix/sysv/linux/ia64/sys/ptrace.h * sysdeps/unix/sysv/linux/riscv/bits/procfs.h * sysdeps/unix/sysv/linux/s390/bits/procfs.h: Include bits/ucontext.h, not sys/ucontext.h. * sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h * sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h * sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h: Include signal.h, not sys/ucontext.h. * sysdeps/unix/sysv/linux/arm/register-dump.h * sysdeps/unix/sysv/linux/csky/register-dump.h: Include ucontext.h, not sys/ucontext.h. * sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym * sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym * sysdeps/unix/sysv/linux/arm/ucontext_i.sym * sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym * sysdeps/unix/sysv/linux/hppa/ucontext_i.sym * sysdeps/unix/sysv/linux/i386/ucontext_i.sym * sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym * sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym * sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym * sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym * sysdeps/unix/sysv/linux/mips/ucontext_i.sym * sysdeps/unix/sysv/linux/nios2/ucontext_i.sym * sysdeps/unix/sysv/linux/riscv/ucontext_i.sym * sysdeps/unix/sysv/linux/s390/ucontext_i.sym * sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym * sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym * sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym * sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym: Include stddef.h and signal.h; don’t include any other headers. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES) (SYSDEP_ALLOWED_INCLUDES): Update. --- bits/ucontext.h | 54 ++++ include/sys/ucontext.h | 1 + scripts/check-obsolete-constructs.py | 25 +- signal/signal.h | 2 +- stdlib/Makefile | 2 +- stdlib/sys/ucontext.h | 1 + stdlib/ucontext.h | 2 +- sysdeps/arm/bits/ucontext.h | 110 ++++++++ sysdeps/arm/sys/ucontext.h | 110 -------- sysdeps/generic/sys/ucontext.h | 54 ---- sysdeps/i386/bits/ucontext.h | 138 ++++++++++ sysdeps/i386/sys/ucontext.h | 138 ---------- sysdeps/m68k/bits/ucontext.h | 125 +++++++++ sysdeps/m68k/sys/ucontext.h | 125 --------- sysdeps/mips/bits/ucontext.h | 176 ++++++++++++ sysdeps/mips/sys/ucontext.h | 176 ------------ sysdeps/unix/sysv/linux/aarch64/bits/procfs.h | 3 +- sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h | 78 ++++++ sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h | 2 +- sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h | 78 ------ sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym | 5 +- .../unix/sysv/linux/alpha/bits/procfs-prregset.h | 4 +- sysdeps/unix/sysv/linux/alpha/bits/ucontext.h | 94 +++++++ sysdeps/unix/sysv/linux/alpha/sys/ucontext.h | 94 ------- sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym | 2 +- sysdeps/unix/sysv/linux/arm/bits/ucontext.h | 144 ++++++++++ sysdeps/unix/sysv/linux/arm/register-dump.h | 2 +- sysdeps/unix/sysv/linux/arm/sys/ucontext.h | 144 ---------- sysdeps/unix/sysv/linux/arm/ucontext_i.sym | 4 +- sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym | 4 +- sysdeps/unix/sysv/linux/csky/bits/ucontext.h | 89 ++++++ sysdeps/unix/sysv/linux/csky/register-dump.h | 2 +- sysdeps/unix/sysv/linux/csky/sys/ucontext.h | 89 ------ sysdeps/unix/sysv/linux/hppa/bits/ucontext.h | 82 ++++++ sysdeps/unix/sysv/linux/hppa/sys/ucontext.h | 82 ------ sysdeps/unix/sysv/linux/hppa/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/i386/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/ia64/Makefile | 6 +- sysdeps/unix/sysv/linux/ia64/bits/procfs.h | 5 +- sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h | 9 +- .../unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h | 22 ++ sysdeps/unix/sysv/linux/ia64/bits/ucontext.h | 98 +++++++ .../unix/sysv/linux/ia64/sigcontext-offsets.sym | 2 +- sysdeps/unix/sysv/linux/ia64/sys/ptrace.h | 3 +- sysdeps/unix/sysv/linux/ia64/sys/ucontext.h | 106 ------- sysdeps/unix/sysv/linux/m68k/bits/ucontext.h | 130 +++++++++ sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/m68k/sys/ucontext.h | 130 --------- sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h | 92 +++++++ sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h | 92 ------- sysdeps/unix/sysv/linux/mips/bits/ucontext.h | 124 +++++++++ sysdeps/unix/sysv/linux/mips/sys/ucontext.h | 124 --------- sysdeps/unix/sysv/linux/mips/ucontext_i.sym | 2 - sysdeps/unix/sysv/linux/nios2/bits/ucontext.h | 61 +++++ sysdeps/unix/sysv/linux/nios2/sys/ucontext.h | 61 ----- sysdeps/unix/sysv/linux/nios2/ucontext_i.sym | 2 - sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h | 200 ++++++++++++++ .../sysv/linux/powerpc/powerpc32/ucontext_i.sym | 1 - .../sysv/linux/powerpc/powerpc64/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h | 200 -------------- sysdeps/unix/sysv/linux/riscv/bits/procfs.h | 6 +- sysdeps/unix/sysv/linux/riscv/bits/ucontext.h | 110 ++++++++ sysdeps/unix/sysv/linux/riscv/makecontext.c | 18 +- sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h | 2 +- sysdeps/unix/sysv/linux/riscv/sys/ucontext.h | 110 -------- sysdeps/unix/sysv/linux/riscv/ucontext_i.sym | 4 +- sysdeps/unix/sysv/linux/s390/bits/procfs.h | 6 +- sysdeps/unix/sysv/linux/s390/bits/ucontext.h | 95 +++++++ sysdeps/unix/sysv/linux/s390/sys/ucontext.h | 95 ------- .../unix/sysv/linux/s390/tst-ptrace-singleblock.c | 10 +- sysdeps/unix/sysv/linux/s390/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/sh/bits/ucontext.h | 126 +++++++++ sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/sh/sys/ucontext.h | 126 --------- sysdeps/unix/sysv/linux/sparc/bits/ucontext.h | 304 +++++++++++++++++++++ .../unix/sysv/linux/sparc/sparc32/ucontext_i.sym | 1 - sysdeps/unix/sysv/linux/sparc/sys/ucontext.h | 304 --------------------- sysdeps/unix/sysv/linux/x86/bits/ucontext.h | 262 ++++++++++++++++++ sysdeps/unix/sysv/linux/x86/sys/ucontext.h | 262 ------------------ sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym | 1 - 81 files changed, 2766 insertions(+), 2794 deletions(-) create mode 100644 bits/ucontext.h create mode 100644 include/sys/ucontext.h create mode 100644 stdlib/sys/ucontext.h create mode 100644 sysdeps/arm/bits/ucontext.h delete mode 100644 sysdeps/arm/sys/ucontext.h delete mode 100644 sysdeps/generic/sys/ucontext.h create mode 100644 sysdeps/i386/bits/ucontext.h delete mode 100644 sysdeps/i386/sys/ucontext.h create mode 100644 sysdeps/m68k/bits/ucontext.h delete mode 100644 sysdeps/m68k/sys/ucontext.h create mode 100644 sysdeps/mips/bits/ucontext.h delete mode 100644 sysdeps/mips/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/alpha/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/arm/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/arm/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/csky/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/csky/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/hppa/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h create mode 100644 sysdeps/unix/sysv/linux/ia64/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/ia64/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/m68k/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/m68k/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/mips/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/mips/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/nios2/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/nios2/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/riscv/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/s390/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/s390/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/sh/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/sh/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/sparc/sys/ucontext.h create mode 100644 sysdeps/unix/sysv/linux/x86/bits/ucontext.h delete mode 100644 sysdeps/unix/sysv/linux/x86/sys/ucontext.h diff --git a/bits/ucontext.h b/bits/ucontext.h new file mode 100644 index 0000000000..ee2cff7609 --- /dev/null +++ b/bits/ucontext.h @@ -0,0 +1,54 @@ +/* Data structures for user-level context switching. Generic version. + Copyright (C) 1997-2020 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 + . */ + +/* This file's definitions suffice for any platform where all + the machine-specific state is described in `struct sigcontext', but + use of struct sigcontext does not conform to POSIX namespace + requirements. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include +#include + + +typedef struct sigcontext mcontext_t; + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* 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 /* bits/ucontext.h */ diff --git a/include/sys/ucontext.h b/include/sys/ucontext.h new file mode 100644 index 0000000000..1450bae8f3 --- /dev/null +++ b/include/sys/ucontext.h @@ -0,0 +1 @@ +#include diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index c6ce674a5a..65dc98fea8 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -504,24 +504,25 @@ HEADER_ALLOWED_INCLUDES = { # tgmath.h -> complex.h, math.h # threads.h -> time.h "inttypes.h": [ "stdint.h" ], - "signal.h": [ "sys/ucontext.h" ], - "stdlib.h": [ "alloca.h", "sys/types.h" ], "tgmath.h": [ "complex.h", "math.h" ], "threads.h": [ "time.h" ], + # necessary for backward compatibility with old GNU extensions + "stdlib.h": [ "alloca.h", "sys/types.h" ], # POSIX top-level headers # mandated: pthread.h -> sched.h, time.h + "pthread.h": [ "sched.h", "time.h" ], # allowed: ftw.h -> sys/stat.h # mqueue.h -> fcntl.h # sched.h -> time.h # spawn.h -> sched.h "ftw.h": [ "sys/stat.h" ], - "langinfo.h": [ "nl_types.h" ], "mqueue.h": [ "fcntl.h" ], - "pthread.h": [ "sched.h", "time.h" ], - "regex.h": [ "limits.h", "sys/types.h" ], "sched.h": [ "time.h" ], "spawn.h": [ "sched.h" ], + # not yet analyzed + "langinfo.h": [ "nl_types.h" ], + "regex.h": [ "limits.h", "sys/types.h" ], "termios.h": [ "sys/ttydefaults.h" ], "utmpx.h": [ "paths.h" ], @@ -562,7 +563,6 @@ HEADER_ALLOWED_INCLUDES = { "shadow.h": [ "paths.h" ], "stdio_ext.h": [ "stdio.h" ], "thread_db.h": [ "pthread.h", "stdint.h", "sys/procfs.h" ], - "ucontext.h": [ "sys/ucontext.h" ], "utmp.h": [ "paths.h" ], "values.h": [ "float.h", "limits.h" ], @@ -574,12 +574,10 @@ HEADER_ALLOWED_INCLUDES = { "sys/mount.h": [ "sys/ioctl.h" ], "sys/mtio.h": [ "sys/ioctl.h" ], "sys/param.h": [ "endian.h", "limits.h", "sys/types.h" ], - "sys/procfs.h": [ "sys/ucontext.h", "sys/user.h" ], - "sys/ptrace.h": [ "sys/ucontext.h" ], + "sys/procfs.h": [ "sys/user.h" ], "sys/raw.h": [ "sys/ioctl.h" ], "sys/timerfd.h": [ "time.h" ], "sys/ttychars.h": [ "sys/ttydefaults.h" ], - "sys/ucontext.h": [ "sys/procfs.h" ], "sys/vfs.h": [ "sys/statfs.h" ], # Nonstandardized headers that do nothing but include some other @@ -597,6 +595,7 @@ HEADER_ALLOWED_INCLUDES = { "sys/socketvar.h": [ "sys/socket.h" ], "sys/syslog.h": [ "syslog.h" ], "sys/termios.h": [ "termios.h" ], + "sys/ucontext.h": [ "ucontext.h" ], "sys/unistd.h": [ "unistd.h" ], "syscall.h": [ "sys/syscall.h" ], "termio.h": [ "sys/ioctl.h", "termios.h" ], @@ -623,8 +622,6 @@ HEADER_ALLOWED_INCLUDES = { "features.h": [ "gnu/stubs.h", "stdc-predef.h", "sys/cdefs.h" ], - "bits/procfs.h": [ "signal.h", "sys/ucontext.h" ], - "bits/types/__va_list.h": [ "stdarg.h" ], "bits/types/ptrdiff_t.h": [ "stddef.h" ], "bits/types/size_t.h": [ "stddef.h" ], @@ -670,8 +667,8 @@ SYSDEP_ALLOWED_INCLUDES = { "bits/ioctls.h": [ "asm/ioctls.h", "linux/sockios.h" ], "bits/local_lim.h": [ "linux/limits.h" ], "bits/param.h": [ "linux/limits.h", "linux/param.h" ], - "bits/procfs.h": [ "asm/elf.h", "asm/ptrace.h" ], - "bits/procfs-prregset.h": [ "sys/ucontext.h" ], + "bits/procfs.h": [ "asm/elf.h", "asm/ptrace.h", + "sys/user.h" ], "bits/sigcontext.h": [ "asm/sigcontext.h" ], "bits/socket.h": [ "asm/socket.h" ], }, @@ -689,7 +686,6 @@ SYSDEP_ALLOWED_INCLUDES = { "sys/fpregdef.h": [ "sgidefs.h" ], "sys/regdef.h": [ "sgidefs.h" ], "sys/tas.h": [ "sgidefs.h" ], - "sys/ucontext.h": [ "sgidefs.h" ], "sys/user.h": [ "sgidefs.h" ], "bits/fcntl.h": [ "sgidefs.h" ], @@ -699,6 +695,7 @@ SYSDEP_ALLOWED_INCLUDES = { "bits/setjmp.h": [ "sgidefs.h" ], "bits/sigcontext.h": [ "sgidefs.h" ], "bits/stat.h": [ "sgidefs.h" ], + "bits/ucontext.h": [ "sgidefs.h" ], "bits/wordsize.h": [ "sgidefs.h" ], }, } diff --git a/signal/signal.h b/signal/signal.h index ae40b90391..a6dd2800f7 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -293,7 +293,7 @@ extern int sigreturn (struct sigcontext *__scp) __THROW; # include # if defined __USE_XOPEN || defined __USE_XOPEN2K8 /* This will define `ucontext_t' and `mcontext_t'. */ -# include +# include # endif #endif /* Use POSIX.1-2008 or X/Open Unix. */ diff --git a/stdlib/Makefile b/stdlib/Makefile index 6f8e6ba31d..f5ea81f0e8 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -26,7 +26,7 @@ headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \ monetary.h bits/monetary-ldbl.h \ inttypes.h stdint.h bits/wordsize.h bits/timesize.h \ errno.h sys/errno.h bits/errno.h bits/types/error_t.h \ - ucontext.h sys/ucontext.h bits/indirect-return.h \ + ucontext.h sys/ucontext.h bits/ucontext.h bits/indirect-return.h \ alloca.h fmtmsg.h \ bits/stdlib-bsearch.h sys/random.h bits/stdint-intn.h \ bits/stdint-uintn.h bits/time64.h bits/NULL.h \ diff --git a/stdlib/sys/ucontext.h b/stdlib/sys/ucontext.h new file mode 100644 index 0000000000..5fdbd63dbb --- /dev/null +++ b/stdlib/sys/ucontext.h @@ -0,0 +1 @@ +#include diff --git a/stdlib/ucontext.h b/stdlib/ucontext.h index b38d019076..0230a75774 100644 --- a/stdlib/ucontext.h +++ b/stdlib/ucontext.h @@ -26,7 +26,7 @@ #include /* Get machine dependent definition of data structures. */ -#include +#include __BEGIN_DECLS diff --git a/sysdeps/arm/bits/ucontext.h b/sysdeps/arm/bits/ucontext.h new file mode 100644 index 0000000000..236924384c --- /dev/null +++ b/sysdeps/arm/bits/ucontext.h @@ -0,0 +1,110 @@ +/* Copyright (C) 1998-2020 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 + . */ + +/* System V/ARM ABI compliant context switching support. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + + +typedef int greg_t; + +/* Number of general registers. */ +#define __NGREG 16 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_MISC +/* Number of each register is the `gregset_t' array. */ +enum +{ + R0 = 0, +# define R0 R0 + R1 = 1, +# define R1 R1 + R2 = 2, +# define R2 R2 + R3 = 3, +# define R3 R3 + R4 = 4, +# define R4 R4 + R5 = 5, +# define R5 R5 + R6 = 6, +# define R6 R6 + R7 = 7, +# define R7 R7 + R8 = 8, +# define R8 R8 + R9 = 9, +# define R9 R9 + R10 = 10, +# define R10 R10 + R11 = 11, +# define R11 R11 + R12 = 12, +# define R12 R12 + R13 = 13, +# define R13 R13 + R14 = 14, +# define R14 R14 + R15 = 15, +# define R15 R15 +}; +#endif + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* Structure to describe FPU registers. */ +typedef struct + { + } fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __ctx(gregs); + fpregset_t __ctx(fpregs); + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + long int __glibc_reserved1[5]; + } ucontext_t; + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/arm/sys/ucontext.h b/sysdeps/arm/sys/ucontext.h deleted file mode 100644 index d082693e77..0000000000 --- a/sysdeps/arm/sys/ucontext.h +++ /dev/null @@ -1,110 +0,0 @@ -/* Copyright (C) 1998-2020 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 - . */ - -/* System V/ARM ABI compliant context switching support. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - - -typedef int greg_t; - -/* Number of general registers. */ -#define __NGREG 16 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_MISC -/* Number of each register is the `gregset_t' array. */ -enum -{ - R0 = 0, -# define R0 R0 - R1 = 1, -# define R1 R1 - R2 = 2, -# define R2 R2 - R3 = 3, -# define R3 R3 - R4 = 4, -# define R4 R4 - R5 = 5, -# define R5 R5 - R6 = 6, -# define R6 R6 - R7 = 7, -# define R7 R7 - R8 = 8, -# define R8 R8 - R9 = 9, -# define R9 R9 - R10 = 10, -# define R10 R10 - R11 = 11, -# define R11 R11 - R12 = 12, -# define R12 R12 - R13 = 13, -# define R13 R13 - R14 = 14, -# define R14 R14 - R15 = 15, -# define R15 R15 -}; -#endif - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -/* Structure to describe FPU registers. */ -typedef struct - { - } fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - gregset_t __ctx(gregs); - fpregset_t __ctx(fpregs); - } mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long int __ctx(uc_flags); - struct ucontext_t *uc_link; - sigset_t uc_sigmask; - stack_t uc_stack; - mcontext_t uc_mcontext; - long int __glibc_reserved1[5]; - } ucontext_t; - -#undef __ctx - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/generic/sys/ucontext.h b/sysdeps/generic/sys/ucontext.h deleted file mode 100644 index 5d042b8cf8..0000000000 --- a/sysdeps/generic/sys/ucontext.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Data structures for user-level context switching. Generic version. - Copyright (C) 1997-2020 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 - . */ - -/* This file's definitions suffice for any platform where all - 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 - -#include - -#include -#include -#include - - -typedef struct sigcontext mcontext_t; - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -/* 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 */ diff --git a/sysdeps/i386/bits/ucontext.h b/sysdeps/i386/bits/ucontext.h new file mode 100644 index 0000000000..721878134c --- /dev/null +++ b/sysdeps/i386/bits/ucontext.h @@ -0,0 +1,138 @@ +/* Copyright (C) 1997-2020 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 + . */ + +/* System V/i386 ABI compliant context switching support. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + + +/* Type for general register. */ +typedef int greg_t; + +/* Number of general registers. */ +#define __NGREG 19 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_MISC +/* Number of each register is the `gregset_t' array. */ +enum +{ + REG_GS = 0, +# define REG_GS REG_GS + REG_FS, +# define REG_FS REG_FS + REG_ES, +# define REG_ES REG_ES + REG_DS, +# define REG_DS REG_DS + REG_EDI, +# define REG_EDI REG_EDI + REG_ESI, +# define REG_ESI REG_ESI + REG_EBP, +# define REG_EBP REG_EBP + REG_ESP, +# define REG_ESP REG_ESP + REG_EBX, +# define REG_EBX REG_EBX + REG_EDX, +# define REG_EDX REG_EDX + REG_ECX, +# define REG_ECX REG_ECX + REG_EAX, +# define REG_EAX REG_EAX + REG_TRAPNO, +# define REG_TRAPNO REG_TRAPNO + REG_ERR, +# define REG_ERR REG_ERR + REG_EIP, +# define REG_EIP REG_EIP + REG_CS, +# define REG_CS REG_CS + REG_EFL, +# define REG_EFL REG_EFL + REG_UESP, +# define REG_UESP REG_UESP + REG_SS +# define REG_SS REG_SS +}; +#endif + +#ifdef __USE_MISC +# define __ctx(fld) fld +# define __ctxt(tag) tag +#else +# define __ctx(fld) __ ## fld +# define __ctxt(tag) /* Empty. */ +#endif + +/* Structure to describe FPU registers. */ +typedef struct + { + union + { + struct __ctxt(fpchip_state) + { + int __ctx(state)[27]; + int __ctx(status); + } __ctx(fpchip_state); + + struct __ctxt(fp_emul_space) + { + char __ctx(fp_emul)[246]; + char __ctx(fp_epad)[2]; + } __ctx(fp_emul_space); + + int __ctx(f_fpregs)[62]; + } __ctx(fp_reg_set); + + long int __ctx(f_wregs)[33]; + } fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __ctx(gregs); + fpregset_t __ctx(fpregs); + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + long int __glibc_reserved1[5]; + } ucontext_t; + +#undef __ctx +#undef __ctxt + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/sys/ucontext.h deleted file mode 100644 index ee98042325..0000000000 --- a/sysdeps/i386/sys/ucontext.h +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (C) 1997-2020 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 - . */ - -/* System V/i386 ABI compliant context switching support. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - - -/* Type for general register. */ -typedef int greg_t; - -/* Number of general registers. */ -#define __NGREG 19 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_MISC -/* Number of each register is the `gregset_t' array. */ -enum -{ - REG_GS = 0, -# define REG_GS REG_GS - REG_FS, -# define REG_FS REG_FS - REG_ES, -# define REG_ES REG_ES - REG_DS, -# define REG_DS REG_DS - REG_EDI, -# define REG_EDI REG_EDI - REG_ESI, -# define REG_ESI REG_ESI - REG_EBP, -# define REG_EBP REG_EBP - REG_ESP, -# define REG_ESP REG_ESP - REG_EBX, -# define REG_EBX REG_EBX - REG_EDX, -# define REG_EDX REG_EDX - REG_ECX, -# define REG_ECX REG_ECX - REG_EAX, -# define REG_EAX REG_EAX - REG_TRAPNO, -# define REG_TRAPNO REG_TRAPNO - REG_ERR, -# define REG_ERR REG_ERR - REG_EIP, -# define REG_EIP REG_EIP - REG_CS, -# define REG_CS REG_CS - REG_EFL, -# define REG_EFL REG_EFL - REG_UESP, -# define REG_UESP REG_UESP - REG_SS -# define REG_SS REG_SS -}; -#endif - -#ifdef __USE_MISC -# define __ctx(fld) fld -# define __ctxt(tag) tag -#else -# define __ctx(fld) __ ## fld -# define __ctxt(tag) /* Empty. */ -#endif - -/* Structure to describe FPU registers. */ -typedef struct - { - union - { - struct __ctxt(fpchip_state) - { - int __ctx(state)[27]; - int __ctx(status); - } __ctx(fpchip_state); - - struct __ctxt(fp_emul_space) - { - char __ctx(fp_emul)[246]; - char __ctx(fp_epad)[2]; - } __ctx(fp_emul_space); - - int __ctx(f_fpregs)[62]; - } __ctx(fp_reg_set); - - long int __ctx(f_wregs)[33]; - } fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - gregset_t __ctx(gregs); - fpregset_t __ctx(fpregs); - } mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long int __ctx(uc_flags); - struct ucontext_t *uc_link; - sigset_t uc_sigmask; - stack_t uc_stack; - mcontext_t uc_mcontext; - long int __glibc_reserved1[5]; - } ucontext_t; - -#undef __ctx -#undef __ctxt - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/m68k/bits/ucontext.h b/sysdeps/m68k/bits/ucontext.h new file mode 100644 index 0000000000..6cf1e3647d --- /dev/null +++ b/sysdeps/m68k/bits/ucontext.h @@ -0,0 +1,125 @@ +/* Copyright (C) 1997-2020 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 + . */ + +/* System V/m68k ABI compliant context switching support. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + + +/* Type for general register. */ +typedef int greg_t; + +/* Number of general registers. */ +#define __NGREG 18 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_MISC +/* Number of each register is the `gregset_t' array. */ +enum +{ + R_D0 = 0, +# define R_D0 R_D0 + R_D1 = 1, +# define R_D1 R_D1 + R_D2 = 2, +# define R_D2 R_D2 + R_D3 = 3, +# define R_D3 R_D3 + R_D4 = 4, +# define R_D4 R_D4 + R_D5 = 5, +# define R_D5 R_D5 + R_D6 = 6, +# define R_D6 R_D6 + R_D7 = 7, +# define R_D7 R_D7 + R_A0 = 8, +# define R_A0 R_A0 + R_A1 = 9, +# define R_A1 R_A1 + R_A2 = 10, +# define R_A2 R_A2 + R_A3 = 11, +# define R_A3 R_A3 + R_A4 = 12, +# define R_A4 R_A4 + R_A5 = 13, +# define R_A5 R_A5 + R_A6 = 14, +# define R_A6 R_A6 + R_A7 = 15, +# define R_A7 R_A7 + R_SP = 15, +# define R_SP R_SP + R_PC = 16, +# define R_PC R_PC + R_PS = 17 +# define R_PS R_PS +}; + +/* Structure to describe FPU registers. */ +typedef struct +{ + int f_pcr; + int f_psr; + int f_fpiaddr; + int f_fpregs[8][3]; +} fpregset_t; +#endif + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* Context to describe whole processor state. */ +typedef struct +{ + int __ctx(version); + gregset_t __ctx(gregs); +} mcontext_t; + +#ifdef __USE_MISC +# define MCONTEXT_VERSION 1 +#endif + +/* Userlevel context. */ +typedef struct ucontext_t +{ + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + long int __glibc_reserved1[201]; +} ucontext_t; + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/m68k/sys/ucontext.h b/sysdeps/m68k/sys/ucontext.h deleted file mode 100644 index 48277ab823..0000000000 --- a/sysdeps/m68k/sys/ucontext.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright (C) 1997-2020 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 - . */ - -/* System V/m68k ABI compliant context switching support. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - - -/* Type for general register. */ -typedef int greg_t; - -/* Number of general registers. */ -#define __NGREG 18 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_MISC -/* Number of each register is the `gregset_t' array. */ -enum -{ - R_D0 = 0, -# define R_D0 R_D0 - R_D1 = 1, -# define R_D1 R_D1 - R_D2 = 2, -# define R_D2 R_D2 - R_D3 = 3, -# define R_D3 R_D3 - R_D4 = 4, -# define R_D4 R_D4 - R_D5 = 5, -# define R_D5 R_D5 - R_D6 = 6, -# define R_D6 R_D6 - R_D7 = 7, -# define R_D7 R_D7 - R_A0 = 8, -# define R_A0 R_A0 - R_A1 = 9, -# define R_A1 R_A1 - R_A2 = 10, -# define R_A2 R_A2 - R_A3 = 11, -# define R_A3 R_A3 - R_A4 = 12, -# define R_A4 R_A4 - R_A5 = 13, -# define R_A5 R_A5 - R_A6 = 14, -# define R_A6 R_A6 - R_A7 = 15, -# define R_A7 R_A7 - R_SP = 15, -# define R_SP R_SP - R_PC = 16, -# define R_PC R_PC - R_PS = 17 -# define R_PS R_PS -}; - -/* Structure to describe FPU registers. */ -typedef struct -{ - int f_pcr; - int f_psr; - int f_fpiaddr; - int f_fpregs[8][3]; -} fpregset_t; -#endif - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -/* Context to describe whole processor state. */ -typedef struct -{ - int __ctx(version); - gregset_t __ctx(gregs); -} mcontext_t; - -#ifdef __USE_MISC -# define MCONTEXT_VERSION 1 -#endif - -/* Userlevel context. */ -typedef struct ucontext_t -{ - unsigned long int __ctx(uc_flags); - struct ucontext_t *uc_link; - sigset_t uc_sigmask; - stack_t uc_stack; - mcontext_t uc_mcontext; - long int __glibc_reserved1[201]; -} ucontext_t; - -#undef __ctx - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/mips/bits/ucontext.h b/sysdeps/mips/bits/ucontext.h new file mode 100644 index 0000000000..2452926915 --- /dev/null +++ b/sysdeps/mips/bits/ucontext.h @@ -0,0 +1,176 @@ +/* Copyright (C) 1998-2020 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 + . */ + +/* System V/mips ABI compliant context switching support. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include +#include + +#include + + +/* Type for general register. */ +#if _MIPS_SIM == _ABIO32 +typedef __uint32_t greg_t; +#else +typedef __uint64_t greg_t; +#endif + +/* Number of general registers. */ +#define __NGREG 36 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_MISC +/* Number of each register is the `gregset_t' array. */ +enum +{ + CTX_R0 = 0, +# define CTX_R0 CTX_R0 + CTX_AT = 1, +# define CTX_AT CTX_AT + CTX_V0 = 2, +# define CTX_V0 CTX_V0 + CTX_V1 = 3, +# define CTX_V1 CTX_V1 + CTX_A0 = 4, +# define CTX_A0 CTX_A0 + CTX_A1 = 5, +# define CTX_A1 CTX_A1 + CTX_A2 = 6, +# define CTX_A2 CTX_A2 + CTX_A3 = 7, +# define CTX_A3 CTX_A3 + CTX_T0 = 8, +# define CTX_T0 CTX_T0 + CTX_T1 = 9, +# define CTX_T1 CTX_T1 + CTX_T2 = 10, +# define CTX_T2 CTX_T2 + CTX_T3 = 11, +# define CTX_T3 CTX_T3 + CTX_T4 = 12, +# define CTX_T4 CTX_T4 + CTX_T5 = 13, +# define CTX_T5 CTX_T5 + CTX_T6 = 14, +# define CTX_T6 CTX_T6 + CTX_T7 = 15, +# define CTX_T7 CTX_T7 + CTX_S0 = 16, +# define CTX_S0 CTX_S0 + CTX_S1 = 17, +# define CTX_S1 CTX_S1 + CTX_S2 = 18, +# define CTX_S2 CTX_S2 + CTX_S3 = 19, +# define CTX_S3 CTX_S3 + CTX_S4 = 20, +# define CTX_S4 CTX_S4 + CTX_S5 = 21, +# define CTX_S5 CTX_S5 + CTX_S6 = 22, +# define CTX_S6 CTX_S6 + CTX_S7 = 23, +# define CTX_S7 CTX_S7 + CTX_T8 = 24, +# define CTX_T8 CTX_T8 + CTX_T9 = 25, +# define CTX_T9 CTX_T9 + CTX_K0 = 26, +# define CTX_K0 CTX_K0 + CTX_K1 = 27, +# define CTX_K1 CTX_K1 + CTX_GP = 28, +# define CTX_GP CTX_GP + CTX_SP = 29, +# define CTX_SP CTX_SP + CTX_S8 = 30, +# define CTX_S8 CTX_S8 + CTX_RA = 31, +# define CTX_RA CTX_RA + CTX_MDLO = 32, +# define CTX_MDLO CTX_MDLO + CTX_MDHI = 33, +# define CTX_MDHI CTX_MDHI + CTX_CAUSE = 34, +# define CTX_CAUSE CTX_CAUSE + CTX_EPC = 35, +# define CTX_EPC CTX_EPC +}; +#endif + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* Structure to describe FPU registers. */ +typedef struct +{ + union + { +#if _MIPS_SIM == _ABIO32 + double __ctx(fp_dregs)[16]; + float __ctx(fp_fregs)[32]; + unsigned int __ctx(fp_regs)[32]; +#else + double __ctx(fp_dregs)[32]; + /* float __ctx(fp_fregs)[32]; */ + __uint64_t __ctx(fp_regs)[32]; +#endif + } __ctx(fp_r); + unsigned int __ctx(fp_csr); + unsigned int __ctx(fp_pad); +} fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct +{ + gregset_t __ctx(gpregs); + fpregset_t __ctx(fpregs); +} mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t +{ +#if _MIPS_SIM == _ABIO32 + unsigned long int __ctx(uc_flags); +#else + __uint64_t __ctx(uc_flags); +#endif + struct ucontext_t *uc_link; + sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + int __glibc_reserved1[48]; +} ucontext_t; + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/sys/ucontext.h deleted file mode 100644 index cdb3e8b3be..0000000000 --- a/sysdeps/mips/sys/ucontext.h +++ /dev/null @@ -1,176 +0,0 @@ -/* Copyright (C) 1998-2020 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 - . */ - -/* System V/mips ABI compliant context switching support. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include -#include - -#include - - -/* Type for general register. */ -#if _MIPS_SIM == _ABIO32 -typedef __uint32_t greg_t; -#else -typedef __uint64_t greg_t; -#endif - -/* Number of general registers. */ -#define __NGREG 36 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_MISC -/* Number of each register is the `gregset_t' array. */ -enum -{ - CTX_R0 = 0, -# define CTX_R0 CTX_R0 - CTX_AT = 1, -# define CTX_AT CTX_AT - CTX_V0 = 2, -# define CTX_V0 CTX_V0 - CTX_V1 = 3, -# define CTX_V1 CTX_V1 - CTX_A0 = 4, -# define CTX_A0 CTX_A0 - CTX_A1 = 5, -# define CTX_A1 CTX_A1 - CTX_A2 = 6, -# define CTX_A2 CTX_A2 - CTX_A3 = 7, -# define CTX_A3 CTX_A3 - CTX_T0 = 8, -# define CTX_T0 CTX_T0 - CTX_T1 = 9, -# define CTX_T1 CTX_T1 - CTX_T2 = 10, -# define CTX_T2 CTX_T2 - CTX_T3 = 11, -# define CTX_T3 CTX_T3 - CTX_T4 = 12, -# define CTX_T4 CTX_T4 - CTX_T5 = 13, -# define CTX_T5 CTX_T5 - CTX_T6 = 14, -# define CTX_T6 CTX_T6 - CTX_T7 = 15, -# define CTX_T7 CTX_T7 - CTX_S0 = 16, -# define CTX_S0 CTX_S0 - CTX_S1 = 17, -# define CTX_S1 CTX_S1 - CTX_S2 = 18, -# define CTX_S2 CTX_S2 - CTX_S3 = 19, -# define CTX_S3 CTX_S3 - CTX_S4 = 20, -# define CTX_S4 CTX_S4 - CTX_S5 = 21, -# define CTX_S5 CTX_S5 - CTX_S6 = 22, -# define CTX_S6 CTX_S6 - CTX_S7 = 23, -# define CTX_S7 CTX_S7 - CTX_T8 = 24, -# define CTX_T8 CTX_T8 - CTX_T9 = 25, -# define CTX_T9 CTX_T9 - CTX_K0 = 26, -# define CTX_K0 CTX_K0 - CTX_K1 = 27, -# define CTX_K1 CTX_K1 - CTX_GP = 28, -# define CTX_GP CTX_GP - CTX_SP = 29, -# define CTX_SP CTX_SP - CTX_S8 = 30, -# define CTX_S8 CTX_S8 - CTX_RA = 31, -# define CTX_RA CTX_RA - CTX_MDLO = 32, -# define CTX_MDLO CTX_MDLO - CTX_MDHI = 33, -# define CTX_MDHI CTX_MDHI - CTX_CAUSE = 34, -# define CTX_CAUSE CTX_CAUSE - CTX_EPC = 35, -# define CTX_EPC CTX_EPC -}; -#endif - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -/* Structure to describe FPU registers. */ -typedef struct -{ - union - { -#if _MIPS_SIM == _ABIO32 - double __ctx(fp_dregs)[16]; - float __ctx(fp_fregs)[32]; - unsigned int __ctx(fp_regs)[32]; -#else - double __ctx(fp_dregs)[32]; - /* float __ctx(fp_fregs)[32]; */ - __uint64_t __ctx(fp_regs)[32]; -#endif - } __ctx(fp_r); - unsigned int __ctx(fp_csr); - unsigned int __ctx(fp_pad); -} fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct -{ - gregset_t __ctx(gpregs); - fpregset_t __ctx(fpregs); -} mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t -{ -#if _MIPS_SIM == _ABIO32 - unsigned long int __ctx(uc_flags); -#else - __uint64_t __ctx(uc_flags); -#endif - struct ucontext_t *uc_link; - sigset_t uc_sigmask; - stack_t uc_stack; - mcontext_t uc_mcontext; - int __glibc_reserved1[48]; -} ucontext_t; - -#undef __ctx - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h b/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h index 51571cddaa..a30263d826 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/procfs.h @@ -20,11 +20,12 @@ #ifndef _BITS_PROCFS_H #define _BITS_PROCFS_H 1 -#ifndef _SYS_PROCFS_H +#if !defined _SYS_PROCFS_H && !defined _BITS_UCONTEXT_H # error "Never include directly; use instead." #endif #include +#include /* Type for a general-purpose register. */ typedef __uint64_t elf_greg_t; diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h new file mode 100644 index 0000000000..b790a6c085 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/bits/ucontext.h @@ -0,0 +1,78 @@ +/* Copyright (C) 1998-2020 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 + . */ + +/* System V/AArch64 ABI compliant context switching support. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +#ifdef __USE_MISC +# include + + +typedef elf_greg_t greg_t; + +/* Container for all general registers. */ +typedef elf_gregset_t gregset_t; + +/* Structure to describe FPU registers. */ +typedef elf_fpregset_t fpregset_t; +#endif + +/* Context to describe whole processor state. This only describes + 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 + { + 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); + /* This field contains extension records for additional processor + state such as the FP/SIMD state. It has to match the definition + of the corresponding field in the sigcontext struct, see the + arch/arm64/include/uapi/asm/sigcontext.h linux header for details. */ + unsigned char __reserved[4096] __attribute__ ((__aligned__ (16))); + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long __ctx(uc_flags); + struct ucontext_t *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + mcontext_t uc_mcontext; + } ucontext_t; + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h index 6af928fc22..52c3fd6d31 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h @@ -20,7 +20,7 @@ #define _SIGCONTEXTINFO_H #include -#include +#include static inline uintptr_t sigcontext_get_pc (const ucontext_t *ctx) diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h deleted file mode 100644 index 5699c0caf9..0000000000 --- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (C) 1998-2020 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 - . */ - -/* System V/AArch64 ABI compliant context switching support. */ - -#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 - -#ifdef __USE_MISC -# include - - -typedef elf_greg_t greg_t; - -/* Container for all general registers. */ -typedef elf_gregset_t gregset_t; - -/* Structure to describe FPU registers. */ -typedef elf_fpregset_t fpregset_t; -#endif - -/* Context to describe whole processor state. This only describes - 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 - { - 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); - /* This field contains extension records for additional processor - state such as the FP/SIMD state. It has to match the definition - of the corresponding field in the sigcontext struct, see the - arch/arm64/include/uapi/asm/sigcontext.h linux header for details. */ - unsigned char __reserved[4096] __attribute__ ((__aligned__ (16))); - } mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long __ctx(uc_flags); - struct ucontext_t *uc_link; - stack_t uc_stack; - sigset_t uc_sigmask; - 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 ab3930c173..7d5c4a1117 100644 --- a/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/aarch64/ucontext_i.sym @@ -1,8 +1,5 @@ -#include -#include #include -#include -#include +#include #include "kernel_rt_sigframe.h" diff --git a/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h b/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h index cc74865377..f62df7dadf 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/procfs-prregset.h @@ -25,8 +25,8 @@ #endif /* For gregset_t and fpregset_t. FIXME: sys/procfs.h should not - expose all of sys/ucontext.h. */ -#include + expose all of bits/ucontext.h. */ +#include typedef gregset_t __prgregset_t; typedef fpregset_t __prfpregset_t; diff --git a/sysdeps/unix/sysv/linux/alpha/bits/ucontext.h b/sysdeps/unix/sysv/linux/alpha/bits/ucontext.h new file mode 100644 index 0000000000..12b23f01de --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/bits/ucontext.h @@ -0,0 +1,94 @@ +/* Copyright (C) 1998-2020 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 _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#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; + +/* Number of general registers. */ +#define __NGREG 33 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +/* Type for floating-point register. */ +typedef long int fpreg_t; + +/* Number of general registers. */ +#define __NFPREG 32 +#ifdef __USE_MISC +# define NFPREG __NFPREG +#endif + +/* Container for all general registers. */ +typedef fpreg_t fpregset_t[__NFPREG]; + + +/* A machine context is exactly a sigcontext. */ +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 + { + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + unsigned long __uc_osf_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + } ucontext_t; + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h b/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h deleted file mode 100644 index c997cb03d3..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/sys/ucontext.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (C) 1998-2020 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 - -/* Type for general register. */ -typedef long int greg_t; - -/* Number of general registers. */ -#define __NGREG 33 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -/* Type for floating-point register. */ -typedef long int fpreg_t; - -/* Number of general registers. */ -#define __NFPREG 32 -#ifdef __USE_MISC -# define NFPREG __NFPREG -#endif - -/* Container for all general registers. */ -typedef fpreg_t fpregset_t[__NFPREG]; - - -/* A machine context is exactly a sigcontext. */ -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 - { - unsigned long int __ctx(uc_flags); - struct ucontext_t *uc_link; - unsigned long __uc_osf_sigmask; - 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/alpha/ucontext-offsets.sym b/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym index 9e86f8a7ca..f57c779f5b 100644 --- a/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym +++ b/sysdeps/unix/sysv/linux/alpha/ucontext-offsets.sym @@ -1,5 +1,5 @@ #include -#include +#include -- UC_LINK offsetof (ucontext_t, uc_link) diff --git a/sysdeps/unix/sysv/linux/arm/bits/ucontext.h b/sysdeps/unix/sysv/linux/arm/bits/ucontext.h new file mode 100644 index 0000000000..81371ca4d0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/arm/bits/ucontext.h @@ -0,0 +1,144 @@ +/* Copyright (C) 1998-2020 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 + . */ + +/* System V/ARM ABI compliant context switching support. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#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. */ +# define NGREG 18 + +/* Container for all general registers. */ +typedef greg_t gregset_t[NGREG]; + +/* Number of each register is the `gregset_t' array. */ +enum +{ + REG_R0 = 0, +# define REG_R0 REG_R0 + REG_R1 = 1, +# define REG_R1 REG_R1 + REG_R2 = 2, +# define REG_R2 REG_R2 + REG_R3 = 3, +# define REG_R3 REG_R3 + REG_R4 = 4, +# define REG_R4 REG_R4 + REG_R5 = 5, +# define REG_R5 REG_R5 + REG_R6 = 6, +# define REG_R6 REG_R6 + REG_R7 = 7, +# define REG_R7 REG_R7 + REG_R8 = 8, +# define REG_R8 REG_R8 + REG_R9 = 9, +# define REG_R9 REG_R9 + REG_R10 = 10, +# define REG_R10 REG_R10 + REG_R11 = 11, +# define REG_R11 REG_R11 + REG_R12 = 12, +# define REG_R12 REG_R12 + REG_R13 = 13, +# define REG_R13 REG_R13 + REG_R14 = 14, +# define REG_R14 REG_R14 + REG_R15 = 15 +# define REG_R15 REG_R15 +}; + +struct _libc_fpstate +{ + struct + { + unsigned int sign1:1; + unsigned int unused:15; + unsigned int sign2:1; + unsigned int exponent:14; + unsigned int j:1; + unsigned int mantissa1:31; + unsigned int mantissa0:32; + } fpregs[8]; + unsigned int fpsr:32; + unsigned int fpcr:32; + unsigned char ftype[8]; + unsigned int init_flag; +}; +/* Structure to describe FPU registers. */ +typedef struct _libc_fpstate fpregset_t; +#endif + +/* Context to describe whole processor state. This only describes + 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 + { + 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 + { + unsigned long __ctx(uc_flags); + struct ucontext_t *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + sigset_t uc_sigmask; + unsigned long __ctx(uc_regspace)[128] __attribute__((__aligned__(8))); + } ucontext_t; + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/arm/register-dump.h b/sysdeps/unix/sysv/linux/arm/register-dump.h index 26c6e57982..11e5be7e0b 100644 --- a/sysdeps/unix/sysv/linux/arm/register-dump.h +++ b/sysdeps/unix/sysv/linux/arm/register-dump.h @@ -19,7 +19,7 @@ #include #include <_itoa.h> -#include +#include /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h b/sysdeps/unix/sysv/linux/arm/sys/ucontext.h deleted file mode 100644 index d6934affeb..0000000000 --- a/sysdeps/unix/sysv/linux/arm/sys/ucontext.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright (C) 1998-2020 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 - . */ - -/* System V/ARM ABI compliant context switching support. */ - -#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 - -#ifdef __USE_MISC -typedef int greg_t; - -/* Number of general registers. */ -# define NGREG 18 - -/* Container for all general registers. */ -typedef greg_t gregset_t[NGREG]; - -/* Number of each register is the `gregset_t' array. */ -enum -{ - REG_R0 = 0, -# define REG_R0 REG_R0 - REG_R1 = 1, -# define REG_R1 REG_R1 - REG_R2 = 2, -# define REG_R2 REG_R2 - REG_R3 = 3, -# define REG_R3 REG_R3 - REG_R4 = 4, -# define REG_R4 REG_R4 - REG_R5 = 5, -# define REG_R5 REG_R5 - REG_R6 = 6, -# define REG_R6 REG_R6 - REG_R7 = 7, -# define REG_R7 REG_R7 - REG_R8 = 8, -# define REG_R8 REG_R8 - REG_R9 = 9, -# define REG_R9 REG_R9 - REG_R10 = 10, -# define REG_R10 REG_R10 - REG_R11 = 11, -# define REG_R11 REG_R11 - REG_R12 = 12, -# define REG_R12 REG_R12 - REG_R13 = 13, -# define REG_R13 REG_R13 - REG_R14 = 14, -# define REG_R14 REG_R14 - REG_R15 = 15 -# define REG_R15 REG_R15 -}; - -struct _libc_fpstate -{ - struct - { - unsigned int sign1:1; - unsigned int unused:15; - unsigned int sign2:1; - unsigned int exponent:14; - unsigned int j:1; - unsigned int mantissa1:31; - unsigned int mantissa0:32; - } fpregs[8]; - unsigned int fpsr:32; - unsigned int fpcr:32; - unsigned char ftype[8]; - unsigned int init_flag; -}; -/* Structure to describe FPU registers. */ -typedef struct _libc_fpstate fpregset_t; -#endif - -/* Context to describe whole processor state. This only describes - 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 - { - 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 - { - unsigned long __ctx(uc_flags); - struct ucontext_t *uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - sigset_t uc_sigmask; - unsigned long __ctx(uc_regspace)[128] __attribute__((__aligned__(8))); - } ucontext_t; - -#undef __ctx - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/arm/ucontext_i.sym b/sysdeps/unix/sysv/linux/arm/ucontext_i.sym index 306292f1f8..ccf555d2ab 100644 --- a/sysdeps/unix/sysv/linux/arm/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/arm/ucontext_i.sym @@ -1,7 +1,5 @@ -#include -#include #include -#include +#include SIG_BLOCK SIG_SETMASK diff --git a/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym b/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym index 4581b65e49..0ee6dd0584 100644 --- a/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/csky/abiv2/ucontext_i.sym @@ -1,7 +1,5 @@ -#include -#include #include -#include +#include SIG_BLOCK SIG_SETMASK diff --git a/sysdeps/unix/sysv/linux/csky/bits/ucontext.h b/sysdeps/unix/sysv/linux/csky/bits/ucontext.h new file mode 100644 index 0000000000..cf3b0bfcfc --- /dev/null +++ b/sysdeps/unix/sysv/linux/csky/bits/ucontext.h @@ -0,0 +1,89 @@ +/* struct ucontext definition, C-SKY version. + Copyright (C) 2018-2020 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 _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + +typedef struct + { + unsigned long __tls; + unsigned long __lr; + unsigned long __pc; + unsigned long __sr; + unsigned long __usp; + + /* + * a0, a1, a2, a3: + * abiv1: r2, r3, r4, r5 + * abiv2: r0, r1, r2, r3 + */ + + unsigned long __orig_a0; + unsigned long __a0; + unsigned long __a1; + unsigned long __a2; + unsigned long __a3; + + /* + * ABIV2: r4 ~ r13 + */ + unsigned long __regs[10]; + + /* r16 ~ r30 */ + unsigned long __exregs[15]; + + unsigned long __rhi; + unsigned long __rlo; + unsigned long __glibc_reserved; + } gregset_t; + +typedef struct + { + unsigned long __vr[64]; + unsigned long __fcr; + unsigned long __fesr; + unsigned long __fid; + unsigned long __glibc_reserved; + } fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __gregs; + fpregset_t __fpregs; + } 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 /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/csky/register-dump.h b/sysdeps/unix/sysv/linux/csky/register-dump.h index f81ed09531..a4cc5d48f6 100644 --- a/sysdeps/unix/sysv/linux/csky/register-dump.h +++ b/sysdeps/unix/sysv/linux/csky/register-dump.h @@ -19,7 +19,7 @@ #include #include <_itoa.h> #include -#include +#include /* abiv1 register dump in this format: diff --git a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h b/sysdeps/unix/sysv/linux/csky/sys/ucontext.h deleted file mode 100644 index 7f932aac0e..0000000000 --- a/sysdeps/unix/sysv/linux/csky/sys/ucontext.h +++ /dev/null @@ -1,89 +0,0 @@ -/* struct ucontext definition, C-SKY version. - Copyright (C) 2018-2020 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 - -typedef struct - { - unsigned long __tls; - unsigned long __lr; - unsigned long __pc; - unsigned long __sr; - unsigned long __usp; - - /* - * a0, a1, a2, a3: - * abiv1: r2, r3, r4, r5 - * abiv2: r0, r1, r2, r3 - */ - - unsigned long __orig_a0; - unsigned long __a0; - unsigned long __a1; - unsigned long __a2; - unsigned long __a3; - - /* - * ABIV2: r4 ~ r13 - */ - unsigned long __regs[10]; - - /* r16 ~ r30 */ - unsigned long __exregs[15]; - - unsigned long __rhi; - unsigned long __rlo; - unsigned long __glibc_reserved; - } gregset_t; - -typedef struct - { - unsigned long __vr[64]; - unsigned long __fcr; - unsigned long __fesr; - unsigned long __fid; - unsigned long __glibc_reserved; - } fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - gregset_t __gregs; - fpregset_t __fpregs; - } 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/hppa/bits/ucontext.h b/sysdeps/unix/sysv/linux/hppa/bits/ucontext.h new file mode 100644 index 0000000000..1d65187dbb --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/bits/ucontext.h @@ -0,0 +1,82 @@ +/* Copyright (C) 1997-2020 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 + . */ + +/* Don't rely on this, the interface is currently messed up and may need to + be broken to be fixed. */ +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#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; + +/* Number of general registers. */ +# define NGREG 80 +# define NFPREG 32 + +/* Container for all general registers. */ +typedef struct gregset + { + greg_t g_regs[32]; + greg_t sr_regs[8]; + greg_t cr_regs[24]; + greg_t g_pad[16]; + } gregset_t; + +/* Container for all FPU registers. */ +typedef struct + { + double fp_dregs[32]; + } fpregset_t; +#endif + +/* Context to describe whole processor state. */ +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 + { + 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 /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h b/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h deleted file mode 100644 index 4fdd9e29ca..0000000000 --- a/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 1997-2020 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 - . */ - -/* Don't rely on this, the interface is currently messed up and may need to - be broken to be fixed. */ -#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 - -#ifdef __USE_MISC -/* Type for general register. */ -typedef unsigned long int greg_t; - -/* Number of general registers. */ -# define NGREG 80 -# define NFPREG 32 - -/* Container for all general registers. */ -typedef struct gregset - { - greg_t g_regs[32]; - greg_t sr_regs[8]; - greg_t cr_regs[24]; - greg_t g_pad[16]; - } gregset_t; - -/* Container for all FPU registers. */ -typedef struct - { - double fp_dregs[32]; - } fpregset_t; -#endif - -/* Context to describe whole processor state. */ -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 - { - 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 */ diff --git a/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym b/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym index ee33029a07..1ec474c759 100644 --- a/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/hppa/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym index b11a5509cd..79d95709f2 100644 --- a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/ia64/Makefile b/sysdeps/unix/sysv/linux/ia64/Makefile index 97fc7df0b1..36240a6057 100644 --- a/sysdeps/unix/sysv/linux/ia64/Makefile +++ b/sysdeps/unix/sysv/linux/ia64/Makefile @@ -1,5 +1,5 @@ -ifeq ($(subdir),misc) -sysdep_headers += sys/rse.h +ifeq ($(subdir),signal) +sysdep_headers += bits/types/__ia64_fpreg.h endif ifeq ($(subdir),stdlib) @@ -8,7 +8,7 @@ gen-as-const-headers += sigcontext-offsets.sym endif ifeq ($(subdir),misc) -sysdep_headers += sys/io.h +sysdep_headers += sys/io.h sys/rse.h sysdep_routines += ioperm clone2 gen-as-const-headers += sigaltstack-offsets.sym endif diff --git a/sysdeps/unix/sysv/linux/ia64/bits/procfs.h b/sysdeps/unix/sysv/linux/ia64/bits/procfs.h index 45d553c16f..8351f2394d 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/procfs.h @@ -23,10 +23,7 @@ # error "Never include directly; use instead." #endif -/* For struct __ia64_fpreg. FIXME: sys/procfs.h should not expose all - of sys/ucontext.h. */ -#include -#include +#include /* We really need just 72 but let's leave some headroom... */ #define ELF_NGREG 128 diff --git a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h index 252eff321c..eac745fc80 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h @@ -26,17 +26,10 @@ #include #include #include +#include #include #include -struct __ia64_fpreg - { - union - { - unsigned long bits[2]; - } u; - } __attribute__ ((__aligned__ (16))); - struct sigcontext { unsigned long int sc_flags; /* see manifest constants below */ diff --git a/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h b/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h new file mode 100644 index 0000000000..6d69586ab4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h @@ -0,0 +1,22 @@ +#ifndef ____ia64_fpreg_defined +#define ____ia64_fpreg_defined + +#include + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +struct __ia64_fpreg + { + union + { + unsigned long __ctx(bits)[2]; + } __ctx(u); + } __attribute__ ((__aligned__ (16))); + +#undef __ctx + +#endif /* __ia64_fpreg */ diff --git a/sysdeps/unix/sysv/linux/ia64/bits/ucontext.h b/sysdeps/unix/sysv/linux/ia64/bits/ucontext.h new file mode 100644 index 0000000000..ce1503368d --- /dev/null +++ b/sysdeps/unix/sysv/linux/ia64/bits/ucontext.h @@ -0,0 +1,98 @@ +/* Copyright (C) 1998-2020 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 _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#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 "mcontext_t" and + * "ucontext_t" as all the necessary info is inside the former. + */ + +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 __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 (mcontext_t, __ctx(sc_gr)[0]) +#elif defined __GNUC__ +# define _SC_GR0_OFFSET \ + (((char *) &((mcontext_t *) 0)->__ctx(sc_gr)[0]) - (char *) 0) +#else +# define _SC_GR0_OFFSET 0xc8 /* pray that this is correct... */ +#endif + +typedef struct ucontext_t + { + union + { + mcontext_t _mc; + struct + { + unsigned long _pad[_SC_GR0_OFFSET/8]; + struct ucontext_t *_link; /* this should overlay sc_gr[0] */ + } + _uc; + } + _u; + } +ucontext_t; + +#define uc_mcontext _u._mc +#define uc_sigmask _u._mc.__ctx(sc_mask) +#define uc_stack _u._mc.__ctx(sc_stack) +#define uc_link _u._uc._link + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym b/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym index ac3e3c8dea..46459f7ad0 100644 --- a/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym +++ b/sysdeps/unix/sysv/linux/ia64/sigcontext-offsets.sym @@ -1,5 +1,5 @@ #include -#include +#include -- SC_NAT offsetof (mcontext_t, sc_nat) diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h index b5e2de09ec..260a385e77 100644 --- a/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/ia64/sys/ptrace.h @@ -20,9 +20,8 @@ #define _SYS_PTRACE_H 1 #include -#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 deleted file mode 100644 index c88e880219..0000000000 --- a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (C) 1998-2020 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 - -/* - * These are here mostly for backwards compatibility with older Unices. - * IA-64 Linux does not distinguish between "mcontext_t" and - * "ucontext_t" as all the necessary info is inside the former. - */ - -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 (mcontext_t, __ctx(sc_gr)[0]) -#elif defined __GNUC__ -# define _SC_GR0_OFFSET \ - (((char *) &((mcontext_t *) 0)->__ctx(sc_gr)[0]) - (char *) 0) -#else -# define _SC_GR0_OFFSET 0xc8 /* pray that this is correct... */ -#endif - -typedef struct ucontext_t - { - union - { - mcontext_t _mc; - struct - { - unsigned long _pad[_SC_GR0_OFFSET/8]; - struct ucontext_t *_link; /* this should overlay sc_gr[0] */ - } - _uc; - } - _u; - } -ucontext_t; - -#define uc_mcontext _u._mc -#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/bits/ucontext.h b/sysdeps/unix/sysv/linux/m68k/bits/ucontext.h new file mode 100644 index 0000000000..9b8106890d --- /dev/null +++ b/sysdeps/unix/sysv/linux/m68k/bits/ucontext.h @@ -0,0 +1,130 @@ +/* Copyright (C) 1997-2020 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 + . */ + +/* System V/m68k ABI compliant context switching support. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + + +/* Type for general register. */ +typedef int greg_t; + +/* Number of general registers. */ +#define __NGREG 18 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_MISC +/* Number of each register is the `gregset_t' array. */ +enum +{ + R_D0 = 0, +# define R_D0 R_D0 + R_D1 = 1, +# define R_D1 R_D1 + R_D2 = 2, +# define R_D2 R_D2 + R_D3 = 3, +# define R_D3 R_D3 + R_D4 = 4, +# define R_D4 R_D4 + R_D5 = 5, +# define R_D5 R_D5 + R_D6 = 6, +# define R_D6 R_D6 + R_D7 = 7, +# define R_D7 R_D7 + R_A0 = 8, +# define R_A0 R_A0 + R_A1 = 9, +# define R_A1 R_A1 + R_A2 = 10, +# define R_A2 R_A2 + R_A3 = 11, +# define R_A3 R_A3 + R_A4 = 12, +# define R_A4 R_A4 + R_A5 = 13, +# define R_A5 R_A5 + R_A6 = 14, +# define R_A6 R_A6 + R_A7 = 15, +# define R_A7 R_A7 + R_SP = 15, +# define R_SP R_SP + R_PC = 16, +# define R_PC R_PC + R_PS = 17 +# define R_PS R_PS +}; +#endif + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* Structure to describe FPU registers. */ +typedef struct +{ + int __ctx(f_pcr); + int __ctx(f_psr); + int __ctx(f_fpiaddr); +#ifdef __mcoldfire__ + int __ctx(f_fpregs)[8][2]; +#else + int __ctx(f_fpregs)[8][3]; +#endif +} fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct +{ + int __ctx(version); + gregset_t __ctx(gregs); + fpregset_t __ctx(fpregs); +} mcontext_t; + +#ifdef __USE_MISC +# define MCONTEXT_VERSION 2 +#endif + +/* Userlevel context. */ +typedef struct ucontext_t +{ + unsigned long __ctx(uc_flags); + struct ucontext_t *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + unsigned long __glibc_reserved1[80]; + sigset_t uc_sigmask; +} ucontext_t; + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym b/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym index 46bd4bf15f..400c57b7f3 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h b/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h deleted file mode 100644 index c9950b55c6..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/sys/ucontext.h +++ /dev/null @@ -1,130 +0,0 @@ -/* Copyright (C) 1997-2020 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 - . */ - -/* System V/m68k ABI compliant context switching support. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - - -/* Type for general register. */ -typedef int greg_t; - -/* Number of general registers. */ -#define __NGREG 18 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_MISC -/* Number of each register is the `gregset_t' array. */ -enum -{ - R_D0 = 0, -# define R_D0 R_D0 - R_D1 = 1, -# define R_D1 R_D1 - R_D2 = 2, -# define R_D2 R_D2 - R_D3 = 3, -# define R_D3 R_D3 - R_D4 = 4, -# define R_D4 R_D4 - R_D5 = 5, -# define R_D5 R_D5 - R_D6 = 6, -# define R_D6 R_D6 - R_D7 = 7, -# define R_D7 R_D7 - R_A0 = 8, -# define R_A0 R_A0 - R_A1 = 9, -# define R_A1 R_A1 - R_A2 = 10, -# define R_A2 R_A2 - R_A3 = 11, -# define R_A3 R_A3 - R_A4 = 12, -# define R_A4 R_A4 - R_A5 = 13, -# define R_A5 R_A5 - R_A6 = 14, -# define R_A6 R_A6 - R_A7 = 15, -# define R_A7 R_A7 - R_SP = 15, -# define R_SP R_SP - R_PC = 16, -# define R_PC R_PC - R_PS = 17 -# define R_PS R_PS -}; -#endif - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -/* Structure to describe FPU registers. */ -typedef struct -{ - int __ctx(f_pcr); - int __ctx(f_psr); - int __ctx(f_fpiaddr); -#ifdef __mcoldfire__ - int __ctx(f_fpregs)[8][2]; -#else - int __ctx(f_fpregs)[8][3]; -#endif -} fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct -{ - int __ctx(version); - gregset_t __ctx(gregs); - fpregset_t __ctx(fpregs); -} mcontext_t; - -#ifdef __USE_MISC -# define MCONTEXT_VERSION 2 -#endif - -/* Userlevel context. */ -typedef struct ucontext_t -{ - unsigned long __ctx(uc_flags); - struct ucontext_t *uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - unsigned long __glibc_reserved1[80]; - sigset_t uc_sigmask; -} ucontext_t; - -#undef __ctx - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h b/sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h new file mode 100644 index 0000000000..c81850e2b7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/microblaze/bits/ucontext.h @@ -0,0 +1,92 @@ +/* Data structures for user-level context switching. MicroBlaze version. + Copyright (C) 1997-2020 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 _BITS_UCONTEXT_H +#define _BITS_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 __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 /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h b/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h deleted file mode 100644 index d1c16c21e0..0000000000 --- a/sysdeps/unix/sysv/linux/microblaze/sys/ucontext.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Data structures for user-level context switching. MicroBlaze version. - Copyright (C) 1997-2020 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 __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 */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/ucontext.h b/sysdeps/unix/sysv/linux/mips/bits/ucontext.h new file mode 100644 index 0000000000..2f4d9d786b --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/bits/ucontext.h @@ -0,0 +1,124 @@ +/* Copyright (C) 1997-2020 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 + . */ + +/* Don't rely on this, the interface is currently messed up and may need to + be broken to be fixed. */ +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + +#include + + +/* Type for general register. Even in o32 we assume 64-bit registers, + like the kernel. */ +__extension__ typedef unsigned long long int greg_t; + +/* Number of general registers. */ +#define __NGREG 32 +#define __NFPREG 32 +#ifdef __USE_MISC +# define NGREG __NGREG +# define NFPREG __NFPREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* Container for all FPU registers. */ +typedef struct { + union { + double __ctx(fp_dregs)[__NFPREG]; + struct { + float _fp_fregs; + unsigned int _fp_pad; + } __ctx(fp_fregs)[__NFPREG]; + } __ctx(fp_r); +} fpregset_t; + + +/* Context to describe whole processor state. */ +#if _MIPS_SIM == _ABIO32 +/* Earlier versions of glibc for mips had an entirely different + definition of mcontext_t, that didn't even resemble the + corresponding kernel data structure. Fortunately, makecontext, + [gs]etcontext et all were not implemented back then, so this can + still be rectified. */ +typedef struct + { + unsigned int __ctx(regmask); + unsigned int __ctx(status); + greg_t __ctx(pc); + gregset_t __ctx(gregs); + fpregset_t __ctx(fpregs); + unsigned int __ctx(fp_owned); + unsigned int __ctx(fpc_csr); + unsigned int __ctx(fpc_eir); + unsigned int __ctx(used_math); + unsigned int __ctx(dsp); + greg_t __ctx(mdhi); + greg_t __ctx(mdlo); + unsigned long __ctx(hi1); + unsigned long __ctx(lo1); + unsigned long __ctx(hi2); + unsigned long __ctx(lo2); + unsigned long __ctx(hi3); + unsigned long __ctx(lo3); + } mcontext_t; +#else +typedef struct + { + gregset_t __ctx(gregs); + fpregset_t __ctx(fpregs); + greg_t __ctx(mdhi); + greg_t __ctx(hi1); + greg_t __ctx(hi2); + greg_t __ctx(hi3); + greg_t __ctx(mdlo); + greg_t __ctx(lo1); + greg_t __ctx(lo2); + greg_t __ctx(lo3); + greg_t __ctx(pc); + unsigned int __ctx(fpc_csr); + unsigned int __ctx(used_math); + unsigned int __ctx(dsp); + unsigned int __glibc_reserved1; + } mcontext_t; +#endif + +/* 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 /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h b/sysdeps/unix/sysv/linux/mips/sys/ucontext.h deleted file mode 100644 index 5bbc8a63b9..0000000000 --- a/sysdeps/unix/sysv/linux/mips/sys/ucontext.h +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright (C) 1997-2020 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 - . */ - -/* Don't rely on this, the interface is currently messed up and may need to - be broken to be fixed. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - -#include - - -/* Type for general register. Even in o32 we assume 64-bit registers, - like the kernel. */ -__extension__ typedef unsigned long long int greg_t; - -/* Number of general registers. */ -#define __NGREG 32 -#define __NFPREG 32 -#ifdef __USE_MISC -# define NGREG __NGREG -# define NFPREG __NFPREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -/* Container for all FPU registers. */ -typedef struct { - union { - double __ctx(fp_dregs)[__NFPREG]; - struct { - float _fp_fregs; - unsigned int _fp_pad; - } __ctx(fp_fregs)[__NFPREG]; - } __ctx(fp_r); -} fpregset_t; - - -/* Context to describe whole processor state. */ -#if _MIPS_SIM == _ABIO32 -/* Earlier versions of glibc for mips had an entirely different - definition of mcontext_t, that didn't even resemble the - corresponding kernel data structure. Fortunately, makecontext, - [gs]etcontext et all were not implemented back then, so this can - still be rectified. */ -typedef struct - { - unsigned int __ctx(regmask); - unsigned int __ctx(status); - greg_t __ctx(pc); - gregset_t __ctx(gregs); - fpregset_t __ctx(fpregs); - unsigned int __ctx(fp_owned); - unsigned int __ctx(fpc_csr); - unsigned int __ctx(fpc_eir); - unsigned int __ctx(used_math); - unsigned int __ctx(dsp); - greg_t __ctx(mdhi); - greg_t __ctx(mdlo); - unsigned long __ctx(hi1); - unsigned long __ctx(lo1); - unsigned long __ctx(hi2); - unsigned long __ctx(lo2); - unsigned long __ctx(hi3); - unsigned long __ctx(lo3); - } mcontext_t; -#else -typedef struct - { - gregset_t __ctx(gregs); - fpregset_t __ctx(fpregs); - greg_t __ctx(mdhi); - greg_t __ctx(hi1); - greg_t __ctx(hi2); - greg_t __ctx(hi3); - greg_t __ctx(mdlo); - greg_t __ctx(lo1); - greg_t __ctx(lo2); - greg_t __ctx(lo3); - greg_t __ctx(pc); - unsigned int __ctx(fpc_csr); - unsigned int __ctx(used_math); - unsigned int __ctx(dsp); - unsigned int __glibc_reserved1; - } mcontext_t; -#endif - -/* 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 */ diff --git a/sysdeps/unix/sysv/linux/mips/ucontext_i.sym b/sysdeps/unix/sysv/linux/mips/ucontext_i.sym index f14b886407..d9692adcba 100644 --- a/sysdeps/unix/sysv/linux/mips/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/mips/ucontext_i.sym @@ -1,7 +1,5 @@ -#include #include #include -#include #include diff --git a/sysdeps/unix/sysv/linux/nios2/bits/ucontext.h b/sysdeps/unix/sysv/linux/nios2/bits/ucontext.h new file mode 100644 index 0000000000..5be92444e6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/nios2/bits/ucontext.h @@ -0,0 +1,61 @@ +/* ucontext_t definition, Nios II version. + Copyright (C) 2015-2020 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 + . */ + +/* System V/Nios II ABI compliant context switching support. */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + + +/* These definitions must be in sync with the kernel. */ + +#ifdef __USE_MISC +# define MCONTEXT_VERSION 2 +#endif + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* Context to describe whole processor state. */ +typedef struct + { + int __ctx(version); + unsigned long __ctx(regs)[32]; + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long __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 /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h b/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h deleted file mode 100644 index 276fb209c0..0000000000 --- a/sysdeps/unix/sysv/linux/nios2/sys/ucontext.h +++ /dev/null @@ -1,61 +0,0 @@ -/* ucontext_t definition, Nios II version. - Copyright (C) 2015-2020 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 - . */ - -/* System V/Nios II ABI compliant context switching support. */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - - -/* These definitions must be in sync with the kernel. */ - -#ifdef __USE_MISC -# define MCONTEXT_VERSION 2 -#endif - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -/* Context to describe whole processor state. */ -typedef struct - { - int __ctx(version); - unsigned long __ctx(regs)[32]; - } mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long __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 */ diff --git a/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym b/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym index a844c96796..5455cdb681 100644 --- a/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/nios2/ucontext_i.sym @@ -1,7 +1,5 @@ -#include #include #include -#include #include "kernel_rt_sigframe.h" diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h new file mode 100644 index 0000000000..9fbd0ad53f --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/bits/ucontext.h @@ -0,0 +1,200 @@ +/* Copyright (C) 1998-2020 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 _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +struct __ctx(pt_regs); + +#if __WORDSIZE == 32 + +/* Number of general registers. */ +# define __NGREG 48 +# ifdef __USE_MISC +# define NGREG __NGREG +# endif + +/* Container for all general registers. */ +typedef unsigned long gregset_t[__NGREG]; + +/* Container for floating-point registers and status */ +typedef struct _libc_fpstate +{ + double __ctx(fpregs)[32]; + double __ctx(fpscr); + unsigned int _pad[2]; +} fpregset_t; + +/* Container for Altivec/VMX registers and status. + Needs to be aligned on a 16-byte boundary. */ +typedef struct _libc_vrstate +{ + unsigned int __ctx(vrregs)[32][4]; + unsigned int __ctx(vrsave); + unsigned int _pad[2]; + unsigned int __ctx(vscr); +} vrregset_t; + +/* Context to describe whole processor state. */ +typedef struct +{ + gregset_t __ctx(gregs); + fpregset_t __ctx(fpregs); + vrregset_t __ctx(vrregs) __attribute__((__aligned__(16))); +} mcontext_t; + +#else + +/* For 64-bit kernels with Altivec support, a machine context is exactly + * a sigcontext. For older kernel (without Altivec) the sigcontext matches + * the mcontext upto but not including the v_regs field. For kernels that + * don't set AT_HWCAP or return AT_HWCAP without PPC_FEATURE_HAS_ALTIVEC the + * v_regs field may not exist and should not be referenced. The v_regs field + * can be referenced safely only after verifying that PPC_FEATURE_HAS_ALTIVEC + * is set in AT_HWCAP. */ + +/* Number of general registers. */ +# define __NGREG 48 /* includes r0-r31, nip, msr, lr, etc. */ +# define __NFPREG 33 /* includes fp0-fp31 &fpscr. */ +# define __NVRREG 34 /* includes v0-v31, vscr, & vrsave in + split vectors */ +# ifdef __USE_MISC +# define NGREG __NGREG +# define NFPREG __NFPREG +# define NVRREG __NVRREG +# endif + +typedef unsigned long gregset_t[__NGREG]; +typedef double fpregset_t[__NFPREG]; + +/* Container for Altivec/VMX Vector Status and Control Register. Only 32-bits + but can only be copied to/from a 128-bit vector register. So we allocated + a whole quadword speedup save/restore. */ +typedef struct _libc_vscr +{ +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + unsigned int __pad[3]; + unsigned int __ctx(vscr_word); +#else + unsigned int __ctx(vscr_word); + unsigned int __pad[3]; +#endif +} vscr_t; + +/* Container for Altivec/VMX registers and status. + Must to be aligned on a 16-byte boundary. */ +typedef struct _libc_vrstate +{ + unsigned int __ctx(vrregs)[32][4]; + vscr_t __ctx(vscr); + unsigned int __ctx(vrsave); + unsigned int __pad[3]; +} vrregset_t __attribute__((__aligned__(16))); + +typedef struct { + unsigned long __glibc_reserved[4]; + int __ctx(signal); + int __pad0; + unsigned long __ctx(handler); + unsigned long __ctx(oldmask); + struct __ctx(pt_regs) *__ctx(regs); + gregset_t __ctx(gp_regs); + fpregset_t __ctx(fp_regs); +/* + * To maintain compatibility with current implementations the sigcontext is + * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t) + * followed by an unstructured (vmx_reserve) field of 69 doublewords. This + * allows the array of vector registers to be quadword aligned independent of + * the alignment of the containing sigcontext or ucontext. It is the + * responsibility of the code setting the sigcontext to set this pointer to + * either NULL (if this processor does not support the VMX feature) or the + * address of the first quadword within the allocated (vmx_reserve) area. + * + * The pointer (v_regs) of vector type (elf_vrreg_t) is essentially + * an array of 34 quadword entries. The entries with + * indexes 0-31 contain the corresponding vector registers. The entry with + * index 32 contains the vscr as the last word (offset 12) within the + * quadword. This allows the vscr to be stored as either a quadword (since + * it must be copied via a vector register to/from storage) or as a word. + * The entry with index 33 contains the vrsave as the first word (offset 0) + * within the quadword. + */ + vrregset_t *__ctx(v_regs); + long __ctx(vmx_reserve)[__NVRREG+__NVRREG+1]; +} mcontext_t; + +#endif + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __ctx(uc_flags); + struct ucontext_t *uc_link; + stack_t uc_stack; +#if __WORDSIZE == 32 + /* + * These fields are set up this way to maximize source and + * binary compatibility with code written for the old + * ucontext_t definition, which didn't include space for the + * registers. + * + * Different versions of the kernel have stored the registers on + * signal delivery at different offsets from the ucontext struct. + * Programs should thus use the uc_mcontext.uc_regs pointer to + * find where the registers are actually stored. The registers + * will be stored within the ucontext_t struct but not necessarily + * at a fixed address. As a side-effect, this lets us achieve + * 16-byte alignment for the register storage space if the + * Altivec registers are to be saved, without requiring 16-byte + * alignment on the whole ucontext_t. + * + * The uc_mcontext.regs field is included for source compatibility + * with programs written against the older ucontext_t definition, + * and its name should therefore not change. The uc_pad field + * is for binary compatibility with programs compiled against the + * old ucontext_t; it ensures that uc_mcontext.regs and uc_sigmask + * are at the same offset as previously. + */ + int __glibc_reserved1[7]; + union __ctx(uc_regs_ptr) { + struct __ctx(pt_regs) *__ctx(regs); + mcontext_t *__ctx(uc_regs); + } uc_mcontext; + sigset_t uc_sigmask; + /* last for extensibility */ + char __ctx(uc_reg_space)[sizeof (mcontext_t) + 12]; +#else /* 64-bit */ + sigset_t uc_sigmask; + mcontext_t uc_mcontext; /* last for extensibility */ +#endif + } ucontext_t; + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym index 293761f260..e1b22b844e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym index 8364e4614f..b2d420e15e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h b/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h deleted file mode 100644 index ad9e8f0afc..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h +++ /dev/null @@ -1,200 +0,0 @@ -/* Copyright (C) 1998-2020 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 - -struct __ctx(pt_regs); - -#if __WORDSIZE == 32 - -/* Number of general registers. */ -# define __NGREG 48 -# ifdef __USE_MISC -# define NGREG __NGREG -# endif - -/* Container for all general registers. */ -typedef unsigned long gregset_t[__NGREG]; - -/* Container for floating-point registers and status */ -typedef struct _libc_fpstate -{ - double __ctx(fpregs)[32]; - double __ctx(fpscr); - unsigned int _pad[2]; -} fpregset_t; - -/* Container for Altivec/VMX registers and status. - Needs to be aligned on a 16-byte boundary. */ -typedef struct _libc_vrstate -{ - unsigned int __ctx(vrregs)[32][4]; - unsigned int __ctx(vrsave); - unsigned int _pad[2]; - unsigned int __ctx(vscr); -} vrregset_t; - -/* Context to describe whole processor state. */ -typedef struct -{ - gregset_t __ctx(gregs); - fpregset_t __ctx(fpregs); - vrregset_t __ctx(vrregs) __attribute__((__aligned__(16))); -} mcontext_t; - -#else - -/* For 64-bit kernels with Altivec support, a machine context is exactly - * a sigcontext. For older kernel (without Altivec) the sigcontext matches - * the mcontext upto but not including the v_regs field. For kernels that - * don't set AT_HWCAP or return AT_HWCAP without PPC_FEATURE_HAS_ALTIVEC the - * v_regs field may not exist and should not be referenced. The v_regs field - * can be referenced safely only after verifying that PPC_FEATURE_HAS_ALTIVEC - * is set in AT_HWCAP. */ - -/* Number of general registers. */ -# define __NGREG 48 /* includes r0-r31, nip, msr, lr, etc. */ -# define __NFPREG 33 /* includes fp0-fp31 &fpscr. */ -# define __NVRREG 34 /* includes v0-v31, vscr, & vrsave in - split vectors */ -# ifdef __USE_MISC -# define NGREG __NGREG -# define NFPREG __NFPREG -# define NVRREG __NVRREG -# endif - -typedef unsigned long gregset_t[__NGREG]; -typedef double fpregset_t[__NFPREG]; - -/* Container for Altivec/VMX Vector Status and Control Register. Only 32-bits - but can only be copied to/from a 128-bit vector register. So we allocated - a whole quadword speedup save/restore. */ -typedef struct _libc_vscr -{ -#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - unsigned int __pad[3]; - unsigned int __ctx(vscr_word); -#else - unsigned int __ctx(vscr_word); - unsigned int __pad[3]; -#endif -} vscr_t; - -/* Container for Altivec/VMX registers and status. - Must to be aligned on a 16-byte boundary. */ -typedef struct _libc_vrstate -{ - unsigned int __ctx(vrregs)[32][4]; - vscr_t __ctx(vscr); - unsigned int __ctx(vrsave); - unsigned int __pad[3]; -} vrregset_t __attribute__((__aligned__(16))); - -typedef struct { - unsigned long __glibc_reserved[4]; - int __ctx(signal); - int __pad0; - unsigned long __ctx(handler); - unsigned long __ctx(oldmask); - struct __ctx(pt_regs) *__ctx(regs); - gregset_t __ctx(gp_regs); - fpregset_t __ctx(fp_regs); -/* - * To maintain compatibility with current implementations the sigcontext is - * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t) - * followed by an unstructured (vmx_reserve) field of 69 doublewords. This - * allows the array of vector registers to be quadword aligned independent of - * the alignment of the containing sigcontext or ucontext. It is the - * responsibility of the code setting the sigcontext to set this pointer to - * either NULL (if this processor does not support the VMX feature) or the - * address of the first quadword within the allocated (vmx_reserve) area. - * - * The pointer (v_regs) of vector type (elf_vrreg_t) is essentially - * an array of 34 quadword entries. The entries with - * indexes 0-31 contain the corresponding vector registers. The entry with - * index 32 contains the vscr as the last word (offset 12) within the - * quadword. This allows the vscr to be stored as either a quadword (since - * it must be copied via a vector register to/from storage) or as a word. - * The entry with index 33 contains the vrsave as the first word (offset 0) - * within the quadword. - */ - vrregset_t *__ctx(v_regs); - long __ctx(vmx_reserve)[__NVRREG+__NVRREG+1]; -} mcontext_t; - -#endif - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long int __ctx(uc_flags); - struct ucontext_t *uc_link; - stack_t uc_stack; -#if __WORDSIZE == 32 - /* - * These fields are set up this way to maximize source and - * binary compatibility with code written for the old - * ucontext_t definition, which didn't include space for the - * registers. - * - * Different versions of the kernel have stored the registers on - * signal delivery at different offsets from the ucontext struct. - * Programs should thus use the uc_mcontext.uc_regs pointer to - * find where the registers are actually stored. The registers - * will be stored within the ucontext_t struct but not necessarily - * at a fixed address. As a side-effect, this lets us achieve - * 16-byte alignment for the register storage space if the - * Altivec registers are to be saved, without requiring 16-byte - * alignment on the whole ucontext_t. - * - * The uc_mcontext.regs field is included for source compatibility - * with programs written against the older ucontext_t definition, - * and its name should therefore not change. The uc_pad field - * is for binary compatibility with programs compiled against the - * old ucontext_t; it ensures that uc_mcontext.regs and uc_sigmask - * are at the same offset as previously. - */ - int __glibc_reserved1[7]; - union __ctx(uc_regs_ptr) { - struct __ctx(pt_regs) *__ctx(regs); - mcontext_t *__ctx(uc_regs); - } uc_mcontext; - sigset_t uc_sigmask; - /* last for extensibility */ - char __ctx(uc_reg_space)[sizeof (mcontext_t) + 12]; -#else /* 64-bit */ - sigset_t uc_sigmask; - mcontext_t uc_mcontext; /* last for extensibility */ -#endif - } ucontext_t; - -#undef __ctx - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/riscv/bits/procfs.h b/sysdeps/unix/sysv/linux/riscv/bits/procfs.h index 167991f28f..ef7a010490 100644 --- a/sysdeps/unix/sysv/linux/riscv/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/riscv/bits/procfs.h @@ -23,10 +23,10 @@ # error "Never include directly; use instead." #endif -/* FIXME: sys/ucontext.h does not define NGREG or NFPREG unless +/* FIXME: bits/ucontext.h does not define NGREG or NFPREG unless __USE_MISC is active, and sys/procfs.h should not expose all of - sys/ucontext.h. */ -#include + bits/ucontext.h. */ +#include /* ELF register definitions */ #define ELF_NGREG NGREG diff --git a/sysdeps/unix/sysv/linux/riscv/bits/ucontext.h b/sysdeps/unix/sysv/linux/riscv/bits/ucontext.h new file mode 100644 index 0000000000..27478372be --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/bits/ucontext.h @@ -0,0 +1,110 @@ +/* struct ucontext definition, RISC-V version. + Copyright (C) 1997-2020 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 + . */ + +/* Don't rely on this, the interface is currently messed up and may need to + be broken to be fixed. */ +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + +typedef unsigned long int __riscv_mc_gp_state[32]; + +#ifdef __USE_MISC +# define NGREG 32 + +# define REG_PC 0 +# define REG_RA 1 +# define REG_SP 2 +# define REG_TP 4 +# define REG_S0 8 +# define REG_S1 9 +# define REG_A0 10 +# define REG_S2 18 +# define REG_NARGS 8 + +typedef unsigned long int greg_t; + +/* Container for all general registers. */ +typedef __riscv_mc_gp_state gregset_t; + +/* Container for floating-point state. */ +typedef union __riscv_mc_fp_state fpregset_t; +#endif + +struct __riscv_mc_f_ext_state + { + unsigned int __f[32]; + unsigned int __fcsr; + }; + +struct __riscv_mc_d_ext_state + { + unsigned long long int __f[32]; + unsigned int __fcsr; + }; + +struct __riscv_mc_q_ext_state + { + unsigned long long int __f[64] __attribute__ ((__aligned__ (16))); + unsigned int __fcsr; + /* Reserved for expansion of sigcontext structure. Currently zeroed + upon signal, and must be zero upon sigreturn. */ + unsigned int __glibc_reserved[3]; + }; + +union __riscv_mc_fp_state + { + struct __riscv_mc_f_ext_state __f; + struct __riscv_mc_d_ext_state __d; + struct __riscv_mc_q_ext_state __q; + }; + +typedef struct mcontext_t + { + __riscv_mc_gp_state __gregs; + union __riscv_mc_fp_state __fpregs; + } mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long int __uc_flags; + struct ucontext_t *uc_link; + stack_t uc_stack; + sigset_t uc_sigmask; + /* There's some padding here to allow sigset_t to be expanded in the + future. Though this is unlikely, other architectures put uc_sigmask + at the end of this structure and explicitly state it can be + expanded, so we didn't want to box ourselves in here. */ + char __glibc_reserved[1024 / 8 - sizeof (sigset_t)]; + /* We can't put uc_sigmask at the end of this structure because we need + to be able to expand sigcontext in the future. For example, the + vector ISA extension will almost certainly add ISA state. We want + to ensure all user-visible ISA state can be saved and restored via a + ucontext, so we're putting this at the end in order to allow for + infinite extensibility. Since we know this will be extended and we + assume sigset_t won't be extended an extreme amount, we're + prioritizing this. */ + mcontext_t uc_mcontext; + } ucontext_t; + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/riscv/makecontext.c b/sysdeps/unix/sysv/linux/riscv/makecontext.c index 7ae5e2cd07..bce27fdf45 100644 --- a/sysdeps/unix/sysv/linux/riscv/makecontext.c +++ b/sysdeps/unix/sysv/linux/riscv/makecontext.c @@ -18,14 +18,12 @@ #include #include -#include +#include #include #include void -__makecontext (ucontext_t *ucp, void (*func) (void), int argc, - long int a0, long int a1, long int a2, long int a3, long int a4, - ...) +__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...) { extern void __start_context (void) attribute_hidden; long int i, sp; @@ -47,19 +45,13 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ucp->uc_mcontext.__gregs[REG_PC] = (long int) &__start_context; /* Put args in a0-a7, then put any remaining args on the stack. */ - ucp->uc_mcontext.__gregs[REG_A0 + 0] = a0; - ucp->uc_mcontext.__gregs[REG_A0 + 1] = a1; - ucp->uc_mcontext.__gregs[REG_A0 + 2] = a2; - ucp->uc_mcontext.__gregs[REG_A0 + 3] = a3; - ucp->uc_mcontext.__gregs[REG_A0 + 4] = a4; - - if (__glibc_unlikely (argc > 5)) + if (argc > 0) { va_list vl; - va_start (vl, a4); + va_start (vl, argc); long reg_args = argc < REG_NARGS ? argc : REG_NARGS; - for (i = 5; i < reg_args; i++) + for (i = 0; i < reg_args; i++) ucp->uc_mcontext.__gregs[REG_A0 + i] = va_arg (vl, long); long int stack_args = argc - reg_args; diff --git a/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h b/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h index a420531d51..730c7e2f1a 100644 --- a/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h @@ -19,7 +19,7 @@ #ifndef _SIGCONTEXTINFO_H #define _SIGCONTEXTINFO_H -#include +#include static inline uintptr_t sigcontext_get_pc (const ucontext_t *ctx) diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h deleted file mode 100644 index a4e49fe37a..0000000000 --- a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h +++ /dev/null @@ -1,110 +0,0 @@ -/* struct ucontext definition, RISC-V version. - Copyright (C) 1997-2020 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 - . */ - -/* Don't rely on this, the interface is currently messed up and may need to - be broken to be fixed. */ -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - -typedef unsigned long int __riscv_mc_gp_state[32]; - -#ifdef __USE_MISC -# define NGREG 32 - -# define REG_PC 0 -# define REG_RA 1 -# define REG_SP 2 -# define REG_TP 4 -# define REG_S0 8 -# define REG_S1 9 -# define REG_A0 10 -# define REG_S2 18 -# define REG_NARGS 8 - -typedef unsigned long int greg_t; - -/* Container for all general registers. */ -typedef __riscv_mc_gp_state gregset_t; - -/* Container for floating-point state. */ -typedef union __riscv_mc_fp_state fpregset_t; -#endif - -struct __riscv_mc_f_ext_state - { - unsigned int __f[32]; - unsigned int __fcsr; - }; - -struct __riscv_mc_d_ext_state - { - unsigned long long int __f[32]; - unsigned int __fcsr; - }; - -struct __riscv_mc_q_ext_state - { - unsigned long long int __f[64] __attribute__ ((__aligned__ (16))); - unsigned int __fcsr; - /* Reserved for expansion of sigcontext structure. Currently zeroed - upon signal, and must be zero upon sigreturn. */ - unsigned int __glibc_reserved[3]; - }; - -union __riscv_mc_fp_state - { - struct __riscv_mc_f_ext_state __f; - struct __riscv_mc_d_ext_state __d; - struct __riscv_mc_q_ext_state __q; - }; - -typedef struct mcontext_t - { - __riscv_mc_gp_state __gregs; - union __riscv_mc_fp_state __fpregs; - } mcontext_t; - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long int __uc_flags; - struct ucontext_t *uc_link; - stack_t uc_stack; - sigset_t uc_sigmask; - /* There's some padding here to allow sigset_t to be expanded in the - future. Though this is unlikely, other architectures put uc_sigmask - at the end of this structure and explicitly state it can be - expanded, so we didn't want to box ourselves in here. */ - char __glibc_reserved[1024 / 8 - sizeof (sigset_t)]; - /* We can't put uc_sigmask at the end of this structure because we need - to be able to expand sigcontext in the future. For example, the - vector ISA extension will almost certainly add ISA state. We want - to ensure all user-visible ISA state can be saved and restored via a - ucontext, so we're putting this at the end in order to allow for - infinite extensibility. Since we know this will be extended and we - assume sigset_t won't be extended an extreme amount, we're - prioritizing this. */ - mcontext_t uc_mcontext; - } ucontext_t; - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym index be55b26310..105b538684 100644 --- a/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/riscv/ucontext_i.sym @@ -1,7 +1,5 @@ -#include -#include #include -#include +#include -- Constants used by the rt_sigprocmask call. diff --git a/sysdeps/unix/sysv/linux/s390/bits/procfs.h b/sysdeps/unix/sysv/linux/s390/bits/procfs.h index 633b8f6346..8134930478 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/procfs.h +++ b/sysdeps/unix/sysv/linux/s390/bits/procfs.h @@ -23,9 +23,9 @@ # error "Never include directly; use instead." #endif -/* FIXME: sys/ucontext.h does not define NGREG unless __USE_MISC is - active, and sys/procfs.h should not expose all of sys/ucontext.h. */ -#include +/* FIXME: bits/ucontext.h does not define NGREG unless __USE_MISC is + active, and sys/procfs.h should not expose all of bits/ucontext.h. */ +#include typedef greg_t elf_greg_t; #define ELF_NGREG NGREG diff --git a/sysdeps/unix/sysv/linux/s390/bits/ucontext.h b/sysdeps/unix/sysv/linux/s390/bits/ucontext.h new file mode 100644 index 0000000000..580f01c03e --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/bits/ucontext.h @@ -0,0 +1,95 @@ +/* Copyright (C) 2000-2020 Free Software Foundation, Inc. + Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). + 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 _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* Type for a program status word. */ +typedef struct +{ + unsigned long __ctx(mask); + unsigned long __ctx(addr); +} __attribute__ ((__aligned__(8))) __psw_t; + +/* Type for a general-purpose register. */ +typedef unsigned long greg_t; + +/* And the whole bunch of them. We should have used `struct s390_regs', + but to avoid name space pollution and since the tradition says that + the register set is an array, we make gregset_t a simple array + that has the same size as s390_regs. This is needed for the + elf_prstatus structure. */ +#if __WORDSIZE == 64 +# define __NGREG 27 +#else +# define __NGREG 36 +#endif +#ifdef __USE_MISC +# define NGREG __NGREG +#endif +/* Must match kernels psw_t alignment. */ +typedef greg_t gregset_t[__NGREG] __attribute__ ((__aligned__(8))); + +typedef union + { + double __ctx(d); + float __ctx(f); + } fpreg_t; + +/* Register set for the floating-point registers. */ +typedef struct + { + unsigned int __ctx(fpc); + fpreg_t __ctx(fprs)[16]; + } fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + __psw_t __ctx(psw); + unsigned long __ctx(gregs)[16]; + unsigned int __ctx(aregs)[16]; + fpregset_t __ctx(fpregs); + } 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 /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h deleted file mode 100644 index 769386ff95..0000000000 --- a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (C) 2000-2020 Free Software Foundation, Inc. - Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com). - 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 - -/* Type for a program status word. */ -typedef struct -{ - unsigned long __ctx(mask); - unsigned long __ctx(addr); -} __attribute__ ((__aligned__(8))) __psw_t; - -/* Type for a general-purpose register. */ -typedef unsigned long greg_t; - -/* And the whole bunch of them. We should have used `struct s390_regs', - but to avoid name space pollution and since the tradition says that - the register set is an array, we make gregset_t a simple array - that has the same size as s390_regs. This is needed for the - elf_prstatus structure. */ -#if __WORDSIZE == 64 -# define __NGREG 27 -#else -# define __NGREG 36 -#endif -#ifdef __USE_MISC -# define NGREG __NGREG -#endif -/* Must match kernels psw_t alignment. */ -typedef greg_t gregset_t[__NGREG] __attribute__ ((__aligned__(8))); - -typedef union - { - double __ctx(d); - float __ctx(f); - } fpreg_t; - -/* Register set for the floating-point registers. */ -typedef struct - { - unsigned int __ctx(fpc); - fpreg_t __ctx(fprs)[16]; - } fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - __psw_t __ctx(psw); - unsigned long __ctx(gregs)[16]; - unsigned int __ctx(aregs)[16]; - fpregset_t __ctx(fpregs); - } 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 */ diff --git a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c b/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c index adbe427169..c456db109c 100644 --- a/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c +++ b/sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c @@ -16,19 +16,19 @@ License along with the GNU C Library; if not, see . */ +#include +#include #include #include #include #include #include -#include #include #include -#include -#include +#include + #include -#include -#include +#include /* Ensure that we use the PTRACE_SINGLEBLOCK definition from glibc ptrace.h in tracer_func. We need the kernel ptrace.h for structs ptrace_area diff --git a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym index 6cc9f19624..5b98555049 100644 --- a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/sh/bits/ucontext.h b/sysdeps/unix/sysv/linux/sh/bits/ucontext.h new file mode 100644 index 0000000000..ac7b8941e3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sh/bits/ucontext.h @@ -0,0 +1,126 @@ +/* Copyright (C) 1999-2020 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 + . */ + +/* Where is System V/SH ABI? */ + +#ifndef _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + + +typedef int greg_t; + +/* Number of general registers. */ +#define __NGREG 16 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_MISC +/* Number of each register is the `gregset_t' array. */ +enum +{ + REG_R0 = 0, +# define REG_R0 REG_R0 + REG_R1 = 1, +# define REG_R1 REG_R1 + REG_R2 = 2, +# define REG_R2 REG_R2 + REG_R3 = 3, +# define REG_R3 REG_R3 + REG_R4 = 4, +# define REG_R4 REG_R4 + REG_R5 = 5, +# define REG_R5 REG_R5 + REG_R6 = 6, +# define REG_R6 REG_R6 + REG_R7 = 7, +# define REG_R7 REG_R7 + REG_R8 = 8, +# define REG_R8 REG_R8 + REG_R9 = 9, +# define REG_R9 REG_R9 + REG_R10 = 10, +# define REG_R10 REG_R10 + REG_R11 = 11, +# define REG_R11 REG_R11 + REG_R12 = 12, +# define REG_R12 REG_R12 + REG_R13 = 13, +# define REG_R13 REG_R13 + REG_R14 = 14, +# define REG_R14 REG_R14 + REG_R15 = 15, +# define REG_R15 REG_R15 +}; +#endif + +typedef int freg_t; + +/* Number of FPU registers. */ +#define __NFPREG 16 +#ifdef __USE_MISC +# define NFPREG __NFPREG +#endif + +/* Structure to describe FPU registers. */ +typedef freg_t fpregset_t[__NFPREG]; + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +/* Context to describe whole processor state. */ +typedef struct + { + unsigned int __ctx(oldmask); + gregset_t __ctx(gregs); + unsigned int __ctx(pc); + unsigned int __ctx(pr); + unsigned int __ctx(sr); + unsigned int __ctx(gbr); + unsigned int __ctx(mach); + unsigned int __ctx(macl); + fpregset_t __ctx(fpregs); + fpregset_t __ctx(xfpregs); + unsigned int __ctx(fpscr); + unsigned int __ctx(fpul); + unsigned int __ctx(ownedfp); + } 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 /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym index 25f914a93b..4cd312ac5d 100644 --- a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym index 130f60cd96..530a06f6d0 100644 --- a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h b/sysdeps/unix/sysv/linux/sh/sys/ucontext.h deleted file mode 100644 index f83292a23c..0000000000 --- a/sysdeps/unix/sysv/linux/sh/sys/ucontext.h +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright (C) 1999-2020 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 - . */ - -/* Where is System V/SH ABI? */ - -#ifndef _SYS_UCONTEXT_H -#define _SYS_UCONTEXT_H 1 - -#include - -#include -#include - - -typedef int greg_t; - -/* Number of general registers. */ -#define __NGREG 16 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_MISC -/* Number of each register is the `gregset_t' array. */ -enum -{ - REG_R0 = 0, -# define REG_R0 REG_R0 - REG_R1 = 1, -# define REG_R1 REG_R1 - REG_R2 = 2, -# define REG_R2 REG_R2 - REG_R3 = 3, -# define REG_R3 REG_R3 - REG_R4 = 4, -# define REG_R4 REG_R4 - REG_R5 = 5, -# define REG_R5 REG_R5 - REG_R6 = 6, -# define REG_R6 REG_R6 - REG_R7 = 7, -# define REG_R7 REG_R7 - REG_R8 = 8, -# define REG_R8 REG_R8 - REG_R9 = 9, -# define REG_R9 REG_R9 - REG_R10 = 10, -# define REG_R10 REG_R10 - REG_R11 = 11, -# define REG_R11 REG_R11 - REG_R12 = 12, -# define REG_R12 REG_R12 - REG_R13 = 13, -# define REG_R13 REG_R13 - REG_R14 = 14, -# define REG_R14 REG_R14 - REG_R15 = 15, -# define REG_R15 REG_R15 -}; -#endif - -typedef int freg_t; - -/* Number of FPU registers. */ -#define __NFPREG 16 -#ifdef __USE_MISC -# define NFPREG __NFPREG -#endif - -/* Structure to describe FPU registers. */ -typedef freg_t fpregset_t[__NFPREG]; - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -/* Context to describe whole processor state. */ -typedef struct - { - unsigned int __ctx(oldmask); - gregset_t __ctx(gregs); - unsigned int __ctx(pc); - unsigned int __ctx(pr); - unsigned int __ctx(sr); - unsigned int __ctx(gbr); - unsigned int __ctx(mach); - unsigned int __ctx(macl); - fpregset_t __ctx(fpregs); - fpregset_t __ctx(xfpregs); - unsigned int __ctx(fpscr); - unsigned int __ctx(fpul); - unsigned int __ctx(ownedfp); - } 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 */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/ucontext.h b/sysdeps/unix/sysv/linux/sparc/bits/ucontext.h new file mode 100644 index 0000000000..4760a6a685 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sparc/bits/ucontext.h @@ -0,0 +1,304 @@ +/* Copyright (C) 1998-2020 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 _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include + +#include + + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +#if __WORDSIZE == 64 + +#define __MC_NGREG 19 +#ifdef __USE_MISC +# define MC_TSTATE 0 +# define MC_PC 1 +# define MC_NPC 2 +# define MC_Y 3 +# define MC_G1 4 +# define MC_G2 5 +# define MC_G3 6 +# define MC_G4 7 +# define MC_G5 8 +# define MC_G6 9 +# define MC_G7 10 +# define MC_O0 11 +# define MC_O1 12 +# define MC_O2 13 +# define MC_O3 14 +# define MC_O4 15 +# define MC_O5 16 +# define MC_O6 17 +# define MC_O7 18 +# define MC_NGREG __MC_NGREG +#endif + +typedef unsigned long mc_greg_t; +typedef mc_greg_t mc_gregset_t[__MC_NGREG]; + +#ifdef __USE_MISC +# define MC_MAXFPQ 16 +#endif +struct __mc_fq { + unsigned long *__ctx(mcfq_addr); + unsigned int __ctx(mcfq_insn); +}; + +typedef struct { + union { + unsigned int __ctx(sregs)[32]; + unsigned long __ctx(dregs)[32]; + long double __ctx(qregs)[16]; + } __ctx(mcfpu_fregs); + unsigned long __ctx(mcfpu_fsr); + unsigned long __ctx(mcfpu_fprs); + unsigned long __ctx(mcfpu_gsr); + struct __mc_fq *__ctx(mcfpu_fq); + unsigned char __ctx(mcfpu_qcnt); + unsigned char __ctx(mcfpu_qentsz); + unsigned char __ctx(mcfpu_enab); +} mc_fpu_t; + +typedef struct { + mc_gregset_t __ctx(mc_gregs); + mc_greg_t __ctx(mc_fp); + mc_greg_t __ctx(mc_i7); + mc_fpu_t __ctx(mc_fpregs); +} mcontext_t; + +typedef struct ucontext_t { + struct ucontext_t *uc_link; + unsigned long __ctx(uc_flags); + unsigned long __uc_sigmask; + mcontext_t uc_mcontext; + stack_t uc_stack; + sigset_t uc_sigmask; +} ucontext_t; + +#endif /* __WORDISIZE == 64 */ + +/* + * Location of the users' stored registers relative to R0. + * Usage is as an index into a gregset_t array or as u.u_ar0[XX]. + */ +#ifdef __USE_MISC +# define REG_PSR (0) +# define REG_PC (1) +# define REG_nPC (2) +# define REG_Y (3) +# define REG_G1 (4) +# define REG_G2 (5) +# define REG_G3 (6) +# define REG_G4 (7) +# define REG_G5 (8) +# define REG_G6 (9) +# define REG_G7 (10) +# define REG_O0 (11) +# define REG_O1 (12) +# define REG_O2 (13) +# define REG_O3 (14) +# define REG_O4 (15) +# define REG_O5 (16) +# define REG_O6 (17) +# define REG_O7 (18) +#endif + +/* + * A gregset_t is defined as an array type for compatibility with the reference + * source. This is important due to differences in the way the C language + * treats arrays and structures as parameters. + * + * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)), + * but that the ABI defines it absolutely to be 21 (resp. 19). + */ + +#if __WORDSIZE == 64 + +# define __NGREG 21 +# ifdef __USE_MISC +# define REG_ASI (19) +# define REG_FPRS (20) + +# define NGREG __NGREG +# endif +typedef long greg_t; + +#else /* __WORDSIZE == 32 */ + +# define __NGREG 19 +# ifdef __USE_MISC +# define NGREG __NGREG +# endif +typedef int greg_t; + +#endif /* __WORDSIZE == 32 */ + +typedef greg_t gregset_t[__NGREG]; + +/* + * The following structures define how a register window can appear on the + * stack. This structure is available (when required) through the `gwins' + * field of an mcontext (nested within ucontext). SPARC_MAXWINDOW is the + * maximum number of outstanding regiters window defined in the SPARC + * architecture (*not* implementation). + */ +# define __SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */ +#ifdef __USE_MISC +# define SPARC_MAXREGWINDOW __SPARC_MAXREGWINDOW +#endif +struct __rwindow + { + greg_t __ctx(rw_local)[8]; /* locals */ + greg_t __ctx(rw_in)[8]; /* ins */ + }; + +#ifdef __USE_MISC +# define rw_fp __ctx(rw_in)[6] /* frame pointer */ +# define rw_rtn __ctx(rw_in)[7] /* return address */ +#endif + +typedef struct + { + int __ctx(wbcnt); + int *__ctx(spbuf)[__SPARC_MAXREGWINDOW]; + struct __rwindow __ctx(wbuf)[__SPARC_MAXREGWINDOW]; + } gwindows_t; + +/* + * Floating point definitions. + */ + +#ifdef __USE_MISC +# define MAXFPQ 16 /* max # of fpu queue entries currently supported */ +#endif + +/* + * struct fq defines the minimal format of a floating point instruction queue + * entry. The size of entries in the floating point queue are implementation + * dependent. The union FQu is guarenteed to be the first field in any ABI + * conformant system implementation. Any additional fields provided by an + * implementation should not be used applications designed to be ABI conformant. */ + +struct __fpq + { + unsigned long *__ctx(fpq_addr); /* address */ + unsigned long __ctx(fpq_instr); /* instruction */ + }; + +struct __fq + { + union /* FPU inst/addr queue */ + { + double __ctx(whole); + struct __fpq __ctx(fpq); + } __ctx(FQu); + }; + +#ifdef __USE_MISC +# define FPU_REGS_TYPE unsigned +# define FPU_DREGS_TYPE unsigned long long +# define V7_FPU_FSR_TYPE unsigned +# define V9_FPU_FSR_TYPE unsigned long long +# define V9_FPU_FPRS_TYPE unsigned +#endif + +#if __WORDSIZE == 64 + +typedef struct + { + union { /* FPU floating point regs */ + unsigned __ctx(fpu_regs)[32]; /* 32 singles */ + double __ctx(fpu_dregs)[32]; /* 32 doubles */ + long double __ctx(fpu_qregs)[16]; /* 16 quads */ + } __ctx(fpu_fr); + struct __fq *__ctx(fpu_q); /* ptr to array of FQ entries */ + unsigned long __ctx(fpu_fsr); /* FPU status register */ + unsigned char __ctx(fpu_qcnt); /* # of entries in saved FQ */ + unsigned char __ctx(fpu_q_entrysize); /* # of bytes per FQ entry */ + unsigned char __ctx(fpu_en); /* flag signifying fpu in use */ + } fpregset_t; + +#else /* __WORDSIZE == 32 */ + +typedef struct + { + union { /* FPU floating point regs */ + __extension__ unsigned long long __ctx(fpu_regs)[32]; /* 32 singles */ + double __ctx(fpu_dregs)[16]; /* 16 doubles */ + } __ctx(fpu_fr); + struct __fq *__ctx(fpu_q); /* ptr to array of FQ entries */ + unsigned __ctx(fpu_fsr); /* FPU status register */ + unsigned char __ctx(fpu_qcnt); /* # of entries in saved FQ */ + unsigned char __ctx(fpu_q_entrysize); /* # of bytes per FQ entry */ + unsigned char __ctx(fpu_en); /* flag signifying fpu in use */ + } fpregset_t; + +/* + * The following structure is for associating extra register state with + * the ucontext structure and is kept within the uc_mcontext filler area. + * + * If (xrs_id == XRS_ID) then the xrs_ptr field is a valid pointer to + * extra register state. The exact format of the extra register state + * pointed to by xrs_ptr is platform-dependent. + * + * Note: a platform may or may not manage extra register state. + */ +typedef struct + { + unsigned int __ctx(xrs_id); /* indicates xrs_ptr validity */ + void * __ctx(xrs_ptr); /* ptr to extra reg state */ + } xrs_t; + +#ifdef __USE_MISC +# define XRS_ID 0x78727300 /* the string "xrs" */ +#endif + +typedef struct + { + gregset_t __ctx(gregs); /* general register set */ + gwindows_t *__ctx(gwins); /* POSSIBLE pointer to register + windows */ + fpregset_t __ctx(fpregs); /* floating point register set */ + xrs_t __ctx(xrs); /* POSSIBLE extra register state + association */ + long __glibc_reserved1[19]; + } mcontext_t; + + +/* Userlevel context. */ +typedef struct ucontext_t + { + unsigned long __ctx(uc_flags); + struct ucontext_t *uc_link; + sigset_t uc_sigmask; + stack_t uc_stack; + mcontext_t uc_mcontext; + } ucontext_t; + +#endif /* __WORDSIZE == 32 */ +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym index 8a7cb5ab84..0fe920d35a 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- diff --git a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h b/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h deleted file mode 100644 index 7075f70582..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sys/ucontext.h +++ /dev/null @@ -1,304 +0,0 @@ -/* Copyright (C) 1998-2020 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 - -#include - - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -#if __WORDSIZE == 64 - -#define __MC_NGREG 19 -#ifdef __USE_MISC -# define MC_TSTATE 0 -# define MC_PC 1 -# define MC_NPC 2 -# define MC_Y 3 -# define MC_G1 4 -# define MC_G2 5 -# define MC_G3 6 -# define MC_G4 7 -# define MC_G5 8 -# define MC_G6 9 -# define MC_G7 10 -# define MC_O0 11 -# define MC_O1 12 -# define MC_O2 13 -# define MC_O3 14 -# define MC_O4 15 -# define MC_O5 16 -# define MC_O6 17 -# define MC_O7 18 -# define MC_NGREG __MC_NGREG -#endif - -typedef unsigned long mc_greg_t; -typedef mc_greg_t mc_gregset_t[__MC_NGREG]; - -#ifdef __USE_MISC -# define MC_MAXFPQ 16 -#endif -struct __mc_fq { - unsigned long *__ctx(mcfq_addr); - unsigned int __ctx(mcfq_insn); -}; - -typedef struct { - union { - unsigned int __ctx(sregs)[32]; - unsigned long __ctx(dregs)[32]; - long double __ctx(qregs)[16]; - } __ctx(mcfpu_fregs); - unsigned long __ctx(mcfpu_fsr); - unsigned long __ctx(mcfpu_fprs); - unsigned long __ctx(mcfpu_gsr); - struct __mc_fq *__ctx(mcfpu_fq); - unsigned char __ctx(mcfpu_qcnt); - unsigned char __ctx(mcfpu_qentsz); - unsigned char __ctx(mcfpu_enab); -} mc_fpu_t; - -typedef struct { - mc_gregset_t __ctx(mc_gregs); - mc_greg_t __ctx(mc_fp); - mc_greg_t __ctx(mc_i7); - mc_fpu_t __ctx(mc_fpregs); -} mcontext_t; - -typedef struct ucontext_t { - struct ucontext_t *uc_link; - unsigned long __ctx(uc_flags); - unsigned long __uc_sigmask; - mcontext_t uc_mcontext; - stack_t uc_stack; - sigset_t uc_sigmask; -} ucontext_t; - -#endif /* __WORDISIZE == 64 */ - -/* - * Location of the users' stored registers relative to R0. - * Usage is as an index into a gregset_t array or as u.u_ar0[XX]. - */ -#ifdef __USE_MISC -# define REG_PSR (0) -# define REG_PC (1) -# define REG_nPC (2) -# define REG_Y (3) -# define REG_G1 (4) -# define REG_G2 (5) -# define REG_G3 (6) -# define REG_G4 (7) -# define REG_G5 (8) -# define REG_G6 (9) -# define REG_G7 (10) -# define REG_O0 (11) -# define REG_O1 (12) -# define REG_O2 (13) -# define REG_O3 (14) -# define REG_O4 (15) -# define REG_O5 (16) -# define REG_O6 (17) -# define REG_O7 (18) -#endif - -/* - * A gregset_t is defined as an array type for compatibility with the reference - * source. This is important due to differences in the way the C language - * treats arrays and structures as parameters. - * - * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)), - * but that the ABI defines it absolutely to be 21 (resp. 19). - */ - -#if __WORDSIZE == 64 - -# define __NGREG 21 -# ifdef __USE_MISC -# define REG_ASI (19) -# define REG_FPRS (20) - -# define NGREG __NGREG -# endif -typedef long greg_t; - -#else /* __WORDSIZE == 32 */ - -# define __NGREG 19 -# ifdef __USE_MISC -# define NGREG __NGREG -# endif -typedef int greg_t; - -#endif /* __WORDSIZE == 32 */ - -typedef greg_t gregset_t[__NGREG]; - -/* - * The following structures define how a register window can appear on the - * stack. This structure is available (when required) through the `gwins' - * field of an mcontext (nested within ucontext). SPARC_MAXWINDOW is the - * maximum number of outstanding regiters window defined in the SPARC - * architecture (*not* implementation). - */ -# define __SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */ -#ifdef __USE_MISC -# define SPARC_MAXREGWINDOW __SPARC_MAXREGWINDOW -#endif -struct __rwindow - { - greg_t __ctx(rw_local)[8]; /* locals */ - greg_t __ctx(rw_in)[8]; /* ins */ - }; - -#ifdef __USE_MISC -# define rw_fp __ctx(rw_in)[6] /* frame pointer */ -# define rw_rtn __ctx(rw_in)[7] /* return address */ -#endif - -typedef struct - { - int __ctx(wbcnt); - int *__ctx(spbuf)[__SPARC_MAXREGWINDOW]; - struct __rwindow __ctx(wbuf)[__SPARC_MAXREGWINDOW]; - } gwindows_t; - -/* - * Floating point definitions. - */ - -#ifdef __USE_MISC -# define MAXFPQ 16 /* max # of fpu queue entries currently supported */ -#endif - -/* - * struct fq defines the minimal format of a floating point instruction queue - * entry. The size of entries in the floating point queue are implementation - * dependent. The union FQu is guarenteed to be the first field in any ABI - * conformant system implementation. Any additional fields provided by an - * implementation should not be used applications designed to be ABI conformant. */ - -struct __fpq - { - unsigned long *__ctx(fpq_addr); /* address */ - unsigned long __ctx(fpq_instr); /* instruction */ - }; - -struct __fq - { - union /* FPU inst/addr queue */ - { - double __ctx(whole); - struct __fpq __ctx(fpq); - } __ctx(FQu); - }; - -#ifdef __USE_MISC -# define FPU_REGS_TYPE unsigned -# define FPU_DREGS_TYPE unsigned long long -# define V7_FPU_FSR_TYPE unsigned -# define V9_FPU_FSR_TYPE unsigned long long -# define V9_FPU_FPRS_TYPE unsigned -#endif - -#if __WORDSIZE == 64 - -typedef struct - { - union { /* FPU floating point regs */ - unsigned __ctx(fpu_regs)[32]; /* 32 singles */ - double __ctx(fpu_dregs)[32]; /* 32 doubles */ - long double __ctx(fpu_qregs)[16]; /* 16 quads */ - } __ctx(fpu_fr); - struct __fq *__ctx(fpu_q); /* ptr to array of FQ entries */ - unsigned long __ctx(fpu_fsr); /* FPU status register */ - unsigned char __ctx(fpu_qcnt); /* # of entries in saved FQ */ - unsigned char __ctx(fpu_q_entrysize); /* # of bytes per FQ entry */ - unsigned char __ctx(fpu_en); /* flag signifying fpu in use */ - } fpregset_t; - -#else /* __WORDSIZE == 32 */ - -typedef struct - { - union { /* FPU floating point regs */ - __extension__ unsigned long long __ctx(fpu_regs)[32]; /* 32 singles */ - double __ctx(fpu_dregs)[16]; /* 16 doubles */ - } __ctx(fpu_fr); - struct __fq *__ctx(fpu_q); /* ptr to array of FQ entries */ - unsigned __ctx(fpu_fsr); /* FPU status register */ - unsigned char __ctx(fpu_qcnt); /* # of entries in saved FQ */ - unsigned char __ctx(fpu_q_entrysize); /* # of bytes per FQ entry */ - unsigned char __ctx(fpu_en); /* flag signifying fpu in use */ - } fpregset_t; - -/* - * The following structure is for associating extra register state with - * the ucontext structure and is kept within the uc_mcontext filler area. - * - * If (xrs_id == XRS_ID) then the xrs_ptr field is a valid pointer to - * extra register state. The exact format of the extra register state - * pointed to by xrs_ptr is platform-dependent. - * - * Note: a platform may or may not manage extra register state. - */ -typedef struct - { - unsigned int __ctx(xrs_id); /* indicates xrs_ptr validity */ - void * __ctx(xrs_ptr); /* ptr to extra reg state */ - } xrs_t; - -#ifdef __USE_MISC -# define XRS_ID 0x78727300 /* the string "xrs" */ -#endif - -typedef struct - { - gregset_t __ctx(gregs); /* general register set */ - gwindows_t *__ctx(gwins); /* POSSIBLE pointer to register - windows */ - fpregset_t __ctx(fpregs); /* floating point register set */ - xrs_t __ctx(xrs); /* POSSIBLE extra register state - association */ - long __glibc_reserved1[19]; - } mcontext_t; - - -/* Userlevel context. */ -typedef struct ucontext_t - { - unsigned long __ctx(uc_flags); - struct ucontext_t *uc_link; - sigset_t uc_sigmask; - stack_t uc_stack; - mcontext_t uc_mcontext; - } ucontext_t; - -#endif /* __WORDSIZE == 32 */ -#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/x86/bits/ucontext.h b/sysdeps/unix/sysv/linux/x86/bits/ucontext.h new file mode 100644 index 0000000000..fe5cbae8fc --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86/bits/ucontext.h @@ -0,0 +1,262 @@ +/* Copyright (C) 2001-2020 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 _BITS_UCONTEXT_H +#define _BITS_UCONTEXT_H 1 + +#include + +#include +#include +#include + + +#ifdef __USE_MISC +# define __ctx(fld) fld +#else +# define __ctx(fld) __ ## fld +#endif + +#ifdef __x86_64__ + +/* Type for general register. */ +__extension__ typedef long long int greg_t; + +/* Number of general registers. */ +#define __NGREG 23 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_GNU +/* Number of each register in the `gregset_t' array. */ +enum +{ + REG_R8 = 0, +# define REG_R8 REG_R8 + REG_R9, +# define REG_R9 REG_R9 + REG_R10, +# define REG_R10 REG_R10 + REG_R11, +# define REG_R11 REG_R11 + REG_R12, +# define REG_R12 REG_R12 + REG_R13, +# define REG_R13 REG_R13 + REG_R14, +# define REG_R14 REG_R14 + REG_R15, +# define REG_R15 REG_R15 + REG_RDI, +# define REG_RDI REG_RDI + REG_RSI, +# define REG_RSI REG_RSI + REG_RBP, +# define REG_RBP REG_RBP + REG_RBX, +# define REG_RBX REG_RBX + REG_RDX, +# define REG_RDX REG_RDX + REG_RAX, +# define REG_RAX REG_RAX + REG_RCX, +# define REG_RCX REG_RCX + REG_RSP, +# define REG_RSP REG_RSP + REG_RIP, +# define REG_RIP REG_RIP + REG_EFL, +# define REG_EFL REG_EFL + REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */ +# define REG_CSGSFS REG_CSGSFS + REG_ERR, +# define REG_ERR REG_ERR + REG_TRAPNO, +# define REG_TRAPNO REG_TRAPNO + REG_OLDMASK, +# define REG_OLDMASK REG_OLDMASK + REG_CR2 +# define REG_CR2 REG_CR2 +}; +#endif + +struct _libc_fpxreg +{ + unsigned short int __ctx(significand)[4]; + unsigned short int __ctx(exponent); + unsigned short int __glibc_reserved1[3]; +}; + +struct _libc_xmmreg +{ + __uint32_t __ctx(element)[4]; +}; + +struct _libc_fpstate +{ + /* 64-bit FXSAVE format. */ + __uint16_t __ctx(cwd); + __uint16_t __ctx(swd); + __uint16_t __ctx(ftw); + __uint16_t __ctx(fop); + __uint64_t __ctx(rip); + __uint64_t __ctx(rdp); + __uint32_t __ctx(mxcsr); + __uint32_t __ctx(mxcr_mask); + struct _libc_fpxreg _st[8]; + struct _libc_xmmreg _xmm[16]; + __uint32_t __glibc_reserved1[24]; +}; + +/* Structure to describe FPU registers. */ +typedef struct _libc_fpstate *fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __ctx(gregs); + /* Note that fpregs is a pointer. */ + fpregset_t __ctx(fpregs); + __extension__ unsigned long long __reserved1 [8]; +} 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; + struct _libc_fpstate __fpregs_mem; + __extension__ unsigned long long int __ssp[4]; + } ucontext_t; + +#else /* !__x86_64__ */ + +/* Type for general register. */ +typedef int greg_t; + +/* Number of general registers. */ +#define __NGREG 19 +#ifdef __USE_MISC +# define NGREG __NGREG +#endif + +/* Container for all general registers. */ +typedef greg_t gregset_t[__NGREG]; + +#ifdef __USE_GNU +/* Number of each register is the `gregset_t' array. */ +enum +{ + REG_GS = 0, +# define REG_GS REG_GS + REG_FS, +# define REG_FS REG_FS + REG_ES, +# define REG_ES REG_ES + REG_DS, +# define REG_DS REG_DS + REG_EDI, +# define REG_EDI REG_EDI + REG_ESI, +# define REG_ESI REG_ESI + REG_EBP, +# define REG_EBP REG_EBP + REG_ESP, +# define REG_ESP REG_ESP + REG_EBX, +# define REG_EBX REG_EBX + REG_EDX, +# define REG_EDX REG_EDX + REG_ECX, +# define REG_ECX REG_ECX + REG_EAX, +# define REG_EAX REG_EAX + REG_TRAPNO, +# define REG_TRAPNO REG_TRAPNO + REG_ERR, +# define REG_ERR REG_ERR + REG_EIP, +# define REG_EIP REG_EIP + REG_CS, +# define REG_CS REG_CS + REG_EFL, +# define REG_EFL REG_EFL + REG_UESP, +# define REG_UESP REG_UESP + REG_SS +# define REG_SS REG_SS +}; +#endif + +/* Definitions taken from the kernel headers. */ +struct _libc_fpreg +{ + unsigned short int __ctx(significand)[4]; + unsigned short int __ctx(exponent); +}; + +struct _libc_fpstate +{ + unsigned long int __ctx(cw); + unsigned long int __ctx(sw); + unsigned long int __ctx(tag); + unsigned long int __ctx(ipoff); + unsigned long int __ctx(cssel); + unsigned long int __ctx(dataoff); + unsigned long int __ctx(datasel); + struct _libc_fpreg _st[8]; + unsigned long int __ctx(status); +}; + +/* Structure to describe FPU registers. */ +typedef struct _libc_fpstate *fpregset_t; + +/* Context to describe whole processor state. */ +typedef struct + { + gregset_t __ctx(gregs); + /* Due to Linux's history we have to use a pointer here. The SysV/i386 + ABI requires a struct with the values. */ + fpregset_t __ctx(fpregs); + unsigned long int __ctx(oldmask); + unsigned long int __ctx(cr2); + } 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; + struct _libc_fpstate __fpregs_mem; + unsigned long int __ssp[4]; + } ucontext_t; + +#endif /* !__x86_64__ */ + +#undef __ctx + +#endif /* bits/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86/sys/ucontext.h deleted file mode 100644 index ca9fdb4713..0000000000 --- a/sysdeps/unix/sysv/linux/x86/sys/ucontext.h +++ /dev/null @@ -1,262 +0,0 @@ -/* Copyright (C) 2001-2020 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 -#include - - -#ifdef __USE_MISC -# define __ctx(fld) fld -#else -# define __ctx(fld) __ ## fld -#endif - -#ifdef __x86_64__ - -/* Type for general register. */ -__extension__ typedef long long int greg_t; - -/* Number of general registers. */ -#define __NGREG 23 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_GNU -/* Number of each register in the `gregset_t' array. */ -enum -{ - REG_R8 = 0, -# define REG_R8 REG_R8 - REG_R9, -# define REG_R9 REG_R9 - REG_R10, -# define REG_R10 REG_R10 - REG_R11, -# define REG_R11 REG_R11 - REG_R12, -# define REG_R12 REG_R12 - REG_R13, -# define REG_R13 REG_R13 - REG_R14, -# define REG_R14 REG_R14 - REG_R15, -# define REG_R15 REG_R15 - REG_RDI, -# define REG_RDI REG_RDI - REG_RSI, -# define REG_RSI REG_RSI - REG_RBP, -# define REG_RBP REG_RBP - REG_RBX, -# define REG_RBX REG_RBX - REG_RDX, -# define REG_RDX REG_RDX - REG_RAX, -# define REG_RAX REG_RAX - REG_RCX, -# define REG_RCX REG_RCX - REG_RSP, -# define REG_RSP REG_RSP - REG_RIP, -# define REG_RIP REG_RIP - REG_EFL, -# define REG_EFL REG_EFL - REG_CSGSFS, /* Actually short cs, gs, fs, __pad0. */ -# define REG_CSGSFS REG_CSGSFS - REG_ERR, -# define REG_ERR REG_ERR - REG_TRAPNO, -# define REG_TRAPNO REG_TRAPNO - REG_OLDMASK, -# define REG_OLDMASK REG_OLDMASK - REG_CR2 -# define REG_CR2 REG_CR2 -}; -#endif - -struct _libc_fpxreg -{ - unsigned short int __ctx(significand)[4]; - unsigned short int __ctx(exponent); - unsigned short int __glibc_reserved1[3]; -}; - -struct _libc_xmmreg -{ - __uint32_t __ctx(element)[4]; -}; - -struct _libc_fpstate -{ - /* 64-bit FXSAVE format. */ - __uint16_t __ctx(cwd); - __uint16_t __ctx(swd); - __uint16_t __ctx(ftw); - __uint16_t __ctx(fop); - __uint64_t __ctx(rip); - __uint64_t __ctx(rdp); - __uint32_t __ctx(mxcsr); - __uint32_t __ctx(mxcr_mask); - struct _libc_fpxreg _st[8]; - struct _libc_xmmreg _xmm[16]; - __uint32_t __glibc_reserved1[24]; -}; - -/* Structure to describe FPU registers. */ -typedef struct _libc_fpstate *fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - gregset_t __ctx(gregs); - /* Note that fpregs is a pointer. */ - fpregset_t __ctx(fpregs); - __extension__ unsigned long long __reserved1 [8]; -} 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; - struct _libc_fpstate __fpregs_mem; - __extension__ unsigned long long int __ssp[4]; - } ucontext_t; - -#else /* !__x86_64__ */ - -/* Type for general register. */ -typedef int greg_t; - -/* Number of general registers. */ -#define __NGREG 19 -#ifdef __USE_MISC -# define NGREG __NGREG -#endif - -/* Container for all general registers. */ -typedef greg_t gregset_t[__NGREG]; - -#ifdef __USE_GNU -/* Number of each register is the `gregset_t' array. */ -enum -{ - REG_GS = 0, -# define REG_GS REG_GS - REG_FS, -# define REG_FS REG_FS - REG_ES, -# define REG_ES REG_ES - REG_DS, -# define REG_DS REG_DS - REG_EDI, -# define REG_EDI REG_EDI - REG_ESI, -# define REG_ESI REG_ESI - REG_EBP, -# define REG_EBP REG_EBP - REG_ESP, -# define REG_ESP REG_ESP - REG_EBX, -# define REG_EBX REG_EBX - REG_EDX, -# define REG_EDX REG_EDX - REG_ECX, -# define REG_ECX REG_ECX - REG_EAX, -# define REG_EAX REG_EAX - REG_TRAPNO, -# define REG_TRAPNO REG_TRAPNO - REG_ERR, -# define REG_ERR REG_ERR - REG_EIP, -# define REG_EIP REG_EIP - REG_CS, -# define REG_CS REG_CS - REG_EFL, -# define REG_EFL REG_EFL - REG_UESP, -# define REG_UESP REG_UESP - REG_SS -# define REG_SS REG_SS -}; -#endif - -/* Definitions taken from the kernel headers. */ -struct _libc_fpreg -{ - unsigned short int __ctx(significand)[4]; - unsigned short int __ctx(exponent); -}; - -struct _libc_fpstate -{ - unsigned long int __ctx(cw); - unsigned long int __ctx(sw); - unsigned long int __ctx(tag); - unsigned long int __ctx(ipoff); - unsigned long int __ctx(cssel); - unsigned long int __ctx(dataoff); - unsigned long int __ctx(datasel); - struct _libc_fpreg _st[8]; - unsigned long int __ctx(status); -}; - -/* Structure to describe FPU registers. */ -typedef struct _libc_fpstate *fpregset_t; - -/* Context to describe whole processor state. */ -typedef struct - { - gregset_t __ctx(gregs); - /* Due to Linux's history we have to use a pointer here. The SysV/i386 - ABI requires a struct with the values. */ - fpregset_t __ctx(fpregs); - unsigned long int __ctx(oldmask); - unsigned long int __ctx(cr2); - } 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; - struct _libc_fpstate __fpregs_mem; - unsigned long int __ssp[4]; - } ucontext_t; - -#endif /* !__x86_64__ */ - -#undef __ctx - -#endif /* sys/ucontext.h */ diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym index c08b3b8b47..4bffe048a0 100644 --- a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym @@ -1,6 +1,5 @@ #include #include -#include -- -- cgit v1.2.3