From patchwork Mon Nov 2 23:30:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7538791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0E8A79F71A for ; Mon, 2 Nov 2015 23:34:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F17CC2061A for ; Mon, 2 Nov 2015 23:34:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B779D2061E for ; Mon, 2 Nov 2015 23:34:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtOb6-0005gz-Lx; Mon, 02 Nov 2015 23:33:08 +0000 Received: from mail-by2on0067.outbound.protection.outlook.com ([207.46.100.67] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZtOac-00057s-28 for linux-arm-kernel@lists.infradead.org; Mon, 02 Nov 2015 23:32:42 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (109.252.143.100) by BLUPR07MB610.namprd07.prod.outlook.com (10.141.207.15) with Microsoft SMTP Server (TLS) id 15.1.312.18; Mon, 2 Nov 2015 23:32:15 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 05/17] arm64:ilp32: share signal structures between ILP32 and LP64 ABIs Date: Tue, 3 Nov 2015 02:30:34 +0300 Message-ID: <1446507046-24604-6-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1446507046-24604-1-git-send-email-ynorov@caviumnetworks.com> References: <1446507046-24604-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [109.252.143.100] X-ClientProxiedBy: VI1PR06CA0025.eurprd06.prod.outlook.com (25.162.116.163) To BLUPR07MB610.namprd07.prod.outlook.com (10.141.207.15) X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB610; 2:D4K9NbZVK68jHScYVvlbZD3LJPxyEMa2ja05dtVvVk7wFnrn2Up74WG7j3CtsSr5b3BjDm1Y7aaH+lR4/ppit4OZTuayL59/voRnFCETNBCgj7UJ+D3Qd/RPFqpWi8aRWKODsKjxtcHa70uw8ry42WgnVB191M82dycC+p0OtdM=; 3:DsOJRcJlH5yJCOnYSEJxDSGT3qUkx8dz2tw8BGvgDrCCr32JBk4ARNB5QpeEuCYRhr7/GcOzjDmPQQBW5bsPFAhQJ7N4FK2fySIrdbfrUa+1sdNpeO+3WY8visZDewPBGw6qvaGN80JPQP/taPAwKw==; 25:nKDyVgjs52Wb59oXRwDBPX51EeEacRZ7p1Z7ygMOMV9SDoW5PF2/SELRm2JSJnolpE5/39QECN4iEUTaAeh9+W0Q2pwThSJuK9IkdqEfKLeazgMbODGHeYCcMsh2jzoSfGaphFnqAf13QhYhFspRO6tjGBOaBas0YLJni2ZuuEfdqO7aBn0T5zlvRBQOL0ahkjlt+oQxMZ3gI0cZ/mQhFQSpfMd5BSlfna7RV83XXt34EHfQlz8KK2U2r9zw5sqaOkXWWCYcjlJ6zjEUoQFn2g== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR07MB610; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB610; 20:ixc511AnCUPYeSJol4TfnmSiQ+CG1ee/H2e90/Qc7WrLwD8iiCy5qXNGNBfPDxgaY6PKbaJCyB0/4c0cghLPM8DhkT9wphNmgg5sT5DmBG0T9l+6ygc0KF+FDQL0ccsWJDY6jnxmxbm6jpg+zcO++kzXirSsf6P7yleGxGUSjg74KdWb3HQnK/uLDrl13nMQvVcvwDGw1f60ce2vp/ofk9tYVMYHPMljNdwmAc8h6myjAopKnuG9rEznxYOn7waxvtbnpLsdI2duYCwFGCjuSirNrwpgtqNGH0fw3yQIHrwUp4/lHMxRroH13UB/k+0ZYajEfGcfL0L7RgDL1i8tbDwI/27sSa0PViy7sfNCwrXRbIK5D7xCu6sbII2LOAOqv9SAaFfBEFAVZwBZ6NqXdF6rmtVVtB2fnuGbfbS1yOOE4LYehG1DeO17ZlAAu/ICooe2OSu8DoWnqz8opB5x5/Fwe3hTsdgcdnmqtykOCemezcCwVLcEACUomMAMm18D2cgO/aoy5oPFGOdaBKnr/tIlwyQq1s/GEQvg2eTc3X06z1x+ML1PsNG4D6LJi1WgOWKANVHja9MZytxy+5cgAw+Sz+pIyD7vIBezcUCbHGs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:BLUPR07MB610; BCL:0; PCL:0; RULEID:; SRVR:BLUPR07MB610; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB610; 4:IRwSVMPT0FRmkm3BCROCoy0JB4yb4I3iSj3Q0W2xewuFW2WwOCGSYORV001bktX6hHLhD3o8KJQZ4hG0pVdgbVLe1Yk3ZGP9p+Y4AGP8rbFink3qocySLfrUU0bjrFGnAM0fTlJrPFgoh6PlwGDidvImZhBWIsxRR3EcWcUbVGsaqdh/0hgzqRFIdSWT17J6YqmDz+eiBLD/nwt9n5c8O9Lv7YVy1llw+L3SZELuyV4OOF1Z00rv1C9isKRTFtoBV3D9x06NQduqBxIeAhNak5dRx9ES65hxQn9sXzLVsj2SphoizQMVGEV4pfHPm3B5on3YlRMBnryotUEOKvKaWx1Q3oHwmnRnZLM6+qXHBbss2nxxJfZEgsyI6Hk6agZ5 X-Forefront-PRVS: 0748FF9A04 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(189002)(199003)(50226001)(50986999)(76176999)(77096005)(19580405001)(50466002)(106356001)(5008740100001)(229853001)(19580395003)(48376002)(76506005)(5003940100001)(87976001)(66066001)(5007970100001)(189998001)(101416001)(107886002)(5004730100002)(47776003)(5001960100002)(42186005)(105586002)(33646002)(40100003)(122386002)(5001770100001)(81156007)(2950100001)(2201001)(97736004)(92566002)(36756003)(4001430100002)(2004002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR07MB610; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR07MB610; 23:pWshXJagCtw7Ukgx1o1Hjx4JJ0wh5VLyxh7Ud81UJ7?= =?us-ascii?Q?QlvV4Nc++3Yq9EL8+OxMm8deae39GXgUc54JBuBE4vBVlYTbOgwvUvNmVyZD?= =?us-ascii?Q?PlW/SHvtN2QjMjVqEx/Yu+5AR1VK+FnGC7FM+moffAbfCT6csDAr9b/dAVx1?= =?us-ascii?Q?9ZurPVghAW0GRt2DK5mlMDILhfCMNY9jcF9lbWHXPNBHf1KHSlP2XTAuboJm?= =?us-ascii?Q?6BstIHtR8Wvu9ytKH8ESVvIqDSe/BsBy9HRLtOt24QUreANfRDvrnuc5BXb/?= =?us-ascii?Q?XYHsCMQsBYAYaVo8Wsh4kdXafBWQS8tr1BZWJsfExsindxAK/IOGzHSre9Gr?= =?us-ascii?Q?4TlFhZhWF8SRSezb5A8kYJ+rjBw7jcR6sa35KSx5buyyD+WBKMz2mKCSin7s?= =?us-ascii?Q?aFml0Ps35BGIxmPL/RA2YDMDWrH1vBG7SSH43cRWbIY0uzBAoePx0pS5DlP1?= =?us-ascii?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FkmeuFzvtJpE5CV+uIY32PMgMs+nzZk7wDfQZUHdKsm+EEoXBWucWHToQtOCDU=; 20:bK1y3hNcyx2co9D0pWWjUps12DAuIkZ0ScSzTljlvpH1lw6vsMm2+0lEN+kDBadMe/IgVGKVrW4D2TiEnjz5bg== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2015 23:32:15.3923 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR07MB610 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151102_153239_063507_4DA80A8F X-CRM114-Status: GOOD ( 12.67 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, Nathan_Lynch@mentor.com, agraf@suse.de, klimov.linux@gmail.com, Andrew Pinski , broonie@kernel.org, jan.dakinevich@gmail.com, Andrew Pinski , ddaney.cavm@gmail.com, bamvor.zhangjian@huawei.com, Yury Norov , philipp.tomsich@theobroma-systems.com, andrey.konovalov@linaro.org, christoph.muellner@theobroma-systems.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andrew Pinski Defines the macros which allow the signal structures to be the same between ILP32 and LP64. Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Yury Norov Signed-off-by: Andrew Pinski Reviewed-by: David Daney --- 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 */ };