From patchwork Thu Nov 29 08:43:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Firoz Khan X-Patchwork-Id: 152379 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2115291ljp; Thu, 29 Nov 2018 00:44:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/WUhomW5ta2WwHdXmdnvS3PmF6VTBtliQhcCSNKWXoX2qPy3DRZdpSerkP6L6I/XFXW3S4N X-Received: by 2002:a63:504d:: with SMTP id q13mr478324pgl.319.1543481078801; Thu, 29 Nov 2018 00:44:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543481078; cv=none; d=google.com; s=arc-20160816; b=nJ6qn/8TNrr5PZJQ3AqeiuSuTHoiCcDmKN3BGiLsNgXk1UBv5Rbrqzf64WycQ05nrI 5xOs36DdCfnfIqTLv/FyaZLNFpOopA25NRTkGlYGmWvln6CgMyaony2uQ0nJkb5DmNyh e6Isz++K4IxyafeZ33pt8b4Jvh3fAvaBq9hnTGVQJPJQKUbbHkxXEHbafnZb0qG5VKtM L5PkNFCd7/eEu3Ow9P+TPKdfXyN7aR7kUL0WoMpkVqj6clTipNVxzQ8lIi6X9surOlkt F0CfGSxtkmJqB2yTFgfn3jhKb4Yy1IFQ5Vt9xdMo6Ics6IPV2qCKhBWW/TaLIZ+qWeup zN2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Iv3uvd/8GGpDFirXpjc3vER/MPei2h7zauZi6b90c1I=; b=uPPBboTtuCsZFGr5Hh4z6iwRsC6kFIeIpBFP5CwHWV/ZWmU9WkNqoiM/Sa+N9yFwl8 hmk8nUzmjESnD71xUBtfUpbNyjLv3mVfNf5j8T5CK3GSYoAmCwoXUXmQRYf9hz02MxGV laaH+Ys+DLMZBouRRc7kwJ8NztQvVq9CUcXI7hI4ePCXge52fJ86wF9N0NQVEsDbAFKI TeAGt0oTautqntQQ/6AU2CQKt0Vilad1yVYJ9Lo8DhxUJMm2OCGN46dMylwEWbJ7L97M qi5AlbZNACFk6IHIY3U1bTU3W+2g71/5dY1OyE6R5uAwYb55gWb5+Mf9XAusyInssazU k2qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jyZuAv09; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si1203453pgx.178.2018.11.29.00.44.38; Thu, 29 Nov 2018 00:44:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jyZuAv09; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727834AbeK2TtN (ORCPT + 32 others); Thu, 29 Nov 2018 14:49:13 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43398 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727480AbeK2TtM (ORCPT ); Thu, 29 Nov 2018 14:49:12 -0500 Received: by mail-pf1-f196.google.com with SMTP id w73so665408pfk.10 for ; Thu, 29 Nov 2018 00:44:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Iv3uvd/8GGpDFirXpjc3vER/MPei2h7zauZi6b90c1I=; b=jyZuAv09R6wijhBx9CK8mWoJ/ds5+UaXk0SmycM1FGvtME0bSWiyv9p42kQkxvkKdU b/7gCyXULIQGwXHa4VLiiDGJKA/2veIT3gCZMJAdqG/1n64cBAv0r5LeIa5u8nN3XWRh opXksls1QzpBh5GYymLTvsPg3OXeSEAU6Avy4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Iv3uvd/8GGpDFirXpjc3vER/MPei2h7zauZi6b90c1I=; b=q6xkluziU3qIWsuU/7M711fZoSSw8qbAVSyAuveU99YYkO+as701Wbeo6SxWckLy/6 dikjYFPJksAxxlp+AxfehP/ilujHd7sOaPJ/Pw8DBth02atmTLcYqc6N31zXgjDime3r drbL0xoiOYxzNLpYOuAj4P8CHVJ84gEg2IDIwUsVTYEl+RVebA1YPsvlyq0Y1iPuaaMc aJeHWd7rkthfPUqlwfT6AaNKvJQz+On7kMC+iXJ+8sVULo5SQiy9vOGHc61crg0cRpod w4O5FK+XntWPv3P8JDruDsSWq2YaImH2HD013nkgtF7GHjXV8sZXJJJ0RsXG+6Eqf90v USsg== X-Gm-Message-State: AA+aEWbXeDBl1VbfmNAA7E+8EEAyAgAh+vKro2ICe8YBaaXtJzywmSEP hN23QPB0b6fQURcplrNKIQ6twQ== X-Received: by 2002:a63:200e:: with SMTP id g14mr475762pgg.235.1543481075482; Thu, 29 Nov 2018 00:44:35 -0800 (PST) Received: from qualcomm-HP-ZBook-14-G2.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 73-v6sm2322683pfl.142.2018.11.29.00.44.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Nov 2018 00:44:34 -0800 (PST) From: Firoz Khan To: linux-mips@linux-mips.org, Ralf Baechle , Paul Burton , James Hogan , Greg Kroah-Hartman , Philippe Ombredanne , Thomas Gleixner , Kate Stewart Cc: y2038@lists.linaro.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, deepa.kernel@gmail.com, marcin.juszkiewicz@linaro.org, firoz.khan@linaro.org Subject: [PATCH v3 3/6] mips: add +1 to __NR_syscalls in uapi header Date: Thu, 29 Nov 2018 14:13:33 +0530 Message-Id: <1543481016-18500-4-git-send-email-firoz.khan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543481016-18500-1-git-send-email-firoz.khan@linaro.org> References: <1543481016-18500-1-git-send-email-firoz.khan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All other architectures are hold a value for __NR_syscalls will be equal to the last system call number +1. But in mips architecture, __NR_syscalls hold the value equal to total number of system exits in the architecture. One of the patch in this patch series will genarate uapi header files. In order to make the implementation common across all architect- ures, add +1 to __NR_syscalls, which will be equal to the last system call number +1. Signed-off-by: Firoz Khan --- arch/mips/include/uapi/asm/unistd.h | 12 ++++++------ arch/mips/kernel/ftrace.c | 6 +++--- arch/mips/kernel/scall32-o32.S | 4 ++-- arch/mips/kernel/scall64-64.S | 2 +- arch/mips/kernel/scall64-n32.S | 4 ++-- arch/mips/kernel/scall64-o32.S | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) -- 1.9.1 diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index 6914be5..dac1335 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h @@ -392,7 +392,7 @@ #define __NR_io_pgetevents (__NR_Linux + 368) #ifdef __KERNEL__ -#define __NR_syscalls 368 +#define __NR_syscalls 369 #endif /* @@ -403,7 +403,7 @@ #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ #define __NR_O32_Linux 4000 -#define __NR_O32_Linux_syscalls 368 +#define __NR_O32_Linux_syscalls 369 #if _MIPS_SIM == _MIPS_SIM_ABI64 @@ -742,7 +742,7 @@ #define __NR_io_pgetevents (__NR_Linux + 328) #ifdef __KERNEL__ -#define __NR_syscalls 328 +#define __NR_syscalls 329 #endif /* @@ -753,7 +753,7 @@ #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ #define __NR_64_Linux 5000 -#define __NR_64_Linux_syscalls 328 +#define __NR_64_Linux_syscalls 329 #if _MIPS_SIM == _MIPS_SIM_NABI32 @@ -1096,7 +1096,7 @@ #define __NR_io_pgetevents (__NR_Linux + 332) #ifdef __KERNEL__ -#define __NR_syscalls 332 +#define __NR_syscalls 333 #endif /* @@ -1107,6 +1107,6 @@ #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ #define __NR_N32_Linux 6000 -#define __NR_N32_Linux_syscalls 332 +#define __NR_N32_Linux_syscalls 333 #endif /* _UAPI_ASM_UNISTD_H */ diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c index 7f3dfdb..f32caaf 100644 --- a/arch/mips/kernel/ftrace.c +++ b/arch/mips/kernel/ftrace.c @@ -410,13 +410,13 @@ unsigned long __init arch_syscall_addr(int nr) unsigned long __init arch_syscall_addr(int nr) { #ifdef CONFIG_MIPS32_N32 - if (nr >= __NR_N32_Linux && nr <= __NR_N32_Linux + __NR_N32_Linux_syscalls) + if (nr >= __NR_N32_Linux && nr < __NR_N32_Linux + __NR_N32_Linux_syscalls) return (unsigned long)sysn32_call_table[nr - __NR_N32_Linux]; #endif - if (nr >= __NR_64_Linux && nr <= __NR_64_Linux + __NR_64_Linux_syscalls) + if (nr >= __NR_64_Linux && nr < __NR_64_Linux + __NR_64_Linux_syscalls) return (unsigned long)sys_call_table[nr - __NR_64_Linux]; #ifdef CONFIG_MIPS32_O32 - if (nr >= __NR_O32_Linux && nr <= __NR_O32_Linux + __NR_O32_Linux_syscalls) + if (nr >= __NR_O32_Linux && nr < __NR_O32_Linux + __NR_O32_Linux_syscalls) return (unsigned long)sys32_call_table[nr - __NR_O32_Linux]; #endif diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index fea6edb..10f6367 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S @@ -86,7 +86,7 @@ loads_done: bnez t0, syscall_trace_entry # -> yes syscall_common: subu v0, v0, __NR_O32_Linux # check syscall number - sltiu t0, v0, __NR_O32_Linux_syscalls + 1 + sltiu t0, v0, __NR_O32_Linux_syscalls beqz t0, illegal_syscall sll t0, v0, 2 @@ -182,7 +182,7 @@ illegal_syscall: LEAF(sys_syscall) subu t0, a0, __NR_O32_Linux # check syscall number - sltiu v0, t0, __NR_O32_Linux_syscalls + 1 + sltiu v0, t0, __NR_O32_Linux_syscalls beqz t0, einval # do not recurse sll t1, t0, 2 beqz v0, einval diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index 358d959..0b67fed 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S @@ -54,7 +54,7 @@ NESTED(handle_sys64, PT_SIZE, sp) syscall_common: dsubu t2, v0, __NR_64_Linux - sltiu t0, t2, __NR_64_Linux_syscalls + 1 + sltiu t0, t2, __NR_64_Linux_syscalls beqz t0, illegal_syscall dsll t0, t2, 3 # offset into table diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index c65eaac..6468546 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S @@ -33,7 +33,7 @@ NESTED(handle_sysn32, PT_SIZE, sp) #endif dsubu t0, v0, __NR_N32_Linux # check syscall number - sltiu t0, t0, __NR_N32_Linux_syscalls + 1 + sltiu t0, t0, __NR_N32_Linux_syscalls #ifndef CONFIG_MIPS32_O32 ld t1, PT_EPC(sp) # skip syscall on return @@ -87,7 +87,7 @@ n32_syscall_trace_entry: ld a5, PT_R9(sp) dsubu t2, v0, __NR_N32_Linux # check (new) syscall number - sltiu t0, t2, __NR_N32_Linux_syscalls + 1 + sltiu t0, t2, __NR_N32_Linux_syscalls beqz t0, not_n32_scall j syscall_common diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 73913f0..eb53d8ea 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S @@ -34,7 +34,7 @@ NESTED(handle_sys, PT_SIZE, sp) ld t1, PT_EPC(sp) # skip syscall on return dsubu t0, v0, __NR_O32_Linux # check syscall number - sltiu t0, t0, __NR_O32_Linux_syscalls + 1 + sltiu t0, t0, __NR_O32_Linux_syscalls daddiu t1, 4 # skip to next instruction sd t1, PT_EPC(sp) beqz t0, not_o32_scall @@ -144,7 +144,7 @@ trace_a_syscall: ld a7, PT_R11(sp) # For indirect syscalls dsubu t0, v0, __NR_O32_Linux # check (new) syscall number - sltiu t0, t0, __NR_O32_Linux_syscalls + 1 + sltiu t0, t0, __NR_O32_Linux_syscalls beqz t0, not_o32_scall j syscall_common @@ -193,7 +193,7 @@ not_o32_scall: LEAF(sys32_syscall) subu t0, a0, __NR_O32_Linux # check syscall number - sltiu v0, t0, __NR_O32_Linux_syscalls + 1 + sltiu v0, t0, __NR_O32_Linux_syscalls beqz t0, einval # do not recurse dsll t1, t0, 3 beqz v0, einval