lkml.org 
[lkml]   [2014]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 07/24] ARM64:ILP32: Use the same size and layout of the signal structures for ILP32 as for LP64
Date
Defines the macros which allow the signal structures to be the same between ILP32 and LP64.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
---
arch/arm64/include/uapi/asm/siginfo.h | 33 ++++++++++++++++++++++++++++++++
arch/arm64/include/uapi/asm/signal.h | 34 +++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/arch/arm64/include/uapi/asm/siginfo.h b/arch/arm64/include/uapi/asm/siginfo.h
index 5a74a08..c80c612 100644
--- a/arch/arm64/include/uapi/asm/siginfo.h
+++ b/arch/arm64/include/uapi/asm/siginfo.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 ARM Ltd.
+ * Copyright (C) 2014 Cavium Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -18,6 +19,38 @@

#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))

+#ifdef __ILP32__
+
+/*
+ * For ILP32, the siginfo structures should share the same layout and
+ * alignement requirements as LP64 ABI.
+ * To do this, use an extra pad field and add aligned attribute
+ * to the structure.
+ */
+
+# ifdef __AARCH64EB__
+# define __SIGINFO_INNER(type, field) \
+ int __pad#field; \
+ type field
+# else
+# define __SIGINFO_INNER(type, field) \
+ type field; \
+ int __pad#field
+# endif
+
+# undef __SIGINFO_VOIDPTR
+# define __SIGINFO_VOIDPTR(field) \
+ __SIGINFO_INNER(void __user*, field)
+# undef __SIGINFO_BAND
+
+# define __SIGINFO_BAND(field) \
+ __SIGINFO_INNER(long, field)
+
+/* Make the alignment of siginfo always 8 byte aligned. */
+#define __ARCH_SI_ATTRIBUTES __attribute__((aligned(8)))
+
+#endif
+
#include <asm-generic/siginfo.h>

#endif
diff --git a/arch/arm64/include/uapi/asm/signal.h b/arch/arm64/include/uapi/asm/signal.h
index 8d1e723..d33a5f7 100644
--- a/arch/arm64/include/uapi/asm/signal.h
+++ b/arch/arm64/include/uapi/asm/signal.h
@@ -16,9 +16,43 @@
#ifndef __ASM_SIGNAL_H
#define __ASM_SIGNAL_H

+#include <asm/posix-types.h>
+
/* Required for AArch32 compatibility. */
#define SA_RESTORER 0x04000000

+/*
+ * Since sigset is a bitmask, we need the same size fields for ILP32
+ * and LP64. With big-endian, 32bit bitmask does not match up to
+ * 64bit bitmask (unlike with little-endian).
+ */
+#ifdef __ILP32__
+
+#define __SIGSET_INNER_TYPE __kernel_ulong_t
+#define _NSIG_BPW 64
+
+# ifdef __AARCH64EB__
+# define __SIGNAL_INNER(type, field) \
+ int __pad_##field; \
+ type field;
+# else
+# define __SIGNAL_INNER(type, field) \
+ type field; \
+ int __pad_##field;
+# endif
+
+# define __SIGACTION_HANDLER(field) \
+ __SIGNAL_INNER(__sighandler_t, field)
+
+
+#define __SIGACTION_FLAGS(field) \
+ __kernel_ulong_t field
+
+#define __SIGACTION_RESTORER(field) \
+ __SIGNAL_INNER(__sigrestore_t, field)
+
+#endif
+
#include <asm-generic/signal.h>

#endif
--
1.7.2.5


\
 
 \ /
  Last update: 2014-09-04 00:01    [W:0.224 / U:0.016 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site