This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Add x32 support to sys/ucontext.h
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 16 May 2012 06:20:16 -0700
- Subject: PATCH: Add x32 support to sys/ucontext.h
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch adds x32 support to sys/ucontext.h. X32 also uses
unsigned long int uc_flags
in ucontext_t since this is how kernel sets it up. Tested on
Linux/x86-64. OK to install?
Thanks.
H.J.
----
* sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h: Don't
include <bits/wordsize.h>. Check __x86_64__ instead of
__WORDSIZE.
(greg_t): Use "long long int" if __x86_64__ is defined.
(mcontext_t): Replace "unsigned long" with "unsigned long long".
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
index a397620..93cfa8b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
@@ -20,16 +20,15 @@
#include <features.h>
#include <signal.h>
-#include <bits/wordsize.h>
/* We need the signal context definitions even if they are not used
included in <signal.h>. */
#include <bits/sigcontext.h>
-#if __WORDSIZE == 64
+#ifdef __x86_64__
/* Type for general register. */
-typedef long int greg_t;
+typedef long long int greg_t;
/* Number of general registers. */
#define NGREG 23
@@ -127,7 +126,7 @@ typedef struct
gregset_t gregs;
/* Note that fpregs is a pointer. */
fpregset_t fpregs;
- unsigned long __reserved1 [8];
+ unsigned long long __reserved1 [8];
} mcontext_t;
/* Userlevel context. */
@@ -141,7 +140,7 @@ typedef struct ucontext
struct _libc_fpstate __fpregs_mem;
} ucontext_t;
-#else /* __WORDSIZE == 32 */
+#else /* !__x86_64__ */
/* Type for general register. */
typedef int greg_t;
@@ -242,6 +241,6 @@ typedef struct ucontext
struct _libc_fpstate __fpregs_mem;
} ucontext_t;
-#endif /* __WORDSIZE == 32 */
+#endif /* !__x86_64__ */
#endif /* sys/ucontext.h */