From patchwork Tue Sep 29 22:14:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7290931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 68D6FBEEA4 for ; Tue, 29 Sep 2015 22:22:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6BF3720604 for ; Tue, 29 Sep 2015 22:22:25 +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 5FB3F205FE for ; Tue, 29 Sep 2015 22:22:24 +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 1Zh3Fw-0004wq-Ml; Tue, 29 Sep 2015 22:20:16 +0000 Received: from mail-bl2on0090.outbound.protection.outlook.com ([65.55.169.90] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zh3CY-00039q-Di for linux-arm-kernel@lists.infradead.org; Tue, 29 Sep 2015 22:16:47 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (91.78.158.8) by CO2PR07MB618.namprd07.prod.outlook.com (10.141.228.149) with Microsoft SMTP Server (TLS) id 15.1.274.16; Tue, 29 Sep 2015 22:16:22 +0000 From: Yury Norov To: , , , , , Subject: [PATCH v5 07/23] arm64:ilp32: share signal structures between ILP32 and LP64 ABIs Date: Wed, 30 Sep 2015 01:14:04 +0300 Message-ID: <1443564860-31208-8-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443564860-31208-1-git-send-email-ynorov@caviumnetworks.com> References: <1443564860-31208-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [91.78.158.8] X-ClientProxiedBy: HE1PR03CA0034.eurprd03.prod.outlook.com (25.163.170.172) To CO2PR07MB618.namprd07.prod.outlook.com (10.141.228.149) X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB618; 2:PFAsyLRdUz7W8EDhdS4ARMLHqYJThu/+Mk0VmCSF2yWTBDYNpH99oXymLdurgTUL3T3te/ioynnC+4bNE78eOw+7PK/ZaS38PQThXCZYG3oK6pZR050anTVzn7oh8vzRQhXZTVzyoyxu68kg7Q/8IRU+51NV8bByUh/P4pnnVI8=; 3:8GxiS+MFlkByms0+FtyPe2BbDOQ/zYlFHuqlp27mgFuGXJE9T8L7bvY7jTsnlZokq+1fg9Zlzsz5NURODp0ZXyoBTwBlIw5CbfSNNlQPlM+ZmzAzmQJyKKzK66KrI/VbXqe7+bD6BFJ5ls7sC5ZcxA==; 25:4x0+LbFNUsktob2PQSP+acUpKqc8p+eUiR6lQkEOfpABwJCTdEqYnJOBZTqywfpwYdWnXITxuAg8pf0nptvVG0pjE/WJIRBkX/dUMvInyJpFEwxouHLaa5zIe5dcZ/hu27BOsHnKcXiz5Kobc0WXff7h40V9V6UtfYRs/klTDrPXH5OdY/9yqYaNcE4xcB76Q+WtvGK24GzJQU3VCH3uHHJvtzH6/FB2mUaFiMSWGZIPkR6b6lXdX7X92P0xCdJkxAlDAYB8bPv2tWd/xcQyRQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB618; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB618; 20:/wqZwKyvrVLSw2lJ8xefsmSi6QYXt0KLMJMqdIAj0+eKHkBnXtjXJcgV3tzhL8TGThT2tjedNPc7SRWpfhz9G0yIhmNNjPhtSleNce1YbHWEquN5Z/+XQ46hK50d9Ed+kPFEmGt8kjHovcWUBWaIlcFwTRiFSVBJxL5a7W9hb+uH513/u68mm5v3VcwXtzJmp+0Z9fCbuY0RhhFg793TrNnNCd4J6mjk6oA8joga1zug4TIrmwbQCFQWa1F4Ym8lwDB2hhh1QaQpgEBdoSAL+IIwJeZS1VDLapJoRycN66z31epIvWQ+Xk1Z1wT50oIbxHQZfasRNTMnPnjUDdkxo8IOdxCKFDGNj90gFdoNkAcqvolirukk8QOtEHnQ7hnDYkxIPu8mMp1pRG7VQl9DcNn06d79tIcF5iXLVW0tDbFqPBY0CfZXDfV/CFvfIY6kfBvIwytAdedq32R4Z4YAC05FpNdcuhlN75WW47gHLPismaM4EHlp3nqkSgi5XcVsf02SdqhfWifUGQkoDLm1CGHkBUcLaWe1wyFB9Fxf+PHIyM936YN1+/qjH81oP2WwQi09Z4aS63AwM3vA3rwOlzqB9qzutSD5ZiS58TXbMnI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001); SRVR:CO2PR07MB618; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB618; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB618; 4:5xyIls+rJkuCy0InZnQyDZx9GtyzIBDs+pdyTeCzDvk3wFgDX/3mz4ZiGsfdMpD59aHZH11Io2S7gmCZX4PVXVqtGCQItT19XturC8QcZh/5EyLuHMuMj8a96yCnjU/rN+BVKZHqYXXrdJhj6AE7ckiTycpm/DgyR1wkWWH09wzFL3PtWHsZv7OTO/tUZ0QZg9zuOvBcTb/tKawBSbD61ytJwUXpJCLmon7v812ieYkmulIVDOgkB2Orcq6VuAMzANbmvCmqS68wxcQt9okmBY28fC3M2dNiB7qvr1jaj4jW1l0eSLDsGIZDT6fqQFhNCVpM6Hd22hZJhDhXFtr5T0sk6P1qwC7h4hqvWA1vnQc= X-Forefront-PRVS: 0714841678 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(189002)(105586002)(189998001)(122386002)(66066001)(64706001)(68736005)(47776003)(2950100001)(42186005)(229853001)(5001960100002)(77156002)(2201001)(77096005)(40100003)(62966003)(5001920100001)(107886002)(92566002)(19580395003)(106356001)(87976001)(76506005)(46102003)(5001770100001)(48376002)(76176999)(19580405001)(101416001)(33646002)(50226001)(50466002)(5001830100001)(5001860100001)(97736004)(50986999)(4001540100001)(5003940100001)(81156007)(5004730100002)(36756003)(5007970100001)(5008740100001)(2004002)(4001430100001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB618; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; CO2PR07MB618; 23:bOOSrd/Hy2vFHQeTQGuesj4wRE6b4p0514mXBfBhyw?= =?us-ascii?Q?f/wfd1+NJ4g1oEFIC4iMxom52aUYNW+xH/CocZKOZjTUSl4Q2ICWQU6WNiUB?= =?us-ascii?Q?21j1ymgK4I6DLKHSujH+AEudZrDsGxo/h0BCx0cD8iaMMY2VuCfH/GbBzkXh?= =?us-ascii?Q?CihdXyuOOc9kAPidT7bHDl3hvX70z9xK/UTgqED6ecvn8n77jVvEAT/1DRtu?= =?us-ascii?Q?/Bc8arPHtQvbwoKKJK0fgdtOmUzc+EXxxKaTUgd9kP+IwDsYE/DEyc49xpRO?= =?us-ascii?Q?rdvDteRv0AJk2F/KABnqxIxl3AVg7yrwZqI+wWHSl4paE1Dc0Q6xcHfI4GsC?= =?us-ascii?Q?Nx3V5qmZnivb4Jne0ju/ZImerRQ3cPlX4kW700szEbdoN7Pa1CwVYgJWNr/d?= =?us-ascii?Q?W2t5QBgxVzqkrQPIDRoDQAru6GOZMaLNUzsT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QhzxdnrAp4XhyZ3OCtMyZLvYPaV7aWN8LVgEdKgHYJ?= =?us-ascii?Q?ItqA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB618; 5:bCnqlnxYNLduUEW2qu2Slh0uI6xAVw5ktCVg5zxFu8o0xLfbi0hT/7An/ldPlewQYHpg/9UlCUV0xc05qb/7wA34RFtuyIRqKbx2pVtqClrZuDtrTEwU965mhlm6xGQnxlqvxHnRDJBEXNmRkdBJJQ==; 24:XVXPzxqZX6cgqXcoK0hhKXqDN/3Bn9k1qCZzumd1GxvoTd8TSstZJZKlxlwI2Bizn/lOS9dJg7fKd7SWG2OSovIwkU8SKlcdihGqtqGU4j0=; 20:0UHOKaaUfMT/IKHeWOmnx7GC1WewjOpOPqsjasmEFVfxnaNsXQm+T/Alkc0s1LgwTJRtn3VawA63uef7oheK7w== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2015 22:16:22.5797 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB618 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150929_151646_784938_B7D2D09F X-CRM114-Status: GOOD ( 11.49 ) 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: yury.norov@gmail.com, klimov.linux@gmail.com, Yury Norov , apinski@cavium.com, philipp.tomsich@theobroma-systems.com, 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 diff --git a/arch/arm64/include/uapi/asm/siginfo.h b/arch/arm64/include/uapi/asm/siginfo.h index 5a74a08..1a6aa32 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,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 8d1e723..d90d53b 100644 --- a/arch/arm64/include/uapi/asm/signal.h +++ b/arch/arm64/include/uapi/asm/signal.h @@ -19,6 +19,38 @@ /* Required for AArch32 compatibility. */ #define SA_RESTORER 0x04000000 +/* 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 9df61f1..c4ce238 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 @@ -83,9 +85,13 @@ #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 +#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 */ @@ -98,11 +104,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 */ };