Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933837AbbLOVtG (ORCPT ); Tue, 15 Dec 2015 16:49:06 -0500 Received: from mail-by2on0070.outbound.protection.outlook.com ([207.46.100.70]:10800 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933609AbbLOVtD (ORCPT ); Tue, 15 Dec 2015 16:49:03 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: , , , CC: , , , , , , , , , , , , , , Andrew Pinski , Andrew Pinski Subject: [PATCH v6 12/20] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Date: Wed, 16 Dec 2015 00:42:38 +0300 Message-ID: <1450215766-14765-13-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1450215766-14765-1-git-send-email-ynorov@caviumnetworks.com> References: <1450215766-14765-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR01CA042.eurprd01.prod.exchangelabs.com (10.141.191.32) To CO2PR07MB618.namprd07.prod.outlook.com (10.141.228.149) X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB618;2:EJyX6fiKSSMXV0cBIFu2vRIEtPZwtcKfLXtsw7fGoehTUcYTBTjUedmbW0ak6O5V51dNwXEsFYMorgHMtIF1pyZaixeHUHRb2c3fY42dgmYWtsuU+9ZzHuf1DesYwRvErvUN9GtRMeshW989zOe+Kg==;3:tfxILCTxQSNe1YUEn4ESotVgd8sPoZp7a1OVDf8TPYbXMgBVB5/N+/iDwK89/zcXgHbM+JD16aWFRmifQ/h85PUd9HsY24VUWfBh0oSZMiHF1TShtkir6WFExvSO8lQO;25:fYp9qiOg2MLa+gFsHPSNyEmmpcvzEVTr1ss8SLZKCr+Jq15Njz02iROb+gUt6UGLoZQfi04gOsjSm7d9Qp77HoVBr3S1NCOCQODDZfvdmvgqM2Qm8i5aVi+3RSp11aMSnwR8/5e2o+dYHG3a4a3P95uzoy9cMb8sfWall0A+kgrwwtdqLzB5esmwfnAkWFLUoq0WmG2Kzy8/smWjCb3Zm3Pimnlo0gVEqvl/X41aaa/mV1s9bq4/z+Dl8iyYGvUE X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB618; X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB618;20:3WEEKRJNYfC6O5FPui8bSxXP3LZ0lnVOnAXj38GWkkHdGxIc8XqT21gZM0JgHSprDgaITZE35nVP5u+jJBpjnk/KH+xSNFXFQ4x0GzIWbYdWj9QX4q5V7lvOQ2IlJR74YJSsreOrgJX3zRGOniynC2xHd/y1YZ2R8RhaGImzqs0N03E4yjuMbBMwgCM5T4453BoDJN5tPigZhCiH4ZrUv8+ByinYIUfrlQ11yjUFVsUH4G/Wv4fb7vTowWGksUKLCpU2jMc7LAGnkg7KipPRnyOT2IN74wEnxpPKglOOXMxSFu/jx5NoSdK5wk//tbzqtIQEkAAgVYI7WMWA17b/5YtJTUh5lZQyEC9Ho4cV0Fucsod3lBJnd2giYAQVeYWkQKLO5+gbQE5O+Eq9qS/cb9acquoIN/NMVw1p8L07SbZz5Blj7r8xwGacQgwkMtwy/JfOh/YMEMDBhdn8ziCOUzYsjLESGZew2mkuarIvB8qPdfpm6v7gDf4vuwVl4EljoAldXUZvpdQr9k9c/S8s1spp3l09ok1JRX3AVyFK6KCxoHob2bkMDMuxmTF7xdBNDHIAJoi5y7CMpjEhGSOYsxbe/W1q58R4n8oj48pAAk8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001);SRVR:CO2PR07MB618;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB618; X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB618;4:1AR7vCVJiP+J9Rj98OSMzsXWIYXcUUq7YqpjGn+V9ijyy9EoPg+WodvcTbLaiM5aoBmAy2skLkoigJmKhnOQuuabEqtKQ5FN+IXDnGuYUcT+g59wrzGc+evd1i31OEvjgeZdDA0rQijXgKyi+18eLywo1VdPtaW3KlIsZcKuP5pWIjgD2NKdknttSdvGT8PlSdl+A3XmdO4qnCabruAKJ3c9qu6VtCE+npgPOX8YE/gDWqbJ+JIOSDsB4egB5OHoSvzy5Ek4eN3cEp6vA7p72ABCZUI2xm/18wicwtTvgLImKyttB0lGJm97dEXwC0TW/elgGvsIGvA944/605HX34G71NqdQbtRdME+G8R3MP5beFtKMucoc/thalQcXNoH18n0LdcP6TAtOhsuXl2+w7+C+FUmMvv93RlOwyfPOx8= X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(6009001)(189002)(199003)(586003)(42186005)(76506005)(189998001)(76176999)(33646002)(5001770100001)(97736004)(47776003)(81156007)(66066001)(101416001)(5001960100002)(19580405001)(19580395003)(36756003)(92566002)(5008740100001)(229853001)(15975445007)(50466002)(48376002)(2201001)(50986999)(1096002)(50226001)(107886002)(87976001)(4001430100002)(2950100001)(77096005)(3846002)(105586002)(5004730100002)(5003940100001)(6116002)(40100003)(106356001)(122386002)(2004002)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB618;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO2PR07MB618;23:JyJzf+Hgn29syuwhbiZfB1haS78/gQDpS81Fg4dEwk?= =?us-ascii?Q?kpCJxRe+0E6/k2/GtlH1ZMDf5xoSfgeFsLjRLWjnnKjLxN0i/wnhLlWjcfqV?= =?us-ascii?Q?s8qFvQTnbQt62E3n3o54X8Qyf3LHGV3Lwlksr8vh3xiQRhSUCvQ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LAQhOy2uiiaCWNkK6+7NJXOJj77W/G7lJbT0BFL/eNd0?= =?us-ascii?Q?b5bezRBr1bnT+RK/sI2e/7bTeEjR9q/VkQCGQjewntSbf4vfjT9cI3BfAiZd?= =?us-ascii?Q?kjAjYBlZiyTo4JtLO4b08FGOmxU9HTlVvo5+8aCUEMQKc5+0lqQAuSalcKEc?= =?us-ascii?Q?njUGp3jOuUANk=3D?= X-Microsoft-Exchange-Diagnostics: 1;CO2PR07MB618;5:zNi6cWodjcVN1901DRSv2UOpd+WdXt2auHMBcYlZSfOnOkSXS3oM6CC3t1n5gm0yKd/dmwVBGOkMEmX/8qGcvTDY/6DLsZHrpSBWH9xCK2zVKJitiL4bIxkltECL+sFeZEgHO+8Y3sHIwhOXtKSHEw==;24:JH4REVXH31Woh8lWV1Yw/kU/dDeawlQL6klk6hmxtcunRnK+sb5sat1C1QDfQKL51vNFuSjm4biSWPrYL6M7G+/cK2TT0Of+6Uu+Nmb0pwI= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2015 21:49:00.2717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB618 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5721 Lines: 158 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. Reviewed-by: David Daney Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Yury Norov Signed-off-by: Andrew Pinski --- arch/arm64/include/asm/unistd.h | 6 ++++ arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/entry.S | 12 +++++++- arch/arm64/kernel/sys_ilp32.c | 65 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) 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 e6216ef..230db54 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -13,6 +13,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + +#ifdef CONFIG_ARM64_ILP32 +#define __ARCH_WANT_COMPAT_SYS_PREADV64 +#define __ARCH_WANT_COMPAT_SYS_PWRITEV64 +#endif + #ifdef CONFIG_AARCH32_EL0 #define __ARCH_WANT_COMPAT_SYS_GETDENTS64 #define __ARCH_WANT_SYS_GETHOSTNAME diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 1470332..8787347 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -24,6 +24,7 @@ arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ sys_compat.o entry32.o \ ../../arm/kernel/opcodes.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o +arm64-obj-$(CONFIG_ARM64_ILP32) += sys_ilp32.o arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 52be5c8..bcd921a 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -664,9 +664,13 @@ ENDPROC(ret_from_fork) */ .align 6 el0_svc: - adrp stbl, sys_call_table // load syscall table pointer uxtw scno, w8 // syscall number in w8 mov sc_nr, #__NR_syscalls +#ifdef CONFIG_ARM64_ILP32 + ldr x16, [tsk, #TI_FLAGS] + tbnz x16, #TIF_32BIT_AARCH64, el0_ilp32_svc // We are using ILP32 +#endif + adrp stbl, sys_call_table // load syscall table pointer el0_svc_naked: // compat entry point stp x0, scno, [sp, #S_ORIG_X0] // save the original x0 and syscall number enable_dbg_and_irq @@ -686,6 +690,12 @@ ni_sys: b ret_fast_syscall ENDPROC(el0_svc) +#ifdef CONFIG_ARM64_ILP32 +el0_ilp32_svc: + adrp stbl, sys_call_ilp32_table // load syscall table pointer + b el0_svc_naked +#endif + /* * This is the really slow path. We're going to be doing context * switches, and waiting for our parent to respond. diff --git a/arch/arm64/kernel/sys_ilp32.c b/arch/arm64/kernel/sys_ilp32.c new file mode 100644 index 0000000..8ce79db --- /dev/null +++ b/arch/arm64/kernel/sys_ilp32.c @@ -0,0 +1,65 @@ +/* + * AArch64- ILP32 specific system calls implementation + * + * Copyright (C) 2015 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 . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Using non-compat syscalls where necessary */ +#define compat_sys_fadvise64_64 sys_fadvise64_64 +#define compat_sys_fallocate sys_fallocate +#define compat_sys_ftruncate64 sys_ftruncate +#define compat_sys_lookup_dcookie sys_lookup_dcookie +#define compat_sys_pread64 sys_pread64 +#define compat_sys_pwrite64 sys_pwrite64 +#define compat_sys_readahead sys_readahead +#define compat_sys_shmat sys_shmat +#define compat_sys_sigaltstack sys_sigaltstack +#define compat_sys_sync_file_range sys_sync_file_range +#define compat_sys_truncate64 sys_truncate +#define sys_llseek sys_lseek + +#define compat_sys_open_by_handle_at sys_open_by_handle_at +#define compat_sys_openat sys_openat + +#include + +#undef __SYSCALL +#undef __SC_COMP +#undef __SC_3264 +#undef __SC_COMP_3264 + +#define __SYSCALL_COMPAT +#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.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/