Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753286AbdCATkb (ORCPT ); Wed, 1 Mar 2017 14:40:31 -0500 Received: from mail-by2nam01on0064.outbound.protection.outlook.com ([104.47.34.64]:7968 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752044AbdCATjl (ORCPT ); Wed, 1 Mar 2017 14:39:41 -0500 Authentication-Results: lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=none action=none header.from=caviumnetworks.com; From: Yury Norov To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Arnd Bergmann , Catalin Marinas Cc: Yury Norov , Andrew Pinski , Andrew Pinski , Adam Borowski , Chris Metcalf , Steve Ellcey , Maxim Kuvyrkov , Ramana Radhakrishnan , Florian Weimer , Bamvor Zhangjian , Andreas Schwab , Chris Metcalf , Heiko Carstens , schwidefsky@de.ibm.com, broonie@kernel.org, Joseph Myers , christoph.muellner@theobroma-systems.com, szabolcs.nagy@arm.com, klimov.linux@gmail.com, Nathan_Lynch@mentor.com, agraf@suse.de, Prasun.Kapoor@caviumnetworks.com, geert@linux-m68k.org, philipp.tomsich@theobroma-systems.com, manuel.montezelo@gmail.com, linyongting@huawei.com, davem@davemloft.net, zhouchengming1@huawei.com Subject: [PATCH 13/20] arm64: ilp32: share aarch32 syscall handlers Date: Thu, 2 Mar 2017 00:49:21 +0530 Message-Id: <1488395968-14313-14-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488395968-14313-1-git-send-email-ynorov@caviumnetworks.com> References: <1488395968-14313-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [27.97.135.110] X-ClientProxiedBy: AM4PR0701CA0023.eurprd07.prod.outlook.com (10.165.102.33) To DM3PR07MB2249.namprd07.prod.outlook.com (10.164.33.147) X-MS-Office365-Filtering-Correlation-Id: ba7afd27-4cd3-4783-37cf-08d460d843d6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DM3PR07MB2249; X-Microsoft-Exchange-Diagnostics: 1;DM3PR07MB2249;3:/++N3D4H4ZC5phWYVV1BPwzTYOyKdGIvJGnwCIlANxEeyBlJ6cSnyREINSWptkFAECduNhPTU/xTGL0ypUlcjDRFJpbst3Ut2QKuhXjVdAm/m7hG7cZDqOinBvJ79ADbvAF6ITWUzNmlSdqHqyx3Q0ypcMkCR39Awt76cjNz/FwIPnlb+o4UKvI9xq1pX773IWI+hu5EnObFUQ9+ZbQngWDkKiFSp1XAfsZAPXD63Z9jSNjN+miFXLFM4AfWY0yqKzST1k/xOacwV/w5gyOPDg==;25:VwMe7MQQB12ZYSG64beEC0Xs/RifHcAVpnJgguCBM7/lMS2KCGR2mZwK5mqC1ybQ8UaAE7LO2920aUCoulMi0pBfESOxOQfHImePcYNP7feRosar8wkqnumWKbpArXLlmtadyNYI4AcLO9uarEZfP/FpMnLdyqVzfcCd9EFOxzkoVghqxrl+I7Me2fNLsPN+XfNHI8R2B78+BRSuOFJAxw7gfoMsvk9IJ3gD4FiMML1TT1FZQE+W0jUGdv5bpzKtjtVWcKg+vLG6x+DSKG+5Ahse7FzmJ7j5huBFyP8w1ZQulGeOG0ZwV13YqQXh5753VJShY8TSOmSc5NmVwjBpVr/hdDkbltLB72Dt7h4fp+auvC456+8RNom9xfnpa3QrQ88NbO47sw5Yjk2Dqdg8cOVHjoJU7FOXmwJ+BrubZkt1k4DLdPRiMdu4RAHH1IW1WjO98n/KZDtH9eH7OuWtUg== X-Microsoft-Exchange-Diagnostics: 1;DM3PR07MB2249;31:Oe/E56n9HNqw+DwfmOD/5vEH1709wFZj6KvZKzZ9tcIOrDuZ5fD+cBvEJZNAI6uE7thF1n8155t94sCdqzCFgiyl36nSyQGqtlrd0HTw1+vVQsU3Y0Eu3dZvL04qPFeeoUpvnC8PaMTBmO3A3zsM4Np30c5khsUHkVeg9iyh2K21H6n6B4ebGhPv3tJIPboiCof88rRRCtGLH7hdADTVoNb3z3U0Qqw45lo6UdOxnCc=;20:gq3TQHIzsThVek/eIAqWkRGP0TueyxA8UCK1j9f2t7D9zQKyx1Oe/wvbuqCqSr9JnRAFK7SBLZeaUTKK/JV93huJ2lh9SKgarIF0+9wqrWsxDjY+LHyCIeWjdIR50z+XwecKMbIgGb8fAlPwhuz5LOSFqmAQp5nde1EbtjLYEmT33eW35isuzJgnuiX02mdj9RYjtD+sxp15A9waWC4MMhMgu0qp7osKN/T1dowRFHsqNNgHWl837hGu+Ls9OLZPhEsJIixTxl12jGTawmnlaptaduP4K/kKGhkg9vLyLrZoQOPc2/eMcSF81x1JLvAwiRtJxERp4FjwFVGQCOT+YsoB4mwPAnCyIU1dr8rOhMwc+6wghvvqyEKZL4Kg1jIdDc4VOvay5s0UcWyAvdAMIfEVGwljeDsfQh/Da8niFAmE0271eWFcqXg53ok/XprCbqf5w4ZgvErc+s02Gw15Ue4dQr5NueM/odRTgaaTuhiu3+mlVn5DvWD1L4FvrLRDrBW5TcyAYui//or3l+a+x4hYqTOflrOtgxWpT6zcjuhPdxjO+ijhnwdenQiobUtTS4FGbiHU3My9u2Zddo3VUHr7eeLQpfV0qXV9fAxIlrQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(180628864354917)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123558025)(20161123562025)(20161123560025)(6072148);SRVR:DM3PR07MB2249;BCL:0;PCL:0;RULEID:;SRVR:DM3PR07MB2249; X-Microsoft-Exchange-Diagnostics: 1;DM3PR07MB2249;4:KWSudKFMmrJ7FjDVgMxEcdUmgRKhgsJw+sI7mYwGamtC+sMsNV7c7A8ypz7K7H8AuSLeksusRbvySN6mVALOSwQ0v/DOb0XgpvpbybvxmCU36MmvAQFg1302wc/xiZAS9bShKQOO+tnuY2j03kdUUn2Tn5bAO4F9xz7Uqx9iKlN1bxwlSKeWDB2Rz57r/V3bbimLKE8CXzdOHVKK7sPUyrW7W/RRSMQHNZuNUXEsdSLlFve9wQYc8qGrAD5kvCOz4kwQ6LPhtxpxD5xD4VthOG1gLY3IYK5EWCixbrTjdm1FJiXOGp5RFZa2/zUWmUo0yw9jkBNjSrgaj5g1WbDcg6ULIMUnIYGPP3nClxMf1Ks00eq24JZa2ekgJanYJgTyKhe5Cebp+inB/xQMrx8f+Sn/5kw7TdcrIaW5x6uRaGEVJ5BGf0T//5Tg7MFdMHMDfsq6ZelBhkT5D6GwZpUwyCDXEAhI34oBQythHlTbrRaFZsWRV4vZobMOKmN3UZ6YlsoKj63qRWob9w4V0YExT/AxyD17F4JNmIwEbqsUVvOrUscj16n6ESgxpZKQ7OIN/+FTGLXFt6q5LA910+0lZdtoJxnmj4k58OS2F6jCYdXXcgKa+/qWK2xDw5ny6gHcJEZutYvjOGUDGSbrWqWF0lginVm3SvbgV2+/AI943SHedHkl58WfP1bRjXVcFvi6olZmWVrrZqdmfkE3hJ2mHCvBWnS/2rfujw84JpQ0Bzw= X-Forefront-PRVS: 0233768B38 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(76506005)(92566002)(50226002)(6496005)(7416002)(54906002)(5660300001)(8676002)(5009440100003)(7736002)(4326008)(81166006)(305945005)(6486002)(66066001)(189998001)(76176999)(48376002)(5003940100001)(42186005)(2906002)(6666003)(2950100002)(6116002)(50466002)(50986999)(36756003)(47776003)(3846002)(33646002)(6306002)(53936002)(25786008)(38730400002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM3PR07MB2249;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR07MB2249;23:T1SBAS5zjagsfaG8c6ecWfW+qr8WcTQSBhpSLgW5G?= =?us-ascii?Q?hG5HfITtClSE7732MSvXPi0PCk2NNFdax//Lqh3bkd1TcjifXSIFOOoudiwA?= =?us-ascii?Q?rYxhL01tpuInUBj0pzCjgzqXHrhlOxogsmrK0MUZmmEKri3lYRx6Prr6X+08?= =?us-ascii?Q?5YVDR1QS42fkjiw6juU0sT0pBo3564F8sz+YfiEwahYqq63KH0Tp2GP9A18z?= =?us-ascii?Q?iFGdUK5xVM5/V8eDmUSRHe99KTV4htf0/PMRQVztTzybuG2c9fmuozWrirqB?= =?us-ascii?Q?lSKERP8ylLFWo4lUBRmGfqomZC8L7orlvfYueovk77rVsqZC69O+lGFNhbqV?= =?us-ascii?Q?JVBM6UzihjDz/4fa1fCx60maRya4Fk57no2++/sltp9zPEioZ9kNm21vj9H2?= =?us-ascii?Q?sN6Rth4RttQUKx4NDnY/XrXH58ZfhWCxFrsHPi9B/V3rsZhliA9jRReWYjBa?= =?us-ascii?Q?B9boqKdFezQnp6Nw7tXaBwpnMWCLLzb5Z4C2dtoww4q42ISuMu0bcWFzmD8y?= =?us-ascii?Q?nFutbJHVbeFlLb9cF1ItR3M9NihO/pCHnHhOjkdiuQAncqKFDux9YhFC6+/e?= =?us-ascii?Q?Ax02LVJ+gSNG0BHL5EhElBRCot8ev02NtukDyISO14G2fsDxOEGjFa+rzu8R?= =?us-ascii?Q?PibFrakEl8dZDb5UQQ6BghppNe4h/cAcjoCyWGsvdJAuZnQQNDppkX8oPthb?= =?us-ascii?Q?gPSjlcOodz7l4qmzl2mOlXJq05SFbsW2P8ppX19HE7bu1ZZnqc77PhRiLfwg?= =?us-ascii?Q?iJTIYKRNL4kw+TCSai1vJYEy21ZR2Fei6LNXQOJLK1RhoBjNRkgi7bwtEzLr?= =?us-ascii?Q?dRvWccnjnch3yw/nqPM7+yenD00GOj2kYG80vutkcWYM6LEKj2Nr1R8Vy3Gk?= =?us-ascii?Q?1V7uJ7jCd9yfZ5ZKK6tcQyuHA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j5JCoSXYT7mSQzOFBsFLPPq+Ox+hx/j98tiRVw8RI0wXzLxwnv42c81570pQJpAJDF8BEYCev5+EG7eJnizSVOoTQotfJXI5vb59JHtD7RxUX6Mpclp9z1KRSh2A/wVFOjvSv6DIY+lb49fCpz6jMIRC3DdnMQUjo9Jx+jPdeEWZgsGnxGN7oOutXW9KX6Gh82f68XkSIO59GaDvG1Qw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2017 19:22:12.4370 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2249 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6397 Lines: 227 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 | 80 --------------------------- arch/arm64/kernel/entry32_common.S | 107 +++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 80 deletions(-) create mode 100644 arch/arm64/kernel/entry32_common.S diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index b6f14a8..e0798d7 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -30,6 +30,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..4bede03 100644 --- a/arch/arm64/kernel/entry32.S +++ b/arch/arm64/kernel/entry32.S @@ -39,83 +39,3 @@ ENTRY(compat_sys_rt_sigreturn_wrapper) mov x0, sp b compat_sys_rt_sigreturn ENDPROC(compat_sys_rt_sigreturn_wrapper) - -ENTRY(compat_sys_statfs64_wrapper) - mov w3, #84 - cmp w1, #88 - csel w1, w3, w1, eq - b compat_sys_statfs64 -ENDPROC(compat_sys_statfs64_wrapper) - -ENTRY(compat_sys_fstatfs64_wrapper) - mov w3, #84 - cmp w1, #88 - csel w1, w3, w1, eq - 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..f4a5e4d --- /dev/null +++ b/arch/arm64/kernel/entry32_common.S @@ -0,0 +1,107 @@ +/* + * 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) + +ENTRY(compat_sys_statfs64_wrapper) + mov w3, #84 + cmp w1, #88 + csel w1, w3, w1, eq + b compat_sys_statfs64 +ENDPROC(compat_sys_statfs64_wrapper) + +ENTRY(compat_sys_fstatfs64_wrapper) + mov w3, #84 + cmp w1, #88 + csel w1, w3, w1, eq + b compat_sys_fstatfs64 +ENDPROC(compat_sys_fstatfs64_wrapper) -- 2.7.4