Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753373AbdFSPxP (ORCPT ); Mon, 19 Jun 2017 11:53:15 -0400 Received: from mail-dm3nam03on0081.outbound.protection.outlook.com ([104.47.41.81]:14240 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753760AbdFSPxJ (ORCPT ); Mon, 19 Jun 2017 11:53:09 -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 , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Yury Norov , Adam Borowski , Andreas Schwab , Andrew Pinski , Bamvor Zhangjian , Chris Metcalf , Chris Metcalf , Florian Weimer , Heiko Carstens , James Hogan , James Morse , Joseph Myers , Maxim Kuvyrkov , Nathan_Lynch@mentor.com, Prasun.Kapoor@caviumnetworks.com, Ramana Radhakrishnan , Steve Ellcey , Alexander Graf , Mark Brown , christoph.muellner@theobroma-systems.com, davem@davemloft.net, Geert Uytterhoeven , Alexey Klimov , linyongting@huawei.com, manuel.montezelo@gmail.com, philipp.tomsich@theobroma-systems.com, schwidefsky@de.ibm.com, szabolcs.nagy@arm.com, zhouchengming1@huawei.com, Andrew Pinski , Andrew Pinski , Bamvor Jian Zhang Subject: [PATCH 14/20] arm64: ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Date: Mon, 19 Jun 2017 18:49:57 +0300 Message-Id: <20170619155003.13218-15-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170619155003.13218-1-ynorov@caviumnetworks.com> References: <20170619155003.13218-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [85.253.137.34] X-ClientProxiedBy: VI1P190CA0035.EURP190.PROD.OUTLOOK.COM (10.165.188.176) To SN1PR0701MB1870.namprd07.prod.outlook.com (10.162.100.20) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PR0701MB1870: X-MS-Office365-Filtering-Correlation-Id: f326931f-8cef-422d-82e1-08d4b72b4618 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:SN1PR0701MB1870; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB1870;3:M0E6GO71+XsYAH/EoD49eD2QGyJA0SYviY890pQwm1on+YIMY65i4MOTDerVP3d0QNGJruqctUZa+1Kyo+3wXOAtJgv3xPDwa7/F3rXVhfh/6p9J7OudRM3gwn8DsJwztg/DnGzQVSGdPTJO53n1zfjldk45EuBzet+0RWRgLVdkrsWDTiCtJSY4o4iLkeufj5slB4r7PDTzd448fgb4uESI6HRpo8bYSvkJnp871nco9ELnBLY9886A+NapZLP3S2/z4jxsqa/lVKBDeDOsOLPnQE+XN9lFWDxn7m3U9PHZWzcaXVN9IYoR3cMGbVwwP60OJo6HozqdVzQCe8f6pA==;25:5mANwj7ksdGsxGq0FztTWhUh8JbS7izkq9gfSQwHjuB8afBFaLy9QqsJEbJaANW8a2NrP5c+S0MYAHUoVOfbnqSlXd6bZRsoZjTLR+YsjcugebNrGkc6WdvOHJz4KBbQ4gmUshEzDS3kvVpD7I7XipZMg8+ist6uO/QwGcgcReJ6CuCZw5zYaFBj6ako1dfI+yzauYTwu5cpFS7vrspszDoS3wvvUepUu9ElP//iaK3lMO5cq7QJw6Vxmkn/Mz0Lnj/Irs/Kaywxhadv/v4i+D+FUPpW0xkaJyYy1VbaTd4LGpw3HiuELqSvK+GVbtF1FUlzYIqf3RHHswwTHPuQdd4vBKG5kT2FWHH+JFLvGmLlKdKLAb+cEP/2cDK56MS8J65AfK2jha+RQDZ6Xw0UhdX4VBo2WJzOhuT/h6M8rtwq1afV7mCMfzaQwbq5z8obsdtzLrftZ4N6FoLTK79vQShjZTAbRrsDawnOHsUVOaU= X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB1870;31:Y+QGO9zSpKSu1T2RrIpU7JM+P8rrDAf/Zo1Cz6fwzosuYsW9OIB23kG117yBQLv8GEcILydGnGFFcFBuHtwJwAQGmVgTwSrFyo1tRTdchV1kPUXlxaECAYQdVziXAUXSTShfsJBdH1pAqjgnjwLHlnAaA7fe6e0695eiiQ4ZecA4XBDTcWOJEurYLVjf6sLksj7eVKD7zNuVd+68feiPFpou1+jU3815K3LIDud9OjU=;20:rL40mustigLd11OOstybitrXyevmrW10CjQZs08RMGVMJHNurm9t0HDsEVdL+zoU+EGep43NDNQ4cT2rNa8kUiAYVnDcWow+CuCuE4d8XKN+WeKP36b/SIIw6elS0GS8P6TzTBMqUllOijef+TL0OXPF7g6ThzdqSF8I20P8n6aCbf/YOYkjZzhz/RgfV2GZNA103/WfryPNrJgBgdt/9l77MeVRY8Q3ND4AWqdDhBpAN1UZVosrDvvR7/JDUB5ImuwxIC66OvN9wlbESfcAV/cV1YElLHd6Sc2E1DfD7nfVbKC2fVN+JFpdU0tygoRLESG75LoTE+bXJoWiW6nsTPT0wO3rGyuSqi2lpeTBM2fA2bytJglyly7/Q7sdSa7ySo1j7oFxzr5VSxlIot9a5EicExcI0T6DnJw4slgwN+NYW9iSydPO9D4cIkt7j05MXdlo8CqZGrroM2AYhKz8H0wrMRaSAWZvDJ1HHRiKX2yfZAWaqT7iIik5EA2xZ3v4Ig2i6Bj1hWrmwZSufsCSG+0cSrMEPCepQzCVeRHE0Zev88rvFifGuqtM2nJvjbQnas5ordXQKxObaTZlRtla5SUCizv6aPxjAwHlG7UfNog= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(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)(100000703101)(100105400095)(10201501046)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN1PR0701MB1870;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN1PR0701MB1870; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB1870;4:oIqtIlmmvEsoIfYwyf/NnAv7Z1Oqxf7DzCRvUSOH?= =?us-ascii?Q?LrOslmpibHji/fj5SourFE/llkws2LxXocqp7HaW9h5RMFiYCnb/mR2FkkHQ?= =?us-ascii?Q?sqkaYBwTFHgBvf16OlbwYVITrQsqb/kkT8sbTwLSIYPJAbbyr4dbklWNGH0P?= =?us-ascii?Q?CWrTBHx5bwvFLpBph2k9yjbS6mpAPn5AR3iFZNfMQwvXQIzaINu32a0VYVdg?= =?us-ascii?Q?o4ZwymLN1T2ZwUfcUMNF6e6mI/MG6HkUC3C0X7OCg5JxGQTRF/A4TOLSAoyE?= =?us-ascii?Q?wF3jMzbRmb/EZ9OscBzuHaBJWkrSaHQ7pTyTdvbShr4k88HOxak8P7f34HbY?= =?us-ascii?Q?7feJ+RO+g5wa1kpU1Nq6UzRW26qun8pR8sXooZj3fL3eHN6nMIpEZ8r4iPad?= =?us-ascii?Q?QzjqLMJhkJXFMSPbr/Bg32UIsS05JgjTFbKS2xgYjarE0vUf4D0rrp1uKIkO?= =?us-ascii?Q?E5qMifV7GQ4gocHyn+nYMdWxPnFfzLtjUrIqK3LcmFtQ/1jMZ0fmXGm37hOJ?= =?us-ascii?Q?EycfN5vNElPUqSsXtM1qVCpEsQmktyiDTb72GtG2cevDTAAJ1JdlK+KIuBy0?= =?us-ascii?Q?QEZwrpZAJOkvH2w8/6YDsBGx3pN6E0cUGs4Nr+d8IrbCDnGa2FhGAgBO/xoV?= =?us-ascii?Q?pYMezifOdGoGrYJ/WjDuDxE1f0T3cZaYqTHewC+4a2WBhmAfPaCGV+AJxrbW?= =?us-ascii?Q?CEb167nQlWYhF4LeOMV9xCunwhJcNM8rxLndpBdNrFl1W/0wXfRNUNsDSXsm?= =?us-ascii?Q?6edyGPEdOz1DWW7+qpi4JxquptyJtXMNuHCp0FZCFjML0A7dLljw7EEQARev?= =?us-ascii?Q?3DE6aaMaamAhXqYegXgRrBiX94uf3C2NvZqK/m/B5bnS0PpgjCenw5nbVGMM?= =?us-ascii?Q?wPtSMpY5ojJCnmy42FzJ+T2Rh7aC5Icu5J+pkuZGI2FyPlnZmGoIapGRvc4Y?= =?us-ascii?Q?KYo1iUCwjTrMqrUBXPNo+qxHgWcnfBixR2y7B/k3wrTs39ZE37VHPJsAU0iC?= =?us-ascii?Q?+81snr871cDtuIE0HvBPJBiYSIkmvx0Cr5W+odU0w4STi2XqTtf6iAwAWKaz?= =?us-ascii?Q?x1/eiygwZqfFbwXjmWiGpexd4JCpSCdpHD9/2oczfb7jnS8L9J3TW3LIP/ks?= =?us-ascii?Q?ivPckRWpEGRD1YJkvGcpffg9Sz61pLI+xTTHWSfuEpmF9lv2ChLTF2AGNZJB?= =?us-ascii?Q?BpqJ45vR3rVuyrfVmFVL2vF8RO6+4SNtwj2B?= X-Forefront-PRVS: 0343AC1D30 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(39840400002)(39850400002)(39400400002)(39410400002)(39450400003)(50466002)(5003940100001)(1076002)(8676002)(50986999)(33646002)(48376002)(76506005)(5660300001)(25786009)(6116002)(2906002)(47776003)(76176999)(189998001)(66066001)(3846002)(50226002)(81166006)(38730400002)(54906002)(478600001)(6306002)(72206003)(53936002)(6486002)(2950100002)(42882006)(6666003)(6496005)(42186005)(7416002)(7736002)(7406005)(36756003)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR0701MB1870;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exch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Nf+vPBYDsWdTPYWLeSA2WczHZJ+KX1o2Qn8mC0pGr6/lxHIMqA?= =?us-ascii?Q?lwTSyi4dDlQQlTN3YbvUa0eDnKzm0owkTK9SIKscuiInssA67/Q3GKaM82V1?= =?us-ascii?Q?4IKyS4l2x0Esrv6YLbNDjMgm+yerlXop9BAxYXTzCXgN10IQibTQ8c0S4Xix?= =?us-ascii?Q?B4Ege8dbTWrt0SWKgeuSkCN1z78P0bb3Il7/qIoLr26zWjo0LUBpmeeLOwRV?= =?us-ascii?Q?EX9iIVuy5Co/W18shGH9hOTEcysJaTgfz75AH65463OOgJGeD1Q=3D=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB1870;6:oTerk3z+ttwpmGPZKX51fUMyGepWeLpdiPCUyVmC?= =?us-ascii?Q?JQfsHbqp/ac7qzjSo0l5ob2u+H3fuExoRATxV0W1/q4xuimezXSXhrcUQ+BX?= =?us-ascii?Q?2i3RMmxpL1DB7G0cWG1haCEaaHJL0T0/+4ohuAyGLBrVWE9Z4LnZMh1R98fm?= =?us-ascii?Q?8l8eyXdtqk3cFcwj844wtZ1VBlsRlbDprA16CtBdH9oXkMofsak2dSw0oaAs?= =?us-ascii?Q?zIKYi4fllYux/tDvRAEiEm5Qp/UXbzvgfDkiJOReVh9f48y1q5wThO8ev1OS?= =?us-ascii?Q?6Zb4LUhYZNsoLc/QVFacFa8VtNwYD7GngpuHAxYsYeJxl5K1RdiuhZx4MWOI?= =?us-ascii?Q?0WzoqwPk36nl+PQJbhT8AY3TQW4rzF/d67VwBK826f087c5vXWP5u9Hu0xaX?= =?us-ascii?Q?T0ybKI44OMppZtjx2/UO7+ZU86MgBXOXkuL0NsvyJGBjYNIePG5lxNE4Gowc?= =?us-ascii?Q?6JpRK19s+W1MB22gkDfdqMXgCx1SAx/h7n5ZqgT2lr6xWblPsTEqycv3vKpI?= =?us-ascii?Q?DKa2fBw3vcMJRSh3MzvbqrXzbhVCGoZDLNC/vAdX+m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pg+hSgVJGMLVHFhFJwSpim5dLN;24:9ey/BoSqmknBFHK6/ArBSvtIDFxPXcJukjXqy2Mdg5xe/6DYXNqfa9Mu+znr3xDZrJ8Zj51OTE862PzNc1EKBsKklJTfc1WJAM5V/u7vMlw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB1870;7:O9RWMW6eDja50l9mT91r1OtFWQ0EP+wug/iQcnYoqg3kM74kkeMDzmgGA3zGHH5a7jkBTm2MMbcvdPe1sSzisn2wOmwE8QmpYG++uCtlRaoiQmGQzZT3ri4kq3cya6EFLXlOn9Ddy7LSEKz9nRcUZOokprWJ+Fz1dJraiefrHGYT3iD4kt6bdcoZXZSjII+nBNpW3jR37ZBEnV9VoORPkxcv1QcODisOZfbPZ+ifAoMmf6jEn/PmyWJWcN2bCc+qooOefDUokssFClcBiR4tDW6NNAuLyzcts0gSGiLZAJJXaF+qen4/blwDwhHLsU3PVnPkNu0Et7f67ft+neiCaAY8DQnKr3mG2LgDjEkc2btEsxpWqbHtHZA0dBAwrDzZaaTFrwho5aqZ6dIJJMiqEXS5+48bDaxZJcnKo0onTZaWFa0d68K3A4VmLPMjVA0jK/Lqr02o78GqA/43fqXacjjFs2fPMURkK5+8LIU6G2PJ8ebcxbGU7IS4Fie+HdErqWTBKYMw76Dbuw6L/w7JsFc+Ob2lk46EZpBT5hGwfgXNLT+zaAuWRnpiefrQzGJuex5705zDJKgMu1IOvqM+vKHyAPcqitimLFIg9m2FtcaYnjNllvl6bSZLH8D7yHSmDUC1XTG0n7hz/nZz4fl+BfLNF8lY80h/wwve8gUCwl/LhgxlI0YehI5ugaLBBqLwn7rpcEk2+fW5vAWeVPYzqMhcChY0EQcxua6nPLzusj8839zLQ4rscMrcOJ0is1SBLSTOpaATiPsOAAhPevNht1HMvTnurfUAcxzChFI9+no= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2017 15:53:04.8258 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0701MB1870 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8293 Lines: 245 From: Andrew Pinski Add a separate syscall-table for ILP32, which dispatches either to native LP64 system call implementation or to compat-syscalls, as appropriate. Signed-off-by: Andrew Pinski Signed-off-by: Yury Norov Signed-off-by: Bamvor Jian Zhang --- arch/arm64/include/asm/unistd.h | 8 ++- arch/arm64/include/uapi/asm/unistd.h | 12 +++++ arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/entry.S | 28 +++++++++- arch/arm64/kernel/sys_ilp32.c | 100 +++++++++++++++++++++++++++++++++++ 5 files changed, 145 insertions(+), 5 deletions(-) create mode 100644 arch/arm64/kernel/sys_ilp32.c diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 99d29290c98b..1bf5572cd078 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -13,12 +13,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifdef CONFIG_AARCH32_EL0 + +#ifdef CONFIG_COMPAT #define __ARCH_WANT_COMPAT_STAT64 +#define __ARCH_WANT_SYS_LLSEEK +#endif + +#ifdef CONFIG_AARCH32_EL0 #define __ARCH_WANT_SYS_GETHOSTNAME #define __ARCH_WANT_SYS_PAUSE #define __ARCH_WANT_SYS_GETPGRP -#define __ARCH_WANT_SYS_LLSEEK #define __ARCH_WANT_SYS_NICE #define __ARCH_WANT_SYS_SIGPENDING #define __ARCH_WANT_SYS_SIGPROCMASK diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h index 48355a683e25..e7106bb45095 100644 --- a/arch/arm64/include/uapi/asm/unistd.h +++ b/arch/arm64/include/uapi/asm/unistd.h @@ -14,7 +14,19 @@ * along with this program. If not, see . */ +/* + * Use AARCH32 interface for sys_sync_file_range() as it passes 64-bit arguments. + */ +#if defined(__ILP32__) || defined(__SYSCALL_COMPAT) +#define __ARCH_WANT_SYNC_FILE_RANGE2 +#endif + +/* + * AARCH64/ILP32 is introduced after next syscalls were deprecated. + */ +#if !(defined(__ILP32__) || defined(__SYSCALL_COMPAT)) #define __ARCH_WANT_RENAMEAT #define __ARCH_WANT_SET_GET_RLIMIT +#endif #include diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 7243ffe358b4..c329a4e28a92 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -29,7 +29,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_ARM64_ILP32) += binfmt_ilp32.o sys_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 diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 279bc2ab10c3..3723a20ab503 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -308,6 +308,23 @@ tsk .req x28 // current thread_info .text +#ifdef CONFIG_ARM64_ILP32 +/* + * AARCH64/ILP32. Zero top halves of x0-x7 + * registers as userspace may put garbage there. + */ + .macro delouse_input_regs + mov w0, w0 + mov w1, w1 + mov w2, w2 + mov w3, w3 + mov w4, w4 + mov w5, w5 + mov w6, w6 + mov w7, w7 + .endm +#endif + /* * Exception vectors. */ @@ -577,6 +594,7 @@ el0_svc_compat: * AArch32 syscall handling */ adrp stbl, compat_sys_call_table // load compat syscall table pointer + ldr x19, [tsk, #TSK_TI_FLAGS] uxtw scno, w7 // syscall number in w7 (r7) mov sc_nr, #__NR_compat_syscalls b el0_svc_naked @@ -798,15 +816,21 @@ ENDPROC(ret_from_fork) .align 6 el0_svc: adrp stbl, sys_call_table // load syscall table pointer + ldr x19, [tsk, #TSK_TI_FLAGS] uxtw scno, w8 // syscall number in w8 mov sc_nr, #__NR_syscalls +#ifdef CONFIG_ARM64_ILP32 + tst x19, #_TIF_32BIT_AARCH64 + b.eq el0_svc_naked // We are using LP64 syscall table + adrp stbl, sys_call_ilp32_table // load ilp32 syscall table pointer + delouse_input_regs +#endif el0_svc_naked: // compat entry point stp x0, scno, [sp, #S_ORIG_X0] // save the original x0 and syscall number enable_dbg_and_irq ct_user_exit 1 - ldr x16, [tsk, #TSK_TI_FLAGS] // check for syscall hooks - tst x16, #_TIF_SYSCALL_WORK + tst x19, #_TIF_SYSCALL_WORK // check for syscall hooks b.ne __sys_trace cmp scno, sc_nr // check upper syscall limit b.hs ni_sys diff --git a/arch/arm64/kernel/sys_ilp32.c b/arch/arm64/kernel/sys_ilp32.c new file mode 100644 index 000000000000..d203dec7011b --- /dev/null +++ b/arch/arm64/kernel/sys_ilp32.c @@ -0,0 +1,100 @@ +/* + * AArch64- ILP32 specific system calls implementation + * + * Copyright (C) 2017 Cavium Inc. + * Author: Andrew Pinski + * + * 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 . + */ + +#define __SYSCALL_COMPAT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * AARCH32 requires 4-page alignement for shared memory, + * but AARCH64 - only 1 page. This is the only difference + * between compat and native sys_shmat(). So ILP32 just pick + * AARCH64 version. + */ +#define compat_sys_shmat sys_shmat + +/* + * ILP32 needs special handling for some ptrace requests. + */ +#define sys_ptrace compat_sys_ptrace + +/* + * Using AARCH32 interface for syscalls that take 64-bit + * parameters in registers. + */ +#define compat_sys_fadvise64_64 compat_sys_fadvise64_64_wrapper +#define compat_sys_fallocate compat_sys_fallocate_wrapper +#define compat_sys_ftruncate64 compat_sys_ftruncate64_wrapper +#define compat_sys_pread64 compat_sys_pread64_wrapper +#define compat_sys_pwrite64 compat_sys_pwrite64_wrapper +#define compat_sys_readahead compat_sys_readahead_wrapper +#define compat_sys_sync_file_range2 compat_sys_sync_file_range2_wrapper +#define compat_sys_truncate64 compat_sys_truncate64_wrapper +#define sys_mmap2 compat_sys_mmap2_wrapper + +/* + * Using AARCH32 interface for syscalls that take the size of + * struct statfs as an argument, as it's calculated differently + * in kernel and user spaces. + */ +#define compat_sys_fstatfs64 compat_sys_fstatfs64_wrapper +#define compat_sys_statfs64 compat_sys_statfs64_wrapper + +/* + * Using custom wrapper for rt_sigreturn() to handle custom + * struct rt_sigframe. + */ +#define compat_sys_rt_sigreturn ilp32_sys_rt_sigreturn_wrapper + +asmlinkage long compat_sys_fstatfs64_wrapper(void); +asmlinkage long compat_sys_statfs64_wrapper(void); +asmlinkage long compat_sys_fadvise64_64_wrapper(void); +asmlinkage long compat_sys_fallocate_wrapper(void); +asmlinkage long compat_sys_ftruncate64_wrapper(void); +asmlinkage long compat_sys_mmap2_wrapper(void); +asmlinkage long compat_sys_pread64_wrapper(void); +asmlinkage long compat_sys_pwrite64_wrapper(void); +asmlinkage long compat_sys_readahead_wrapper(void); +asmlinkage long compat_sys_sync_file_range2_wrapper(void); +asmlinkage long compat_sys_truncate64_wrapper(void); +asmlinkage long ilp32_sys_rt_sigreturn_wrapper(void); + +#include + +#undef __SYSCALL +#define __SYSCALL(nr, sym) [nr] = sym, + +/* + * The sys_call_ilp32_table array must be 4K aligned to be accessible from + * kernel/entry.S. + */ +void *sys_call_ilp32_table[__NR_syscalls] __aligned(4096) = { + [0 ... __NR_syscalls - 1] = sys_ni_syscall, +#include +}; -- 2.11.0