[27/29,AARCH64] Fix up ucontext for ILP32

Message ID 1414396793-9005-28-git-send-email-apinski@cavium.com
State New, archived
Headers

Commit Message

Andrew Pinski Oct. 27, 2014, 7:59 a.m. UTC
  In ILP32 we want to use the same layout of the structure ucontext as LP64 so
we need to add a padding for uc_link and change the type of uc_flags to
be the kernel unsigned long type.

* sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct ucontext):
Change the type of uc_flags to __SYSCALL_ULONG_TYPE.
Add padding for uc_link if ILP32.
---
 sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
  

Comments

Mike Frysinger Oct. 28, 2014, 8:10 p.m. UTC | #1
On 27 Oct 2014 00:59, Andrew Pinski wrote:
> --- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> @@ -46,8 +46,14 @@ typedef struct sigcontext mcontext_t;
>  /* Userlevel context.  */
>  typedef struct ucontext
>    {
> -    unsigned long uc_flags;
> -    struct ucontext *uc_link;
> +    __SYSCALL_ULONG_TYPE uc_flags;
> +#if defined(__ILP32__) && defined(__AARCH64EB__)
> +    int __pad_uc_link;
> +#endif
> +     struct ucontext *uc_link;
> +#if defined(__ILP32__) && !defined(__AARCH64EB__)
> +    int __pad_uc_link;
> +#endif

would it be better to leverage the common __BYTE_ORDER ?  would make it easier 
for other people to make changes and be confident on not screwing up if we used 
the same set of defines ...
-mike
  
Will Newton Nov. 18, 2014, 2:54 p.m. UTC | #2
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> In ILP32 we want to use the same layout of the structure ucontext as LP64 so
> we need to add a padding for uc_link and change the type of uc_flags to
> be the kernel unsigned long type.
>
> * sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h (struct ucontext):
> Change the type of uc_flags to __SYSCALL_ULONG_TYPE.
> Add padding for uc_link if ILP32.
> ---
>  sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> index 476f5de..5d224fb 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
> @@ -46,8 +46,14 @@ typedef struct sigcontext mcontext_t;
>  /* Userlevel context.  */
>  typedef struct ucontext
>    {
> -    unsigned long uc_flags;
> -    struct ucontext *uc_link;
> +    __SYSCALL_ULONG_TYPE uc_flags;

Is there a reason to use this instead of __syscall_ulong_t?

> +#if defined(__ILP32__) && defined(__AARCH64EB__)
> +    int __pad_uc_link;
> +#endif
> +     struct ucontext *uc_link;
> +#if defined(__ILP32__) && !defined(__AARCH64EB__)
> +    int __pad_uc_link;
> +#endif
>      stack_t uc_stack;
>      __sigset_t uc_sigmask;
>      mcontext_t uc_mcontext;
> --
> 1.7.2.5
>
  

Patch

diff --git a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
index 476f5de..5d224fb 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h
@@ -46,8 +46,14 @@  typedef struct sigcontext mcontext_t;
 /* Userlevel context.  */
 typedef struct ucontext
   {
-    unsigned long uc_flags;
-    struct ucontext *uc_link;
+    __SYSCALL_ULONG_TYPE uc_flags;
+#if defined(__ILP32__) && defined(__AARCH64EB__)
+    int __pad_uc_link;
+#endif
+     struct ucontext *uc_link;
+#if defined(__ILP32__) && !defined(__AARCH64EB__)
+    int __pad_uc_link;
+#endif
     stack_t uc_stack;
     __sigset_t uc_sigmask;
     mcontext_t uc_mcontext;