about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/ia64/bits
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/ia64/bits')
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/procfs.h5
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h9
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/types/__ia64_fpreg.h22
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/ucontext.h98
4 files changed, 122 insertions, 12 deletions
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 <bits/procfs.h> directly; use <sys/procfs.h> instead."
 #endif
 
-/* For struct __ia64_fpreg.  FIXME: sys/procfs.h should not expose all
-   of sys/ucontext.h.  */
-#include <sys/ucontext.h>
-#include <bits/sigcontext.h>
+#include <bits/types/__ia64_fpreg.h>
 
 /* 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 <bits/types/size_t.h>
 #include <bits/types/struct_sigstack.h>
 #include <bits/types/stack_t.h>
+#include <bits/types/__ia64_fpreg.h>
 #include <bits/sigstack.h>
 #include <bits/ss_flags.h>
 
-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 <features.h>
+
+#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
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_UCONTEXT_H
+#define _BITS_UCONTEXT_H	1
+
+#include <features.h>
+
+#include <bits/types/sigset_t.h>
+#include <bits/types/stack_t.h>
+#include <bits/types/__ia64_fpreg.h>
+
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
+/*
+ * These are here mostly for backwards compatibility with older Unices.
+ * IA-64 Linux does not distinguish between "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 */