From patchwork Wed Aug 17 11:46:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9285697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8704C60459 for ; Wed, 17 Aug 2016 11:56:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D26C290B7 for ; Wed, 17 Aug 2016 11:56:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 718A1290BC; Wed, 17 Aug 2016 11:56:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id B83DA290B7 for ; Wed, 17 Aug 2016 11:56:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzS2-0000ZD-9F; Wed, 17 Aug 2016 11:56:06 +0000 Received: from mail-cys01nam02on0056.outbound.protection.outlook.com ([104.47.37.56] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzLA-0000lc-60 for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2016 11:49:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=HpGZo0SA+Ii6YObO1unOcroo94e4j+8sUdJB6ylPlxE=; b=QBNeH1W9/uj0p6uvx7hE3rUWZi3pAa3gkMVK2ZURoo5HCz5rw0R2aJWwzmbbDb2GLl5nCl+36fYKDx+mBbQKMLbZK8Xa95K8Me33gDgYLPLYnlFFHSKFA3IHZZD/0EJdS5DLctF1vA5Ojit0ieSBuH1Fgrw5w6/QAVFCHhljDi4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by DM3PR07MB2250.namprd07.prod.outlook.com (10.164.33.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Wed, 17 Aug 2016 11:48:37 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 11/18] arm64: ilp32: share aarch32 syscall handlers Date: Wed, 17 Aug 2016 14:46:36 +0300 Message-ID: <1471434403-25291-12-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> References: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR03CA013.eurprd03.prod.outlook.com (10.141.191.141) To DM3PR07MB2250.namprd07.prod.outlook.com (10.164.33.148) X-MS-Office365-Filtering-Correlation-Id: 4887dba4-d2ea-4cf3-8702-08d3c6946d38 X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2250; 2:YuQ7ckMm+elj2HwVvKfyZknV5YWChA2ZX+jJ14payMjPATs8P+2On0viLCaHbH4VJfhmxcTII4FjUc6HzpmzSWhSRFULVVkXn1NRvNMuPRxIkuBtPFJ8+v509VsMLnNh9yyct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M95P0mAi1ELmqDXQNLzEFjRonWzBSQo+KUHRx3wiMWOA2G/oZeoUQA7kH6E94ailvQ/dI9voAjcgEgzQJI= X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2250; 31:Ok+VlGpBJjZx1lmGUCnkQCVQAm5uQN3gpgylnigBF+TzDzOg4Y+lVl+tRqlmASO/gSa8KIL0MLcea47C5e5RYVBdNVm5weuBbZQDDgi7mcwufmgMdDOdqqMKFq9nAaPq8W3RGzjH4IJcfEZlztai7AcvzrizEYDZoyR/3fAG+LAsO2hMHXuher37duCXWWGfDuHowBlNRjYlSYTXmDVkQk3vJ+0XI0rPI5Q7JTs+GsE=; 20:gb+KpONwub7PfheWGPL9bt0sBfx25C9pakYSdWID609a4XdpObzlhGsPjWDQ4ifQ7TK5HqCgYj/QhJKtJeETD9eOm8fMJjBWpE4U5OQ4/we238JHusCFVnTHuYofPMJMUH1k+FQIjwoZ5CTQnq7stCEEJvL7KDyMtl8D9Zp5Cg5FPe+q0BYsGqBhPUQ7HtpgYpi14OEkPta/aaZTffxJelFaFo0ZT4eUPSXacjx6ItDdRNI2drYjFufmflSDz25AfCNOqYQxMYqcgx/H4hlrwyOdCoR0QWZSN6TjxhZfRvtq5ghJG7mvKF7m0rdoVIjDX94R7vWzGhsyyd1fnjbAiLQ058CTOSelmBgTUbhbzswoFMDvbENKjV2hVz3PFM4+dEgs5s5x5VfHrvYcdGrD+xCcDOfYPLysW/84wFDxFH0Gw5KonM8/EwoOlurvwDtP2kzFv2m3YKJARQTR9Q0os8kyvrCvEWUGJ5AR9bL6iA2DYV2okHFD1RbqoFUYFCnmoEjYIoDzuVBo/BcTARxBZ1b9mOuYAF0neBVcCb1nyPwjnXgvthPUWt9XcrXYFOr1Uw4MgHmfvPuCVXWDVcO5+/XOD1AFtBRtQZWJ+7Gtokk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(180628864354917)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:DM3PR07MB2250; BCL:0; PCL:0; RULEID:; SRVR:DM3PR07MB2250; X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2250; 4:3AT28I+bZnSH9frCpqOzOVdNe4ZkQASsnAmn6DPVMSEDgzhOBLDJCHLGtHD9TkNgH1MNI3PokD0iQJXJ73pgM6X2WBBgMzjTPSvspODiIF4qe0CM+Ss+Ue8594APRNDUWJCSZDvxlkzhsVsss7N3lWg/jmAgYCjmzzgJC7jg2/kWAHia4OZK/iI8TEvpdKgEYKVlihAYLG3nJ9vAGq4/AhwpUR4TJvSyL2aZMeTwM3X4Dv5dIgZuYCinCeXZdkFJITQzjxHwQwH/LkL2CgniajWl9IQtKkoM1Advjt0kSYFhWFB16qxUfFbYmbTneQynDV2bvXN7jnjaZWOHb50NyzWzufHvX2Lv6hiL1sQzGoatPxlth1VYCe4ANJiZ1MweNWAL474KWd0HQCwpoJBrVW2yN2zT//fT6YZzU8KiQTMsQuUKaQd1qE2kvsjhZ7rcG4+ZBc+yP4AMySKryQrKWmo5W3fYh7ItlY8qkt8Z6H4Y8l1NCKHVHfoaN5IUd66J X-Forefront-PRVS: 0037FD6480 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(5001770100001)(77096005)(15975445007)(101416001)(189998001)(2950100001)(81156014)(81166006)(50226002)(229853001)(106356001)(92566002)(42186005)(33646002)(575784001)(5003940100001)(19580405001)(19580395003)(97736004)(50986999)(36756003)(105586002)(47776003)(76176999)(50466002)(48376002)(76506005)(66066001)(8676002)(7736002)(4326007)(7846002)(68736007)(2201001)(2906002)(3846002)(7416002)(586003)(6116002)(305945005)(2004002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR07MB2250; 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; DM3PR07MB2250; 23:GsTi1HBmsEp+rVKXpzyWtt8kn36NQFeAeJIdfcHiP?= =?us-ascii?Q?1gj22Aca/yj13wTaIgpoF/EJGWaIOVeuk3oFcJRDCXcuQIAgU4Q+sLVaKYAY?= =?us-ascii?Q?myK9L4ytI80t4QsqZTaypkVRmmPzGCqE31AVvkKR/ftpNGKmG3DJCw2E8EA+?= =?us-ascii?Q?I0AXIneyKC+RdHBuLel7MBKuVVCJt5Gpang2odBJ6pHr0PVzPwkBwXANuCDc?= =?us-ascii?Q?EZFZdS/NVyGmXvkCXTJCcq5pDRPA4Sv9RXCGL455hkFkAeliehzHbuqgq+U8?= =?us-ascii?Q?MVW628J1z9zqdh1KrwM7sAac5+H+OGvkbmrDisXxASvfXi1uhyMEGDIQqiUU?= =?us-ascii?Q?eStAovxnXfAdhnmvTQmnGdkZFa7SH5t2rFJHfutt8j0NLrPGx98D10EwsU8m?= =?us-ascii?Q?CUhqIceiI3fRWbdXc1kSRJ3lKkEgQwYFWBajB+Khm6zoPhM83+p8lak0BsR8?= =?us-ascii?Q?8sGeM2Jybi9XBNx44GwvgNhTjzGK5r7NTcqiUzLsr7tPUwb+ZVU0mlxqYsbe?= =?us-ascii?Q?XLsGrYMVgfkC0dMS2YBXxNeGdByXBk4IT7Dqp5buU+aK+0dQNF6m3O8Csiot?= =?us-ascii?Q?oG2pO3qhvrCcpX9k6J/QJxPfaFt6orrKL2nVutD4tiPjtEfRmmjrp8y4M+gb?= =?us-ascii?Q?w/F2L1vEmfrOmGfBhdZ7VMqcEwtulxZ4nlrfSobMtL6UmuT/YQzO3uF/b69w?= =?us-ascii?Q?uDXB4ftYSETTT2W10BhHpVF6W2hxdyWu7Pqvqi/VuWY3dLrTWUfLTW6aJNEl?= =?us-ascii?Q?2OGC4unr+UN7MAW5+mNXS/n/AOhzBqaIziBMEYPEwcf3Vw5/WsPn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+AItjftNeMrvW6ja2D3A3e8ETaOsyYJuwAM=; 7:yrQcfi5aihM3E9CTm2aZ3Y2O2g0FksGOWew2TnexIUNX7MbV+/He7fh5TqxI867TgDIiJ4yY2N1L5eIEhQ+/XmcgHVrfxgnoBHh7Uoo0+3sUlc+EtjmxTvFyA5bliRoReBgvPG6Hi1N+KRCHYLypiL3q4shQPzQtwIFsOkup/WcCoaPxAMpgtxZnw0gTY8yeewMwNh7lGdmV+cBZge7M29+gGYf4iN7rDg5E889OST50kO7tGYvklr9fn/4ikHn/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2016 11:48:37.5489 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2250 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160817_044900_683245_E1BA82BC X-CRM114-Status: GOOD ( 11.76 ) 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: szabolcs.nagy@arm.com, heiko.carstens@de.ibm.com, cmetcalf@ezchip.com, ynorov@caviumnetworks.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, zhouchengming1@huawei.com, Prasun.Kapoor@caviumnetworks.com, agraf@suse.de, geert@linux-m68k.org, kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, linyongting@huawei.com, klimov.linux@gmail.com, broonie@kernel.org, bamvor.zhangjian@huawei.com, maxim.kuvyrkov@linaro.org, Nathan_Lynch@mentor.com, schwidefsky@de.ibm.com, davem@davemloft.net, 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-Virus-Scanned: ClamAV using ClamSMTP off_t is passed in register pair just like in aarch32. In this patch corresponding aarch32 handlers are shared to ilp32 code. Signed-off-by: Yury Norov --- arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/entry32.S | 65 -------------------------- arch/arm64/kernel/entry32_common.S | 93 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 65 deletions(-) create mode 100644 arch/arm64/kernel/entry32_common.S diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 9b6c324..4a81d93 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -28,6 +28,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ sys_compat.o entry32.o binfmt_elf32.o arm64-obj-$(CONFIG_ARM64_ILP32) += binfmt_ilp32.o +arm64-obj-$(CONFIG_COMPAT) += entry32_common.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o arm64-obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o diff --git a/arch/arm64/kernel/entry32.S b/arch/arm64/kernel/entry32.S index f332d5d..fd2b0d5 100644 --- a/arch/arm64/kernel/entry32.S +++ b/arch/arm64/kernel/entry32.S @@ -54,68 +54,3 @@ ENTRY(compat_sys_fstatfs64_wrapper) b compat_sys_fstatfs64 ENDPROC(compat_sys_fstatfs64_wrapper) -/* - * Note: off_4k (w5) is always in units of 4K. If we can't do the - * requested offset because it is not page-aligned, we return -EINVAL. - */ -ENTRY(compat_sys_mmap2_wrapper) -#if PAGE_SHIFT > 12 - tst w5, #~PAGE_MASK >> 12 - b.ne 1f - lsr w5, w5, #PAGE_SHIFT - 12 -#endif - b sys_mmap_pgoff -1: mov x0, #-EINVAL - ret -ENDPROC(compat_sys_mmap2_wrapper) - -/* - * Wrappers for AArch32 syscalls that either take 64-bit parameters - * in registers or that take 32-bit parameters which require sign - * extension. - */ -ENTRY(compat_sys_pread64_wrapper) - regs_to_64 x3, x4, x5 - b sys_pread64 -ENDPROC(compat_sys_pread64_wrapper) - -ENTRY(compat_sys_pwrite64_wrapper) - regs_to_64 x3, x4, x5 - b sys_pwrite64 -ENDPROC(compat_sys_pwrite64_wrapper) - -ENTRY(compat_sys_truncate64_wrapper) - regs_to_64 x1, x2, x3 - b sys_truncate -ENDPROC(compat_sys_truncate64_wrapper) - -ENTRY(compat_sys_ftruncate64_wrapper) - regs_to_64 x1, x2, x3 - b sys_ftruncate -ENDPROC(compat_sys_ftruncate64_wrapper) - -ENTRY(compat_sys_readahead_wrapper) - regs_to_64 x1, x2, x3 - mov w2, w4 - b sys_readahead -ENDPROC(compat_sys_readahead_wrapper) - -ENTRY(compat_sys_fadvise64_64_wrapper) - mov w6, w1 - regs_to_64 x1, x2, x3 - regs_to_64 x2, x4, x5 - mov w3, w6 - b sys_fadvise64_64 -ENDPROC(compat_sys_fadvise64_64_wrapper) - -ENTRY(compat_sys_sync_file_range2_wrapper) - regs_to_64 x2, x2, x3 - regs_to_64 x3, x4, x5 - b sys_sync_file_range2 -ENDPROC(compat_sys_sync_file_range2_wrapper) - -ENTRY(compat_sys_fallocate_wrapper) - regs_to_64 x2, x2, x3 - regs_to_64 x3, x4, x5 - b sys_fallocate -ENDPROC(compat_sys_fallocate_wrapper) diff --git a/arch/arm64/kernel/entry32_common.S b/arch/arm64/kernel/entry32_common.S new file mode 100644 index 0000000..261cd97 --- /dev/null +++ b/arch/arm64/kernel/entry32_common.S @@ -0,0 +1,93 @@ +/* + * Compat system call wrappers + * + * Copyright (C) 2012 ARM Ltd. + * Authors: Will Deacon + * Catalin Marinas + * + * 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 . + */ + +#include +#include + +#include +#include +#include +#include + +/* + * Note: off_4k (w5) is always in units of 4K. If we can't do the + * requested offset because it is not page-aligned, we return -EINVAL. + */ +ENTRY(compat_sys_mmap2_wrapper) +#if PAGE_SHIFT > 12 + tst w5, #~PAGE_MASK >> 12 + b.ne 1f + lsr w5, w5, #PAGE_SHIFT - 12 +#endif + b sys_mmap_pgoff +1: mov x0, #-EINVAL + ret +ENDPROC(compat_sys_mmap2_wrapper) + +/* + * Wrappers for AArch32 syscalls that either take 64-bit parameters + * in registers or that take 32-bit parameters which require sign + * extension. + */ +ENTRY(compat_sys_pread64_wrapper) + regs_to_64 x3, x4, x5 + b sys_pread64 +ENDPROC(compat_sys_pread64_wrapper) + +ENTRY(compat_sys_pwrite64_wrapper) + regs_to_64 x3, x4, x5 + b sys_pwrite64 +ENDPROC(compat_sys_pwrite64_wrapper) + +ENTRY(compat_sys_truncate64_wrapper) + regs_to_64 x1, x2, x3 + b sys_truncate +ENDPROC(compat_sys_truncate64_wrapper) + +ENTRY(compat_sys_ftruncate64_wrapper) + regs_to_64 x1, x2, x3 + b sys_ftruncate +ENDPROC(compat_sys_ftruncate64_wrapper) + +ENTRY(compat_sys_readahead_wrapper) + regs_to_64 x1, x2, x3 + mov w2, w4 + b sys_readahead +ENDPROC(compat_sys_readahead_wrapper) + +ENTRY(compat_sys_fadvise64_64_wrapper) + mov w6, w1 + regs_to_64 x1, x2, x3 + regs_to_64 x2, x4, x5 + mov w3, w6 + b sys_fadvise64_64 +ENDPROC(compat_sys_fadvise64_64_wrapper) + +ENTRY(compat_sys_sync_file_range2_wrapper) + regs_to_64 x2, x2, x3 + regs_to_64 x3, x4, x5 + b sys_sync_file_range2 +ENDPROC(compat_sys_sync_file_range2_wrapper) + +ENTRY(compat_sys_fallocate_wrapper) + regs_to_64 x2, x2, x3 + regs_to_64 x3, x4, x5 + b sys_fallocate +ENDPROC(compat_sys_fallocate_wrapper)