Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754895AbbKQVSx (ORCPT ); Tue, 17 Nov 2015 16:18:53 -0500 Received: from mail-bl2on0080.outbound.protection.outlook.com ([65.55.169.80]:53152 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752819AbbKQVSu (ORCPT ); Tue, 17 Nov 2015 16:18:50 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , , , CC: , , , , , , , , , , , , , , Yury Norov Subject: [PATCH v6 06/19] arm64:ilp32: share signal structures between ILP32 and LP64 ABIs Date: Wed, 18 Nov 2015 00:16:46 +0300 Message-ID: <1447795019-30176-7-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447795019-30176-1-git-send-email-ynorov@caviumnetworks.com> References: <1447795019-30176-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.143.213.120] X-ClientProxiedBy: DB5PR04CA0023.eurprd04.prod.outlook.com (25.164.34.161) To CO2PR07MB618.namprd07.prod.outlook.com (10.141.228.149) X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB618;2:3pcdDgjPgIVgZY0+xUIvPQiME4AlIu9kG8b9z8V7sf+3IV05NtD6GMqf0AHIPS9wgORh4XRQbsQi4suuNZoNydCfIBsJxrbhWFSE1jZL0eOJ/9iupV+nM+rKSmZNUINSot6aSU84KDVf9k+LhSHwSHqmigguxJBPiXkJ0SSDuxI=;3:p4gGtkJtrqLlAphNQR2gzHN3sSnbLhBwKjUL7CFjkdXzo8FpLch9oe5uRSVukCEE2xmLhItEiBClY+BxaGVrSU+faoVstFqxuzuKXn/xiig8/pUViAFA72Xy9ctW53DmqNfbc/pAj0I2EyGcgR+Nmg==;25:qQMLKK9QEPZchnhbBtny82CwfsyU/YI2x3FIqlpb4JkaxhLMAXKF9fymLm1LIuqoX6jbxv74vsWkpRXnut9/Ce8MIzlWGE+N8Xw1UcOKdffX6aN8Tjwkxyp/xLKhN0ONXXfF/eUbcZRH7l9gHRyD57Y03c0/Dku/QGFK7j8Pqhv4BL49R03b8gzegWPwzn6lVB50bLsbG+UtdgFey65ls1uIyNMoEbg6EXF/AH4pNkJhWcfarda/MdXQOP/6nELGTxTBgpi5X75gGmlZGJQ4rQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB618; X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB618;20:9xVTXJEg8GJmHlrK6RRrZxLsYFDRJ5uQU0GaFZYMHXPbLChNL4a0P2DGT79VcuTEcGRblry71vWGUn//n1FhZas8Vyl2Zoq9lVXawW9sKmkz+ZJ0eA2cAmsHBJNwPBPw++K1uJMjzuGubJvTD4rDozOb2p84BePToHg4H62Lp5XHp35CBwfFYVFeQBp0/dOcDHh89uxZbyFdgwalur57OkADwnG6H3FP/GInUhk9SRRWC801EHEWebu7qEkJEs67QRZJCcPvgr9mIs9LLBIvN9zOeQNqqhTy99xeCuWdCVh/Efm1mJT26dzjTolNwDHA2PyvY6TLPAFzP3LBaY1x7njG52KXbOuSC/QIXGR7R2eVY/w7j5UOi/twaaZeqXC17UDwR9TSB5Y21O5YZKloRtEIe6QvuoVxfKfEQ14gJGuih/+wstw+XpLTPEHcymlJAu1Vj0Fyc46eTvZVhxPfJblX36csLyBlR9zTgSN0N+7n5S7Hb9/q1NXa2aRK30cOdkWvBubjL0ivYabiDfzGFms0sWDYc+BYOES4Xd496D0TCWNELAUExQeYgCep/sfhwmDie+Yi/+Kg3ZaytQqe7jlfiPMp5p4ccKKh8LEHY2o= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046);SRVR:CO2PR07MB618;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB618; X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB618;4:gkYv4NU9VTOsg6O936ZN1yC6+40gcEdVA4gz5dgFnIQ0Ivt4Jcz5spkJ1ImynzSsW/CMSWHL2qmBXzELhFE5qK/swY7dDdrrzlSIR0mBkRG4gyBWmr3xrd7V8Cp+Wegmizs2C5L64a/3KC3FExif7zVYRm07BOX3ui0LJLGt1P/j4Cno8izr4RvGJanm4bBH5pb+04zt2jWO8xmQQpsYiQViz5K0bEdTqFptWbruA4QCiDhpFUn5Ae6ITva6bvZZt2t4Urwxhg3CpUGEs7uTeuWxm8geZ2+pPX+xtX9lPKIKLj6dOAf/DEm/Csb0l7Vh5gWH12et/O3K1ArwAgdU5zYmh0VkQUXgoYnTzHyqZ1XB+d6J5n34o5vgyVk9TNxx X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6069001)(199003)(189002)(92566002)(19580395003)(48376002)(81156007)(36756003)(5008740100001)(40100003)(5003940100001)(106356001)(105586002)(107886002)(76176999)(50466002)(76506005)(50226001)(42186005)(229853001)(4001430100002)(5001770100001)(33646002)(5001960100002)(101416001)(2950100001)(50986999)(19580405001)(87976001)(586003)(189998001)(77096005)(5004730100002)(122386002)(97736004)(5007970100001)(66066001)(2201001)(47776003)(2004002)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB618;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO2PR07MB618;23:gksTlqsClm/x8+dgLBNlWV4+tGH+KuaJAkY/DOi1kj?= =?us-ascii?Q?8eOrPtpws138BALvR3MlPmO2RwdF8SReHixb8totY3HuLtdk7j4cFDPjP33t?= =?us-ascii?Q?phYlPx0ZGaTYYkA16+7ja6CWZ1XMdLVE/oBYJjDiKDeX2vTeSD+d6CfeBG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FdLNo/vLi5F6DcITQhw?= =?us-ascii?Q?tq7Dvba2vxGyqwm02h5CxfFgqlFeQFLNDAd20cZYjFUk1TL0Kn+N0g0MUxy3?= =?us-ascii?Q?uqppjhuDHfR38AK8098R83K6BDi7oX?= X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB618;5:+FBUYgRg2tw5dt6u+/ds5Oxlf65upQ4Bs8e6y4OdVV+sAbhHZ2hS2LhBbLj7lWHqg1oZM9OeYlAoOoQcFbWdiS1EB/ch/fuixLjHLhlp5CZIbgCXxEIqpgXCB3NxZVuIkMhUT2gHqKj4J9tAx2hMqw==;24:hEn8Sprec19n9Tmrdr1kFhbKPhNP/ffUcHx1Ki1f4v0AZWaAKxolNLXG8fr/pOrWDHXfymGzMt1g9eAT2tT3cSipRCy1kBB0pEO/EL2FpK4=;20:oCEMM4mIlVGttnWi2+yJV/WPhkCJkqbKNYovRs0UE5mlKhSIqqSPJHOCW8Gg5LY1HOLfXeDUibXRY5+UoL/lGw== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2015 21:18:46.2435 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB618 X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB491;2:n6OAYft984hl73T5CWgIPWGt1M+gYj0rI163SevJx58xH4CKqejlbIj5Bgl9zf+R/fNOAIUgF9S777k+/ylD6yDZT/ywWAPIZ/OkyPFk9YZ7IWgjVmHfxJXHh88m+GBPYvtPuHgtCutVBzVYRCSAv0YxCi4OoFr2R6rt+Vhmt38=;23:4cjHGyFaIAyUXn/hU/22Mcc4K7vKLZiKbx4FDKAsuHAWvR5gyECu4hU1n4rK8fp4jX1Zl1ZAw4MSGQZ2WRJLa4gci8dC3iNR+0Rqg/iauueKNO7GSBQtShhOArQb2ISpiKP1fbwEoLeG8CpCc0Cn62XEHO7j2790Fg0T9cj7U87hA9FL6sib2bjAejrBYK7K X-OriginatorOrg: caviumnetworks.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6148 Lines: 219 From: Andrew Pinski Defines the macros which allow the signal structures to be the same between ILP32 and LP64. Reviewed-by: David Daney Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Yury Norov Signed-off-by: Andrew Pinski --- arch/arm64/include/uapi/asm/siginfo.h | 21 +++++++++++++++++++++ arch/arm64/include/uapi/asm/signal.h | 31 +++++++++++++++++++++++++++++++ include/uapi/asm-generic/siginfo.h | 17 +++++++++++++---- include/uapi/asm-generic/signal.h | 27 +++++++++++++++++++++++---- 4 files changed, 88 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/uapi/asm/siginfo.h b/arch/arm64/include/uapi/asm/siginfo.h index 5a74a08..d9ac7d4 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) 2015 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,26 @@ #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) +#ifdef __ILP32__ +# 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_VOIDPOINTER +# define __SIGINFO_VOIDPOINTER(field) \ + __SIGINFO_INNER(void __user*, field) +# undef __SIGINFO_BAND + +# define __SIGINFO_BAND(field) \ + __SIGINFO_INNER(long, field) +#endif + #include #endif diff --git a/arch/arm64/include/uapi/asm/signal.h b/arch/arm64/include/uapi/asm/signal.h index 991bf5d..5053af4 100644 --- a/arch/arm64/include/uapi/asm/signal.h +++ b/arch/arm64/include/uapi/asm/signal.h @@ -22,6 +22,37 @@ #define MINSIGSTKSZ 5120 #define SIGSTKSZ 16384 +/* For ILP32, sigset should be the same size fields as LP64 so use + unsigned long long. */ +#ifdef __ILP32__ +#define __SIGSET_INNER_TYPE __extension__ unsigned long long +#define _NSIG_BPW 64 + +# ifdef __AARCH64EB__ +# define __SIGNAL_INNER(type, field) \ + __extension__ struct { \ + int __pad_##field; \ + type field; \ + } __attribute__((aligned(8))) +# else +# define __SIGNAL_INNER(type, field) \ + __extension__ struct { \ + type field; \ + int __pad_##field; \ + } __attribute__((aligned(8))) +# endif + +# define __SIGACTION_HANDLER(field) \ + __SIGNAL_INNER(__sighandler_t, field) + +#define __SIGACTION_FLAGS(field) \ + __extension__ unsigned long long field + +#define __SIGACTION_RESTORER(field) \ + __SIGNAL_INNER(__sigrestore_t, field) + +#endif + #include #endif diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h index 1e35520..be640a9 100644 --- a/include/uapi/asm-generic/siginfo.h +++ b/include/uapi/asm-generic/siginfo.h @@ -4,9 +4,17 @@ #include #include +#ifndef __SIGINFO_VOIDPOINTER +#define __SIGINFO_VOIDPOINTER(field) void __user *field +#endif + +#ifndef __SIGINFO_BAND +#define __SIGINFO_BAND(field) __ARCH_SI_BAND_T field +#endif + typedef union sigval { int sival_int; - void __user *sival_ptr; + __SIGINFO_VOIDPOINTER(sival_ptr); } sigval_t; /* @@ -86,7 +94,7 @@ typedef struct siginfo { /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ struct { - void __user *_addr; /* faulting insn/memory ref. */ + __SIGINFO_VOIDPOINTER(_addr); /* faulting insn/memory ref. */ #ifdef __ARCH_SI_TRAPNO int _trapno; /* TRAP # which caused the signal */ #endif @@ -99,13 +107,13 @@ typedef struct siginfo { /* SIGPOLL */ struct { - __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ + __SIGINFO_BAND(_band); /* POLL_IN, POLL_OUT, POLL_MSG */ int _fd; } _sigpoll; /* SIGSYS */ struct { - void __user *_call_addr; /* calling user insn */ + __SIGINFO_VOIDPOINTER(_call_addr); /* calling user insn */ int _syscall; /* triggering system call number */ unsigned int _arch; /* AUDIT_ARCH_* of syscall */ } _sigsys; @@ -290,6 +298,7 @@ typedef struct sigevent { int _pad[SIGEV_PAD_SIZE]; int _tid; + /* Note these two are handled only in userspace */ struct { void (*_function)(sigval_t); void *_attribute; /* really pthread_attr_t */ diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h index 3094618..92d8ce3 100644 --- a/include/uapi/asm-generic/signal.h +++ b/include/uapi/asm-generic/signal.h @@ -4,7 +4,9 @@ #include #define _NSIG 64 +#ifndef _NSIG_BPW #define _NSIG_BPW __BITS_PER_LONG +#endif #define _NSIG_WORDS (_NSIG / _NSIG_BPW) #define SIGHUP 1 @@ -85,9 +87,13 @@ #define SIGSTKSZ 8192 #endif +#ifndef __SIGSET_INNER_TYPE +#define __SIGSET_INNER_TYPE unsigned long +#endif + #ifndef __ASSEMBLY__ typedef struct { - unsigned long sig[_NSIG_WORDS]; + __SIGSET_INNER_TYPE sig[_NSIG_WORDS]; } sigset_t; /* not actually used, but required for linux/syscalls.h */ @@ -100,11 +106,24 @@ typedef unsigned long old_sigset_t; #endif #ifndef __KERNEL__ + +#ifndef __SIGACTION_HANDLER +#define __SIGACTION_HANDLER(field) __sighandler_t field +#endif + +#ifndef __SIGACTION_FLAGS +#define __SIGACTION_FLAGS(field) unsigned long field +#endif + +#ifndef __SIGACTION_RESTORER +#define __SIGACTION_RESTORER(field) __sigrestore_t field +#endif + struct sigaction { - __sighandler_t sa_handler; - unsigned long sa_flags; + __SIGACTION_HANDLER(sa_handler); + __SIGACTION_FLAGS(sa_flags); #ifdef SA_RESTORER - __sigrestore_t sa_restorer; + __SIGACTION_RESTORER(sa_restorer); #endif sigset_t sa_mask; /* mask last for extensibility */ }; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/