From patchwork Thu Jan 14 17:23:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 8034621 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 F344FBEEE5 for ; Thu, 14 Jan 2016 17:31:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EA2120430 for ; Thu, 14 Jan 2016 17:31:40 +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 9A66720499 for ; Thu, 14 Jan 2016 17:31:38 +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 1aJlir-0000MZ-9x; Thu, 14 Jan 2016 17:30:09 +0000 Received: from mail-bl2on0056.outbound.protection.outlook.com ([65.55.169.56] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJlft-0005hn-NX for linux-arm-kernel@lists.infradead.org; Thu, 14 Jan 2016 17:27:14 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by DM2PR07MB624.namprd07.prod.outlook.com (10.141.177.154) with Microsoft SMTP Server (TLS) id 15.1.361.13; Thu, 14 Jan 2016 17:26:41 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 15/21] arm64: signal: share lp64 signal routines to ilp32 Date: Thu, 14 Jan 2016 20:23:12 +0300 Message-ID: <1452792198-10718-16-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452792198-10718-1-git-send-email-ynorov@caviumnetworks.com> References: <1452792198-10718-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: DB5PR02CA0015.eurprd02.prod.outlook.com (25.161.237.25) To DM2PR07MB624.namprd07.prod.outlook.com (10.141.177.154) X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 2:2oigtgcYWabeWFqxnddBLWe6t9DhAxOCd1lZJITYNGC5HhXLnV/Qv/Sr7UVj3U1K5+Y7LJWgIflOPl3hAIMbbCXrquNekVatHoPEJYSu4hFTlL3w42wDx3+pwd17SORwEvjRfQ4nNarWfl4CCBOEzg==; 3:U331hzEVxIeeOsQgqKDXX1i+goNdb+GL0KSmS5NzSA1K3ccxFEdnYO68soTkC0o34IaFEu1WS4WLhj0SGhmmsm2/tR4AZZSsc6OklrirN08MZf3Z+HzMDs6r2lOJM46L; 25:LGm2GMjwLAjbeed9aiSj7pLKMVivzYpwH4CifH0H+C6sErQcLcqzCLRYebDuHw85UR/cLnMfJpjPZgixJK2FJv3L0A4CFrjnUvy22jhRSCFQrrIKo3gDKKRwK9io8XWvWslidfPcSitX7hF1kLA2gFg90cEN7vjNpXSHZKlODb/51kpHogJ0z61+BqtLosBncKK/nhZ2l6IlM8J45GCCK14/pUjmKPGuukNnfCNXF7B2C/vJ3dzpZGK/iuS+Wilu X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB624; X-MS-Office365-Filtering-Correlation-Id: 78a497b4-5888-402b-6460-08d31d07ded0 X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 20:6IV5t0XSZxWFhuEiaYx0dE/56+7PuS0Rh9zK5sdSAkLWqGv07F++TPw0AUCDpWyQ53fM9h7VQx/C7HpT9pjs6XQEp9GhxJ+1VZAufbjfDqbYzJAujyrdZkr9Jg2IGafWUw6pzFNsvXhgNR+OjBGHrhKcjyZX1MYeQ7AqDJ2u27mDNVnaECv/iJc0Yb/aWUFvxkfMdultZXFcgxANqsEj6IodoQPA/GC7nQShjyBXVsRQG6KmgU0B51o6ij3fEje4fCcaZ9Up3A6PjEO54xRqx0eNdC028nmcTzZh85Wbqc1Seo3YNdkSU6eLdB3oWr9j6TbrYIy5u6vsl1+I3DrGf4sSUdutIu16YbOjtZybUve9hciDkA8ZZ9rzJkrJZYVOWM+aON86FBoCl4zjARN/gnVSaOo5C3l5Czn4IWFqdrk2nVQPUuHlj9QZ3hBS1SJ99N3iR5nIAQdVkk8R9EEy+gatIMs7G17GT2LfC+cp2rR6wFlC6wWdrb9dDLsrVPDTx490ehUq+QTeSy6TRsjnWDuxTuOAgoGVzAaNOA002XbO9Qw5PE/NmhpyZdClAI58uS0CUmOAxVVU13mXzXzYJsK4HSS1CicsZEzWJ1HTVU8= 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)(3002001)(10201501046); SRVR:DM2PR07MB624; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB624; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB624; 4:r8Oz+c8rcHu89YrCdkX8BhYgT2/CdXD+rznKqOhKnN8ncxzuyVGLCv0/yNW58Mspd+mgf9R41rEmJOytSYeYoKP1ruLaF1C2h2zDw6a7QjAGUSrOrWny3Dnl8jL0wOgvu2XRoZxhu2sP6wSGT3oYjHS3r64HWfXSOWQGi9a2pvoCOD/QktCvEbmhTra+lUHi4Ma6TC7QQRhPe2zgGYsngCvncsZRz0VvTAnl8Wtz1uLCODaxlu7zoMmpYsh6N+/itoB55lAn1Kp9HAw0PJ/2gmH1ZAOjDcIU5vJtdBVo+rE7EE3DgBbp2xgByuAKFYb7su7K1R6aCGD7EqnqpGhQDBW2Ux5dP6m71qbqbW5bpC3IEOnu22JkVsdEZc7EzfecwvyQQjitV18u0hwiq+IFHrve0YBjgGXPDbRTNkd846E= X-Forefront-PRVS: 08213D42D3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(189002)(36756003)(81156007)(1096002)(42186005)(19580405001)(66066001)(19580395003)(15975445007)(106356001)(50986999)(2201001)(87976001)(586003)(101416001)(105586002)(47776003)(77096005)(97736004)(189998001)(76506005)(4326007)(76176999)(33646002)(50226001)(50466002)(5008740100001)(5001960100002)(92566002)(2906002)(5001770100001)(122386002)(229853001)(3846002)(40100003)(6116002)(2950100001)(5004730100002)(5003940100001)(48376002)(2004002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB624; 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; DM2PR07MB624; 23:JHYTSQA9BSOK+A0txUFElhtwHbUajDPOpjZmP8vhk4?= =?us-ascii?Q?wudGKzHX9yooEzlxebB1jT01eOxqNce6DHaxo4CgEZtSZfgLv9PtgpcJK7dP?= =?us-ascii?Q?NO0pWIzEJNkOLSkjv8BUKrN0JH90dQjZnyv9ISGlxMNvTYJl+B5cwRt2M8jP?= =?us-ascii?Q?8A1bi5jKxc5NTx4CNzQgO5pbhbigFHkXAjG7nH5hM1SswUGTTaWRqygEI104?= =?us-ascii?Q?nOVHAIIOpMIZhWTuaa8I62MFXUd/iICnP5xtArYXVzqYbZVd+tQ7ELU7sklZ?= =?us-ascii?Q?fYI+ldaqrcZ1CgzbX/8FGvrvSJ0PyF9PZ8zuL+NxFes2KJIeTdYpdfQNKxXU?= =?us-ascii?Q?Ad1Wwqk1axkhtqWeMcKxV4H6geOsOVa7csflSFCY5rHBys1/n5N6/9v2F1fm?= =?us-ascii?Q?7w1utwj/E1YZxoCxSaFFtnDCxQSw0sPX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UiHsKE0XshpVIdZQjwwd9d1l2kiA==; 24:sQODXaXh/CksxHxbs8IJJBbkF5fSthF51ryOctjnXTCIxdpudOBmsYemyPh4BHMKd7g+P6lMuVpXW0ydPfmqSsQBkV/YPj/Y6bU2r1VVcxQ= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2016 17:26:41.3609 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB624 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160114_092706_634873_17358683 X-CRM114-Status: GOOD ( 15.30 ) 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, heiko.carstens@de.ibm.com, agraf@suse.de, klimov.linux@gmail.com, ynorov@caviumnetworks.com, jan.dakinevich@gmail.com, schwidefsky@de.ibm.com, Nathan_Lynch@mentor.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;