From patchwork Thu Jan 7 23:34:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7980741 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 C225E9F3F6 for ; Thu, 7 Jan 2016 23:46:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6AF320149 for ; Thu, 7 Jan 2016 23:46:33 +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 D135B2010E for ; Thu, 7 Jan 2016 23:46:32 +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 1aHKEj-0000Ev-Bz; Thu, 07 Jan 2016 23:44:57 +0000 Received: from mail-bn1on0057.outbound.protection.outlook.com ([157.56.110.57] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHKAe-0003sK-7p for linux-arm-kernel@lists.infradead.org; Thu, 07 Jan 2016 23:40:54 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by BY2PR07MB614.namprd07.prod.outlook.com (10.141.222.146) with Microsoft SMTP Server (TLS) id 15.1.361.13; Thu, 7 Jan 2016 23:40:21 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 16/21] arm64: signal: share lp64 signal routines to ilp32 Date: Fri, 8 Jan 2016 02:34:34 +0300 Message-ID: <1452209679-19445-17-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452209679-19445-1-git-send-email-ynorov@caviumnetworks.com> References: <1452209679-19445-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR01CA038.eurprd01.prod.exchangelabs.com (10.141.191.28) To BY2PR07MB614.namprd07.prod.outlook.com (10.141.222.146) X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB614; 2:iLpDNrAQWnBtnX8K8sAK6b+m3UKCFWzn3jOIco5KPJkRRephJjkJKQbSXNYDIm/arCd9IT02xJ1KbQJDQU6UxkAiKB2qYBy4mcXOFCkWcVZr1IQH9wCfHyeAsVsprz0ddr2vD6rb+6aph2OLRYMpLQ==; 3:lyoIkW5rJMOkUaL9HNKqUOC5dDKaGFAaSYDkQ6v6duKXecB0m51eXOlrn9OedaFC1qpdr+/axWpMuOJRCbpKMBhaLsuf2nSmFfdLDXJ7GSWHNI6vcLVjpgpo12a2Don/; 25:EvwmbCTLC7lHVcqlhQVtA7oKo7JYeT3hJxMEHltvNM4ZrtIoYRTHDvoSmvF0U37gJe4XCEMsnLBRo+S7uxblm4WanBq5GwFop2b1+FbPEYOt9ssoKKo1Qolvmz6m1uh0RjaLP7F3AzUXyNGZKp9Dm3V3BkULmXCgAcKvkQIA50qBlhT1aoLVhlJ1ofmsidvtfMh2TAcUjSmo+76xYEIyTyoK10wswq0BeJHODrRF7oB4Si7a75jvKPGGG0OngDa+ X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB614; X-MS-Office365-Filtering-Correlation-Id: a80debc7-2e15-4c1e-a080-08d317bbe8a4 X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB614; 20:Cox3JdIa02g1EvZgjb0LM7sgmT3OoDasTwvRcm/8CHJQN5fvg9O3FPUN/qG4EwkpFGEnkhw5c9Xs9BlvqsVLGy7Myg5mrVewYAdXOFsP2s7Fxp+8LQokuxzURwCyIQW6Iq2t2uelMD/WYkhPeExUcY2kqxxI0s4bITmtVvRzbQFivEDNWdDGKXJHUnqFARid03JfkTFgk+kyOQX5NHnyKkmx2NbIujGBcPeOqGvJTnmtNkcJtzn7W8sEQO9SyXR6YL3lDHjYf7XbT0SKNN8J81ydc5C7YAXt+CyTTkWgkCIstkhQHxIk2i6Gd9+QarnAxrjBpcMTd5f11fhjsjBufsIRmOIqn/Fxh0EzqWjmEuGMs0l7D3cejsv3OP4hR6SfUzFnu7sAcF1//9fgaju9PCPAcGVv9970EZUZ02e520XT1AI68keOxb+frbiiDdRmJpZvP5NOZXF3QyV0amwWPxLu701yGdpkMZlbNo9EW7RA/lVmX93C6fogXt2wFlt2djDEZUUnCVUNVkn/aPMQ88+60b2Su3a5YDOGhfllK7yIp/cxO8RPlnAeAqUzbBabGuqZkmR7hd4pU35vgQNvciU7Xs2E3w7AYYvG87H2kbk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(10201501046)(3002001); SRVR:BY2PR07MB614; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB614; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB614; 4:kjf1xoVXleyTcpokbNe6qBG4JIRfYVexixLlVirjFpq93g2SHGYGbogR1FgcadF5zZo4JujTkIoJVnDqCJ0o46B8o88c3+hwbinGKk5tBY+my3qh0lwo6fshswTx4zQm7k02euvLJw1WKioGBWMIkfhI1UQkGGlaLuRsBDMyZ04qxgYlAEkBUSXzcVysKxZQn7FPaiyPGDv3SsZpaOjfDiGY4+AYKM3Uy3HsOlGbndu7Gk3Gr19Pmk80SAt7FjbEZcvG9Xw0Eb28ABdxTuGjwNOptL1Op9FxvEWWmvUX68x+QdXsPERy5k0rsd60cMJQuv1GGuKPGIcgefUpnCPPIVZgcBSvvZMSU0FYrHI7+Axf4/U83kRXK28i45ZJYP8orFZ9URGC6KgDdCm3NcmPN+NbjIMKFuzcNblqWgdxNfc= X-Forefront-PRVS: 0814A2C7A3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(189002)(33646002)(105586002)(5001770100001)(50986999)(189998001)(106356001)(81156007)(1096002)(2950100001)(5003940100001)(47776003)(97736004)(50226001)(87976001)(92566002)(40100003)(5001960100002)(50466002)(229853001)(5008740100001)(3846002)(4326007)(19580395003)(76176999)(77096005)(19580405001)(586003)(122386002)(42186005)(36756003)(5004730100002)(6116002)(15975445007)(2906002)(101416001)(66066001)(48376002)(76506005)(2201001)(2004002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB614; 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; BY2PR07MB614; 23:5/ih24VQEtHkadBTunqk7Jn+LgPn9HzT+z0RgTvQW8?= =?us-ascii?Q?S7Lddv8QVI1KTvzHr7C+HLHxkz+1P1GRobAJZ084DJpzTIVmnzFlVA80LkOy?= =?us-ascii?Q?Vmn8m1GGYCvJVmPD9e/r0EQ8bDgjVy4txy/wRhkze6pcYeSDYujMXvDPIury?= =?us-ascii?Q?cvo7K9NOLWk96lsOhsr+AA8bag/ZloJ/F1Zn835Ij4Y8xaFdjjGsHKk8Ta7j?= =?us-ascii?Q?nXd/TRKJdU8y15ppZis2v05teRstPoGw2KSzGJTCLjBHNX34Impva6T5mgQd?= =?us-ascii?Q?JSqt8bx7cOJLCBlhfUNcX0bOoOdmHrsXay7RaJcvosyhHBaMzVoWO+2g8mJV?= =?us-ascii?Q?eKRa+mCSOmLPNiRta9MOoEyfZTJpwLDiG6QeIUeJ8aFBeZms/icKN9Yrd7DU?= =?us-ascii?Q?6o7bG669uZuk3BtbK3m62albp6yIZVZ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T3p/LyesSSYtHDpcakmBU4znDlulPcQCNHfuAMTu6w7A==; 24:ewLecKRPMIdWVVNk6dw2CvYZMl4vGW7pWsr+DyuRTv5EW2c4rr+LICcE4fqrXO8CerlLDFrnpkQn4GyEunhK2gHuxDbinh+vR2YibuXpGp4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2016 23:40:21.1141 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB614 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160107_154045_323554_A6AA8338 X-CRM114-Status: GOOD ( 14.70 ) 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, schwab@suse.de, broonie@kernel.org, Nathan_Lynch@mentor.com, agraf@suse.de, klimov.linux@gmail.com, ynorov@caviumnetworks.com, jan.dakinevich@gmail.com, ddaney.cavm@gmail.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.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, 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 After that, it will be possible to reuse it in ilp32. Signed-off-by: Yury Norov --- arch/arm64/include/asm/signal_common.h | 39 ++++++++++++++++++++++++++++++++++ arch/arm64/kernel/signal.c | 17 ++++++--------- 2 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 arch/arm64/include/asm/signal_common.h diff --git a/arch/arm64/include/asm/signal_common.h b/arch/arm64/include/asm/signal_common.h new file mode 100644 index 0000000..faa82c0 --- /dev/null +++ b/arch/arm64/include/asm/signal_common.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 1995-2009 Russell King + * Copyright (C) 2012 ARM Ltd. + * Copyright (C) 2016 Cavium Networks. + * + * 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 + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __ASM_SIGNAL_COMMON_H +#define __ASM_SIGNAL_COMMON_H + +#include +#include +#include + +struct sigframe { + struct ucontext uc; + u64 fp; + u64 lr; +}; + +int preserve_fpsimd_context(struct fpsimd_context __user *ctx); +int restore_fpsimd_context(struct fpsimd_context __user *ctx); +int setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set); +int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf); +void setup_return(struct pt_regs *regs, struct k_sigaction *ka, + void __user *frame, off_t sigframe_off, int usig); + +#endif /* __ASM_SIGNAL_COMMON_H */ diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index 20dca65..a742a61 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -34,12 +34,7 @@ #include #include #include - -struct sigframe { - struct ucontext uc; - u64 fp; - u64 lr; -}; +#include /* * Do a signal return; undo the signal stack. These are aligned to 128-bit. @@ -49,7 +44,7 @@ struct rt_sigframe { struct sigframe sig; }; -static int preserve_fpsimd_context(struct fpsimd_context __user *ctx) +int preserve_fpsimd_context(struct fpsimd_context __user *ctx) { struct fpsimd_state *fpsimd = ¤t->thread.fpsimd_state; int err; @@ -69,7 +64,7 @@ static int preserve_fpsimd_context(struct fpsimd_context __user *ctx) return err ? -EFAULT : 0; } -static int restore_fpsimd_context(struct fpsimd_context __user *ctx) +int restore_fpsimd_context(struct fpsimd_context __user *ctx) { struct fpsimd_state fpsimd; __u32 magic, size; @@ -96,7 +91,7 @@ static int restore_fpsimd_context(struct fpsimd_context __user *ctx) return err ? -EFAULT : 0; } -static int restore_sigframe(struct pt_regs *regs, +int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) { sigset_t set; @@ -166,7 +161,7 @@ badframe: return 0; } -static int setup_sigframe(struct sigframe __user *sf, +int setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set) { int i, err = 0; @@ -233,7 +228,7 @@ static struct rt_sigframe __user *get_sigframe(struct ksignal *ksig, return frame; } -static void setup_return(struct pt_regs *regs, struct k_sigaction *ka, +void setup_return(struct pt_regs *regs, struct k_sigaction *ka, void __user *frame, off_t sigframe_off, int usig) { __sigrestore_t sigtramp;