about summary refs log tree commit diff
path: root/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/sysdeps/unix/sysv/linux/x86/sys
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.gz
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.xz
glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.zip
Prepare for radical source tree reorganization. zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage
directory, REORG.TODO, except for files that will certainly still
exist in their current form at top level when we're done (COPYING,
COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which
are moved to the new directory OldChangeLogs, instead), and the
generated file INSTALL (which is just deleted; in the new order, there
will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/sysdeps/unix/sysv/linux/x86/sys')
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/debugreg.h88
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/elf.h29
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/io.h183
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/perm.h35
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/procfs.h145
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/reg.h77
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/ucontext.h260
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/user.h180
-rw-r--r--REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/vm86.h38
9 files changed, 1035 insertions, 0 deletions
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/debugreg.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/debugreg.h
new file mode 100644
index 0000000000..eaa79a882b
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/debugreg.h
@@ -0,0 +1,88 @@
+/* Copyright (C) 2001-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_DEBUGREG_H
+#define _SYS_DEBUGREG_H	1
+
+/* Indicate the register numbers for a number of the specific
+   debug registers.  Registers 0-3 contain the addresses we wish to trap on */
+#define DR_FIRSTADDR 0        /* u_debugreg[DR_FIRSTADDR] */
+#define DR_LASTADDR 3         /* u_debugreg[DR_LASTADDR]  */
+
+#define DR_STATUS 6           /* u_debugreg[DR_STATUS]     */
+#define DR_CONTROL 7          /* u_debugreg[DR_CONTROL] */
+
+/* Define a few things for the status register.  We can use this to determine
+   which debugging register was responsible for the trap.  The other bits
+   are either reserved or not of interest to us. */
+
+#define DR_TRAP0	(0x1)		/* db0 */
+#define DR_TRAP1	(0x2)		/* db1 */
+#define DR_TRAP2	(0x4)		/* db2 */
+#define DR_TRAP3	(0x8)		/* db3 */
+
+#define DR_STEP		(0x4000)	/* single-step */
+#define DR_SWITCH	(0x8000)	/* task switch */
+
+/* Now define a bunch of things for manipulating the control register.
+   The top two bytes of the control register consist of 4 fields of 4
+   bits - each field corresponds to one of the four debug registers,
+   and indicates what types of access we trap on, and how large the data
+   field is that we are looking at */
+
+#define DR_CONTROL_SHIFT 16   /* Skip this many bits in ctl register */
+#define DR_CONTROL_SIZE  4    /* 4 control bits per register */
+
+#define DR_RW_EXECUTE	(0x0) /* Settings for the access types to trap on */
+#define DR_RW_WRITE	(0x1)
+#define DR_RW_READ	(0x3)
+
+#define DR_LEN_1 (0x0)	      /* Settings for data length to trap on */
+#define DR_LEN_2 (0x4)
+#define DR_LEN_4 (0xC)
+#ifdef __x86_64__
+# define DR_LEN_8 (0x8)
+#endif
+
+/* The low byte to the control register determine which registers are
+   enabled.  There are 4 fields of two bits.  One bit is "local", meaning
+   that the processor will reset the bit after a task switch and the other
+   is global meaning that we have to explicitly reset the bit.  With linux,
+   you can use either one, since we explicitly zero the register when we enter
+   kernel mode. */
+
+#define DR_LOCAL_ENABLE_SHIFT  0   /* Extra shift to the local enable bit */
+#define DR_GLOBAL_ENABLE_SHIFT 1   /* Extra shift to the global enable bit */
+#define DR_ENABLE_SIZE	       2   /* 2 enable bits per register */
+
+#define DR_LOCAL_ENABLE_MASK  (0x55) /* Set  local bits for all 4 regs */
+#define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */
+
+/* The second byte to the control register has a few special
+   things.  */
+
+
+
+#ifdef __x86_64__
+# define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00ULL) /* Reserved */
+#else
+# define DR_CONTROL_RESERVED (0x00FC00U) /* Reserved */
+#endif
+#define DR_LOCAL_SLOWDOWN   (0x100)  /* Local slow the pipeline */
+#define DR_GLOBAL_SLOWDOWN  (0x200)  /* Global slow the pipeline */
+
+#endif	/* sys/debugreg.h */
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/elf.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/elf.h
new file mode 100644
index 0000000000..9b58e1a540
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/elf.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 1998-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_ELF_H
+#define _SYS_ELF_H	1
+
+#ifdef __x86_64__
+# error This header is unsupported on x86-64.
+#else
+# warning "This header is obsolete; use <sys/procfs.h> instead."
+
+# include <sys/procfs.h>
+#endif
+
+#endif	/* _SYS_ELF_H */
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/io.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/io.h
new file mode 100644
index 0000000000..3041a59c1a
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/io.h
@@ -0,0 +1,183 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef	_SYS_IO_H
+#define	_SYS_IO_H	1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* If TURN_ON is TRUE, request for permission to do direct i/o on the
+   port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
+   permission off for that range.  This call requires root privileges.
+
+   Portability note: not all Linux platforms support this call.  Most
+   platforms based on the PC I/O architecture probably will, however.
+   E.g., Linux/Alpha for Alpha PCs supports this.  */
+extern int ioperm (unsigned long int __from, unsigned long int __num,
+                   int __turn_on) __THROW;
+
+/* Set the I/O privilege level to LEVEL.  If LEVEL>3, permission to
+   access any I/O port is granted.  This call requires root
+   privileges. */
+extern int iopl (int __level) __THROW;
+
+#if defined __GNUC__ && __GNUC__ >= 2
+
+static __inline unsigned char
+inb (unsigned short int __port)
+{
+  unsigned char _v;
+
+  __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port));
+  return _v;
+}
+
+static __inline unsigned char
+inb_p (unsigned short int __port)
+{
+  unsigned char _v;
+
+  __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
+  return _v;
+}
+
+static __inline unsigned short int
+inw (unsigned short int __port)
+{
+  unsigned short _v;
+
+  __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port));
+  return _v;
+}
+
+static __inline unsigned short int
+inw_p (unsigned short int __port)
+{
+  unsigned short int _v;
+
+  __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
+  return _v;
+}
+
+static __inline unsigned int
+inl (unsigned short int __port)
+{
+  unsigned int _v;
+
+  __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port));
+  return _v;
+}
+
+static __inline unsigned int
+inl_p (unsigned short int __port)
+{
+  unsigned int _v;
+  __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
+  return _v;
+}
+
+static __inline void
+outb (unsigned char __value, unsigned short int __port)
+{
+  __asm__ __volatile__ ("outb %b0,%w1": :"a" (__value), "Nd" (__port));
+}
+
+static __inline void
+outb_p (unsigned char __value, unsigned short int __port)
+{
+  __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (__value),
+			"Nd" (__port));
+}
+
+static __inline void
+outw (unsigned short int __value, unsigned short int __port)
+{
+  __asm__ __volatile__ ("outw %w0,%w1": :"a" (__value), "Nd" (__port));
+
+}
+
+static __inline void
+outw_p (unsigned short int __value, unsigned short int __port)
+{
+  __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (__value),
+			"Nd" (__port));
+}
+
+static __inline void
+outl (unsigned int __value, unsigned short int __port)
+{
+  __asm__ __volatile__ ("outl %0,%w1": :"a" (__value), "Nd" (__port));
+}
+
+static __inline void
+outl_p (unsigned int __value, unsigned short int __port)
+{
+  __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (__value),
+			"Nd" (__port));
+}
+
+static __inline void
+insb (unsigned short int __port, void *__addr, unsigned long int __count)
+{
+  __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count)
+			:"d" (__port), "0" (__addr), "1" (__count));
+}
+
+static __inline void
+insw (unsigned short int __port, void *__addr, unsigned long int __count)
+{
+  __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count)
+			:"d" (__port), "0" (__addr), "1" (__count));
+}
+
+static __inline void
+insl (unsigned short int __port, void *__addr, unsigned long int __count)
+{
+  __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count)
+			:"d" (__port), "0" (__addr), "1" (__count));
+}
+
+static __inline void
+outsb (unsigned short int __port, const void *__addr,
+       unsigned long int __count)
+{
+  __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count)
+			:"d" (__port), "0" (__addr), "1" (__count));
+}
+
+static __inline void
+outsw (unsigned short int __port, const void *__addr,
+       unsigned long int __count)
+{
+  __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count)
+			:"d" (__port), "0" (__addr), "1" (__count));
+}
+
+static __inline void
+outsl (unsigned short int __port, const void *__addr,
+       unsigned long int __count)
+{
+  __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count)
+			:"d" (__port), "0" (__addr), "1" (__count));
+}
+
+#endif	/* GNU C */
+
+__END_DECLS
+#endif /* _SYS_IO_H */
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/perm.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/perm.h
new file mode 100644
index 0000000000..a6e0c0c5a3
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/perm.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_PERM_H
+
+#define _SYS_PERM_H	1
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Set port input/output permissions.  */
+extern int ioperm (unsigned long int __from, unsigned long int __num,
+		   int __turn_on) __THROW;
+
+
+/* Change I/O privilege level.  */
+extern int iopl (int __level) __THROW;
+
+__END_DECLS
+
+#endif	/* _SYS_PERM_H */
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/procfs.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/procfs.h
new file mode 100644
index 0000000000..577c3de655
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/procfs.h
@@ -0,0 +1,145 @@
+/* Copyright (C) 2001-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H	1
+
+/* This is somewhat modelled after the file of the same name on SVR4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  It doesn't have anything to do with the /proc file
+   system, even though Linux has one.
+
+   Anyway, the whole purpose of this file is for GDB and GDB only.
+   Don't read too much into it.  Don't use it for anything other than
+   GDB unless you know what you are doing.  */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register.  */
+#ifdef __x86_64__
+__extension__ typedef unsigned long long elf_greg_t;
+#else
+typedef unsigned long elf_greg_t;
+#endif
+
+/* And the whole bunch of them.  We could have used `struct
+   user_regs_struct' directly in the typedef, but tradition says that
+   the register set is an array, which does have some peculiar
+   semantics, so leave it that way.  */
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+#ifndef __x86_64__
+/* Register set for the floating-point registers.  */
+typedef struct user_fpregs_struct elf_fpregset_t;
+
+/* Register set for the extended floating-point registers.  Includes
+   the Pentium III SSE registers in addition to the classic
+   floating-point stuff.  */
+typedef struct user_fpxregs_struct elf_fpxregset_t;
+#else
+/* Register set for the extended floating-point registers.  Includes
+   the Pentium III SSE registers in addition to the classic
+   floating-point stuff.  */
+typedef struct user_fpregs_struct elf_fpregset_t;
+#endif
+
+/* Signal info.  */
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with Linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   GDB doesn't really use excluded.  */
+
+struct elf_prstatus
+  {
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+#if __WORDSIZE == 32
+    unsigned short int pr_uid;
+    unsigned short int pr_gid;
+#else
+    unsigned int pr_uid;
+    unsigned int pr_gid;
+#endif
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+
+/* The rest of this file provides the types for emulation of the
+   Solaris <proc_service.h> interfaces that should be implemented by
+   users of libthread_db.  */
+
+/* Addresses.  */
+typedef void *psaddr_t;
+
+/* Register sets.  Linux has different names.  */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+   therefore have only one PID type.  */
+typedef __pid_t lwpid_t;
+
+/* Process status and info.  In the end we do provide typedefs for them.  */
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/reg.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/reg.h
new file mode 100644
index 0000000000..ceca1334e3
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/reg.h
@@ -0,0 +1,77 @@
+/* Copyright (C) 2001-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_REG_H
+#define _SYS_REG_H	1
+
+
+#ifdef __x86_64__
+/* Index into an array of 8 byte longs returned from ptrace for
+   location of the users' stored general purpose registers.  */
+
+# define R15	0
+# define R14	1
+# define R13	2
+# define R12	3
+# define RBP	4
+# define RBX	5
+# define R11	6
+# define R10	7
+# define R9	8
+# define R8	9
+# define RAX	10
+# define RCX	11
+# define RDX	12
+# define RSI	13
+# define RDI	14
+# define ORIG_RAX 15
+# define RIP	16
+# define CS	17
+# define EFLAGS	18
+# define RSP	19
+# define SS	20
+# define FS_BASE 21
+# define GS_BASE 22
+# define DS	23
+# define ES	24
+# define FS	25
+# define GS	26
+#else
+
+/* Index into an array of 4 byte integers returned from ptrace for
+ * location of the users' stored general purpose registers. */
+
+# define EBX 0
+# define ECX 1
+# define EDX 2
+# define ESI 3
+# define EDI 4
+# define EBP 5
+# define EAX 6
+# define DS 7
+# define ES 8
+# define FS 9
+# define GS 10
+# define ORIG_EAX 11
+# define EIP 12
+# define CS  13
+# define EFL 14
+# define UESP 15
+# define SS   16
+#endif
+
+#endif
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/ucontext.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/ucontext.h
new file mode 100644
index 0000000000..5fd64bf801
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/ucontext.h
@@ -0,0 +1,260 @@
+/* Copyright (C) 2001-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+
+#include <bits/types/sigset_t.h>
+#include <bits/sigcontext.h>
+#include <bits/types/stack_t.h>
+
+
+#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	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
+  {
+    unsigned long int uc_flags;
+    struct ucontext *uc_link;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    sigset_t uc_sigmask;
+    struct _libc_fpstate __fpregs_mem;
+  } 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
+  {
+    unsigned long int uc_flags;
+    struct ucontext *uc_link;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    sigset_t uc_sigmask;
+    struct _libc_fpstate __fpregs_mem;
+  } ucontext_t;
+
+#endif /* !__x86_64__ */
+
+#undef __ctx
+
+#endif /* sys/ucontext.h */
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/user.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/user.h
new file mode 100644
index 0000000000..b705239e61
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/user.h
@@ -0,0 +1,180 @@
+/* Copyright (C) 2001-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_USER_H
+#define _SYS_USER_H	1
+
+/* The whole purpose of this file is for GDB and GDB only.  Don't read
+   too much into it.  Don't use it for anything other than GDB unless
+   you know what you are doing.  */
+
+#ifdef __x86_64__
+
+struct user_fpregs_struct
+{
+  unsigned short int	cwd;
+  unsigned short int	swd;
+  unsigned short int	ftw;
+  unsigned short int	fop;
+  __extension__ unsigned long long int rip;
+  __extension__ unsigned long long int rdp;
+  unsigned int		mxcsr;
+  unsigned int		mxcr_mask;
+  unsigned int		st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
+  unsigned int		xmm_space[64];  /* 16*16 bytes for each XMM-reg = 256 bytes */
+  unsigned int		padding[24];
+};
+
+struct user_regs_struct
+{
+  __extension__ unsigned long long int r15;
+  __extension__ unsigned long long int r14;
+  __extension__ unsigned long long int r13;
+  __extension__ unsigned long long int r12;
+  __extension__ unsigned long long int rbp;
+  __extension__ unsigned long long int rbx;
+  __extension__ unsigned long long int r11;
+  __extension__ unsigned long long int r10;
+  __extension__ unsigned long long int r9;
+  __extension__ unsigned long long int r8;
+  __extension__ unsigned long long int rax;
+  __extension__ unsigned long long int rcx;
+  __extension__ unsigned long long int rdx;
+  __extension__ unsigned long long int rsi;
+  __extension__ unsigned long long int rdi;
+  __extension__ unsigned long long int orig_rax;
+  __extension__ unsigned long long int rip;
+  __extension__ unsigned long long int cs;
+  __extension__ unsigned long long int eflags;
+  __extension__ unsigned long long int rsp;
+  __extension__ unsigned long long int ss;
+  __extension__ unsigned long long int fs_base;
+  __extension__ unsigned long long int gs_base;
+  __extension__ unsigned long long int ds;
+  __extension__ unsigned long long int es;
+  __extension__ unsigned long long int fs;
+  __extension__ unsigned long long int gs;
+};
+
+struct user
+{
+  struct user_regs_struct	regs;
+  int				u_fpvalid;
+  struct user_fpregs_struct	i387;
+  __extension__ unsigned long long int	u_tsize;
+  __extension__ unsigned long long int	u_dsize;
+  __extension__ unsigned long long int	u_ssize;
+  __extension__ unsigned long long int	start_code;
+  __extension__ unsigned long long int	start_stack;
+  __extension__ long long int		signal;
+  int				reserved;
+  __extension__ union
+    {
+      struct user_regs_struct*	u_ar0;
+      __extension__ unsigned long long int	__u_ar0_word;
+    };
+  __extension__ union
+    {
+      struct user_fpregs_struct*	u_fpstate;
+      __extension__ unsigned long long int	__u_fpstate_word;
+    };
+  __extension__ unsigned long long int	magic;
+  char				u_comm [32];
+  __extension__ unsigned long long int	u_debugreg [8];
+};
+
+#else
+/* These are the 32-bit x86 structures.  */
+struct user_fpregs_struct
+{
+  long int cwd;
+  long int swd;
+  long int twd;
+  long int fip;
+  long int fcs;
+  long int foo;
+  long int fos;
+  long int st_space [20];
+};
+
+struct user_fpxregs_struct
+{
+  unsigned short int cwd;
+  unsigned short int swd;
+  unsigned short int twd;
+  unsigned short int fop;
+  long int fip;
+  long int fcs;
+  long int foo;
+  long int fos;
+  long int mxcsr;
+  long int reserved;
+  long int st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
+  long int xmm_space[32];  /* 8*16 bytes for each XMM-reg = 128 bytes */
+  long int padding[56];
+};
+
+struct user_regs_struct
+{
+  long int ebx;
+  long int ecx;
+  long int edx;
+  long int esi;
+  long int edi;
+  long int ebp;
+  long int eax;
+  long int xds;
+  long int xes;
+  long int xfs;
+  long int xgs;
+  long int orig_eax;
+  long int eip;
+  long int xcs;
+  long int eflags;
+  long int esp;
+  long int xss;
+};
+
+struct user
+{
+  struct user_regs_struct	regs;
+  int				u_fpvalid;
+  struct user_fpregs_struct	i387;
+  unsigned long int		u_tsize;
+  unsigned long int		u_dsize;
+  unsigned long int		u_ssize;
+  unsigned long int		start_code;
+  unsigned long int		start_stack;
+  long int			signal;
+  int				reserved;
+  struct user_regs_struct*	u_ar0;
+  struct user_fpregs_struct*	u_fpstate;
+  unsigned long int		magic;
+  char				u_comm [32];
+  int				u_debugreg [8];
+};
+#endif  /* __x86_64__ */
+
+#define PAGE_SHIFT		12
+#define PAGE_SIZE		(1UL << PAGE_SHIFT)
+#define PAGE_MASK		(~(PAGE_SIZE-1))
+#define NBPG			PAGE_SIZE
+#define UPAGES			1
+#define HOST_TEXT_START_ADDR	(u.start_code)
+#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
+
+#endif	/* _SYS_USER_H */
diff --git a/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/vm86.h b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/vm86.h
new file mode 100644
index 0000000000..07f09c2030
--- /dev/null
+++ b/REORG.TODO/sysdeps/unix/sysv/linux/x86/sys/vm86.h
@@ -0,0 +1,38 @@
+/* Copyright (C) 1996-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SYS_VM86_H
+
+#define _SYS_VM86_H	1
+#include <features.h>
+
+#ifdef __x86_64__
+# error This header is unsupported on x86-64.
+#else
+/* Get constants and data types from kernel header file.  */
+# include <asm/vm86.h>
+
+__BEGIN_DECLS
+
+/* Enter virtual 8086 mode.  */
+extern int vm86 (unsigned long int __subfunction,
+		 struct vm86plus_struct *__info) __THROW;
+
+__END_DECLS
+# endif
+
+#endif	/* _SYS_VM86_H */