Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751410AbdFDMDc (ORCPT ); Sun, 4 Jun 2017 08:03:32 -0400 Received: from mail-bn3nam01on0070.outbound.protection.outlook.com ([104.47.33.70]:13920 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751356AbdFDMDI (ORCPT ); Sun, 4 Jun 2017 08:03:08 -0400 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; From: Yury Norov To: Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Arnd Bergmann 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: Sun, 4 Jun 2017 15:00:02 +0300 Message-Id: <20170604120009.342-14-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170604120009.342-1-ynorov@caviumnetworks.com> References: <20170604120009.342-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [176.59.55.28] X-ClientProxiedBy: HE1PR09CA0075.eurprd09.prod.outlook.com (10.174.50.147) To CY1PR0701MB1274.namprd07.prod.outlook.com (10.160.149.17) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR0701MB1274: X-MS-Office365-Filtering-Correlation-Id: 4291d74d-e98d-4743-b30e-08d4ab419f58 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:CY1PR0701MB1274; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1274;3:tnjUG0Tc6elxGS9P3o8xCvoUeuZ1/IG9+z107JuVonoRIxmePKkOv/8KgtemKUEMTdpRTRFG1nAQqEpMYsEvANpBko1Jvx5QatWSPGeZKtDzxfbIuu4VAV7e5nG3OuYzI8bTat9vR6uaJHSeMuAWW8x+Ko2kfzZ91WVdRoxVYh64pbsOWhc9v+jZ2s1sayKne0bU1xFRvwVzGIaHuzCGqfNdC6pxiJKbEgfYVxvZyodU0yyllWJD40GJjgGO9qjUn2/8cPvkGaO3kfhcsAnl4b6T+lnlC/TgbXBGVDqdEDTEiSn3GsZnqRKkoAWt2hGkWby4l/f0XD+F5MI7l0YFSg==;25:73u4rgSZfTvOHwbz7D+KOpyiiapi9PSuy2a8qjMY3vDOgY0IuWmMankyoDLqFHwC5qJkVnELiHGj8k1ZyoiH95TXM5wb7iNONdOL+/LQO+bOpxpUNTqTEjpuMcsG+DYkx7eek5QAgzcIqypeB6ieHWCqnBkg5pcDxI+/84xJnZWqQza81js3gXeR7gvJO1tA4zOiF4sN3ETQRUIwmO0HTHPM7irtA+NbQ0/NcvKswD6QIIrVfMkmSz2+miTU53Hclej+3lStW+TMViPBjos5zl64NmfLH26sTwm09WgrQqtYKEDB3Gb+45A/65bZx/9ZuWSHLPAApviKt0AY5zoIx2vDgqr2wx5BJL0uySGTr6dUTrfSmKABndp/v3atMaEj4+ffoOylU7YnyoiGvckdXVOCdIHoSJY2TYNSZQASgF7mW2V5TVyaGL5Vh8kR4tB502UjxB6kjCypFfwn+GeZ5GhiWmNlB+kRJKAgDcbaaoQ= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1274;31:sY5FNmkGRPnYz0P60VI6NGxHMLNCcZ4U22YyQHsn1QiPL0wcBE2uSbRM6LCxzMy/4vILsNe/xpI+yDqUiaKT0XQEfoQkNk/v0GvXjKA2fv4MkgoLd4ldG7NifDY3b36DhOPk+SNJi/8xaEVKSOkjfNTpzk1KZ1sbQEWLECkPwtno4dtq+5UaMdfhDRfz09nABxrTQjjnc4PFLNXQ86LWrI5bNReII0h2M9NPP53Eb/E=;20:EhlHOEWEVQnHUkxRl5OdEiv1CfmvogbRAq2nN0y9L7dlBiSp22OIhL+lAwbt74o3l8eGetM8aQc8ZwZd0S7OvazouhqDjEcJfC4uJmA134sV8QwA/sli3BOMn2MyggTqS/W9n0FX+/T/n5nJTVz6TXaZLI8f5QaAb38hSqxf2UDnUjOM02Y4cN1BdKwH+2xxnpKm+lLHIENwJRPU2VNt2l5EPTGqOSxXzfLsprJTbDW+S9INqUJ+I+WnnXPH3XdKWq3ugmNCiS7kmrTzvb86veOgjLZFmqaTI4AjlXogWYx7qJ1LpffLHH5xxECZOY3e8NegOUMuk3fH1Rxsmd0Vc3flRwXGfxpcRQzLWYqf9R/uURixR0i+OQu/8vLXsijsMm/SvdfDloIR5yTPF/bhcM6ZF8OQJeM7DEni/RCZV4FEZH7FkW90QY8hjnTUiRW+q0l3nDfGHn9CU71FDfOnwB00YChZoIB5JcAnF+SX4SeNd8nhhTbYvBNroI4vVWnHjErd21WpKFW/zXjF66srUYjI5V1MjGuiYNJQHu6E12Ix2rCuX7CBekdsswKjHn+pQH8uvyclfZzk2DFh2lPjFgYiwqFmhGxeHvTYSEmmeN8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(180628864354917)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(3002001)(10201501046)(100000703101)(100105400095)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR0701MB1274;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR0701MB1274; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0701MB1274;4:A4DIYkIl+APxO3xfPLgGBh0omAUqhTX2IO8g6Pon?= =?us-ascii?Q?lOPGRsZ6nP0/rJAv4E1zVMFrGotRDYgIbDp0jug6kak7lsg+jIxJlDVazHzr?= =?us-ascii?Q?GIpVwVxn+fX2ZqiQTFG4fsqd7V4da9VEAQdIK1U/bJUMpZsBiOCLWR5cJ3SB?= =?us-ascii?Q?61NqSua6uLMgLPXD5m9fVaxKICwKkjp7c46qeaHrC5WFJ9RFb3yq+CiMCp/Y?= =?us-ascii?Q?x2kvvNFtePLaOaqlFSYA3LCY1xqhEb1HLumOrmM1udpm/cY/vPQSheiGpnC2?= =?us-ascii?Q?o0zejYDHbfzPlhdaUWYIdDWCnjulTMchK6TiUKXUMY0RIqxhI9j+NsCeB7Ro?= =?us-ascii?Q?0ZuTV+JL19kGZCLhvnNN6SLxp3fQaIXC+xIG59CLYlazvBHQwXnv0fAdyJ9w?= =?us-ascii?Q?j4Y3180wkc1taO5PvzU9QRbiqvPxXPD22wkHc0tLbkGFvWT+/w3ml8pd7Z1A?= =?us-ascii?Q?Jcm5KDjyTrnKGP9sbdGhE0NdNH4AwrnwEna/4Qf0cmeVpM5gvuZ8aORF1Nf9?= =?us-ascii?Q?mRzzBvCIS6GDYiGFhT2wsz52u6lbEbjyLxbM00rTLJHM7DuJZiAaLFTXM6L7?= =?us-ascii?Q?rVGtS3pJ7IVjwlSeQglqXi83IfwvWps6VpwqTi8mulLjxvVjNfUZTbarhEdB?= =?us-ascii?Q?rnQ3/kW3A3q/7FHucHVYPTkzFJAzA11OCjM0q9BjsPaFOk/fNnlg+dByxTHh?= =?us-ascii?Q?ItPwjYfM9kT8ndZflj5CYJPuSffg4JQZ0Oet9JpVhy07m6P+LBh97bzqoqZ9?= =?us-ascii?Q?wr6so3i9HP7MOAnOJD+rNinJ/U9bwwR1jwGgKjetdzeB/qqEOCUxCG2nrt2f?= =?us-ascii?Q?OemP6aOpLuDsM7I+bs8ei0D5Ck2ZiRsRreY4y0pZMBBYi/AQIEyWlXYEOwmo?= =?us-ascii?Q?nAyM/4dKeoUDIzCjq8L8ZCY2mmQHkj/NYDBklZhrSx3mxtaw39LGW/t6XMKu?= =?us-ascii?Q?sufjP8ZK7q1k+NBa9kKrw5U0JvVw91BZeEHyHF6hZ8dF4O6E1vavBUrDVZwX?= =?us-ascii?Q?HLlDwMMyLHubxkj6mtp+jYgSMMQ4t28qiyivlQrraBO8UiJtUfqsX76SZq18?= =?us-ascii?Q?OrEBuTKldydRZvNq2ah4zAvSkxnJOVp9Xg9c2odogiSHVg129xKepKsM8C9G?= =?us-ascii?Q?JEYuGibgT6b4YOBLIRglHiHos6HBJRieLOFZvK0a81Q145yzQXggG8fvO08S?= =?us-ascii?Q?75+S3YFyFVeHBcCalK1yGrx5G/i//Mf6eUE55p3xRnXQW3NHoBmA1szEA+Fc?= =?us-ascii?Q?062AL4k3KaQkLOQ/9dk=3D?= X-Forefront-PRVS: 03283976A6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(39400400002)(39850400002)(39410400002)(7416002)(3846002)(4326008)(6496005)(6116002)(1076002)(38730400002)(76176999)(5660300001)(25786009)(72206003)(2906002)(478600001)(50986999)(5003940100001)(33646002)(305945005)(42186005)(76506005)(189998001)(36756003)(66066001)(42882006)(6666003)(2950100002)(6486002)(6306002)(48376002)(50466002)(50226002)(53936002)(81166006)(47776003)(54906002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0701MB1274;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0701MB1274;23:7giLwfB5YIuIRb6oGNAZLQJ/CrIRmj2Z2P7UI5H?= =?us-ascii?Q?LMJua2XjloVX0uPfpeiq23OmgZPf8eW3hb+nY62s/YCnHh7Dw876E4yX77JG?= =?us-ascii?Q?jDXONynhhx9KIYOfYX0gic089Hix0Nn1meztAkYxm3ikdlaNcaNLvuzLF68d?= =?us-ascii?Q?7aZS2g+kHOGF6rbFtjW7KCe3bPfruCKLW9DYDMbdmRpBgyzNAajoJidEpum0?= =?us-ascii?Q?CNtth3Hp7dehFgh0GwRM/4yXR9kyaPRnPDB6KVK0BhbsZcbK7oyPrwwjnPss?= =?us-ascii?Q?K64+oK+LXudmocRjypXz2dbQ5QS6nDX/TlK+FI4ss79ZGL7M0BalrgRT1PKL?= =?us-ascii?Q?/+mZ2nR3ziZkFiWDWBjw00tLUUGBwcCS/VvRFvZ6iUnH23pGRwl8OeSmhCqL?= =?us-ascii?Q?bZ0zTXMbjmix9aB2vP/a0FitA1OrvGHJ0/IFx1o6t+QJvCkgY/9i0KhereX9?= =?us-ascii?Q?i1mVv35sJEAvHQdi5lAxfiZM2xUI6yMMSZLqm7pTx29T13UAbOtvwF3ktrum?= =?us-ascii?Q?jxl6o4SLr1blf06aXJDZiymaUlTiygPy0StPGT59BzoMyTZt55cOuLkWNkFm?= =?us-ascii?Q?KVRT1588Yz/nMBgWPGYIJSLGRB7zPfy3Vdmc1Jc+gbl/2Io+SWujFp/0nPwZ?= =?us-ascii?Q?+ZQDuVwF6E9LdLjI6Tkk1JIlps7Ty15LB5Sayk6tun7kXHU7fitxm0XelBvD?= =?us-ascii?Q?67W9xptuFksRZweCM8fgej7zg//qHkTdcbH+XhNMdGD5898awByGb9A6QJog?= =?us-ascii?Q?hyrGn/lVAqEjf2dKvKHF6nAXijvodNZUrAyMk+i9WklC0LAiht4jaLQn2kBr?= =?us-ascii?Q?09n/JiKOpGi7PjAT4NoqUWA8N48Vv/4R22cN9kgeGgY9Y4Ds/5Fz7Lta6vkg?= =?us-ascii?Q?T2xifkZ8AtDw794Twi46YihrYRwCtcy/oIL7QIdBesGxFWSOS8KyBXhB5Qdz?= =?us-ascii?Q?pFRDnRwgDpAE/ykBSV4g4jmwB/RZG73jvwSxCygc4rEUr4zrgd4J0zd+VmQG?= =?us-ascii?Q?d1G6aubHUVXJxYQPVFsijDxOMF8ejr/obuhetdIFlZhYu/A=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1274;6:PLrRVtEbPNytfk+Kik03EPgeZODuWtTxBt6JgbgDorNxT7oC34nMl4q5fjkZg/Pt+dw3pAvkmjvCRx9DMbiNiKPbhCtXGR1WOtLas/VoZl3DJtLan021mQZkp4U1HSimWzFlCHr81k+IqAwqjtHQr8L+kNtlzuCc1MzDpIHeRCyZN2sjpr0NUizcg/pznXnGNDwzFJ20mjPnBUf4O6ijx8bU/kCCqiCJ2qPHphi4gAs4KGLRcx1vMBxNebOYBE2LzOFMv/8T6dqvyw4Js2b7jOI7hWj0vZO9XBYy8gt39etkkX/kmlCVsAQyLrmat28va8vczGPUjdyIckp3ZaLgJKHSbGmPETG1JzETqb1UAYDv67s2T4pM3dMLKf/OsfvHz/5ivTwSRHbQmvnx2V4LMMt75cdqsgl/vrKzunOnuy14N+h8a0eczm3gJ0YuAHL3vNzpUupnymdlc6jmSseBiW7jui/gK2NsaljrQ9wz7beqCDJqKlJbs72yoQ9Z8vLONxv3As8YZkqnkjHavSi+fw== X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1274;5:jJ9ewyeBn/5S7mlb/neQKwofTpq+9THe6u+6ppj18O+iIkiNJzmzSVQssBfker62sQ1r4RFgXgFXFWMhyFqCg33FsLRROys0pR6FAtE+Uur40NVP7/cC9B/qonuOdHamlRPwQgxSudb/Ng/3Myobnha+m3hpMxXP5BpGrVM5KqJOPQsalIweopot0m0D9v1trxis0o1GW9Nj/LbFeY1scD8Tjhyu2kDSI+I87sqRXYcIYM2i4lT+5YWV7cReS7LecG8kV2mMLizyse59EEsivxdYcskKQxcE3T0RN3wvg45dho74yhS5j2mOR5ppzAdkWcQ09WdG+EoqcMI5v6fb2M3PP5X3Qd42RXNgGGsJ0Ve2/ZeYCkyEGJ7VUyZJr01un0H1IAEKt9LC93QL/T65GmTVAK2MnWbq95ju3CH6IYQEZvu+mJHStYRt5zS96RVbvsdZDzicox8Bs5R3rNJA/xPoc6jomehabqm+aIWk6NaNzQByUkPghBAxUyCgTtt4;24:1DBEM9c3TFaEpxbx2C7o4wF7gjVwh+WdnGlmGDLxKRGCHEh4TnLJriHtPILdOWO5BAc+kqk8eRIQcPiiyNvDfXQmwjvK1yIAhwIZ6XvBObc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1274;7:8mxM7W67C75YSL402sNM+GlnUqXwQ/MbTq/dkJHuL1/9+N012RM5ociElOGsaP+J8OeJRVEnO18PQ/VnxyBRQGTdDtzcuE3az6j5jZxWekruMhlVLdXwQc0IcgbgPFA6229W64axKGeKyAzebZYSL1TEvr1PmZrVsTIEe8tc+vC8P7lhlfA52sTycmr/FHTfzqS7A4+BC2+IssZmj0XzRfNib3jTMT5SJIFYsrH5xbPxqFu+xxOCehw1wAbI+W9BHJ+hTWOU37aL453Fz6qtucXRJd0zGENRimRQIexW/E+o0xMQ2C9KMMhbokayedyiMtOXyNpZNOmHgJEGuqG12w== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2017 12:02:49.3040 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1274 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6428 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 5ba41095c466..f6f12e2e5010 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 f332d5d1f6b4..4bede0324440 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 000000000000..f4a5e4de6201 --- /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.11.0