From patchwork Thu Aug 9 05:05:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Firoz Khan X-Patchwork-Id: 143677 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1633517ljj; Wed, 8 Aug 2018 22:05:52 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzQkbDZPItwQaHJkv4RdC1yl/kO0FsBehaeFdEPIMC4piqhUGSk5aqkGNAkvT7S0uwhXp7I X-Received: by 2002:a65:5581:: with SMTP id j1-v6mr623224pgs.203.1533791152459; Wed, 08 Aug 2018 22:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533791152; cv=none; d=google.com; s=arc-20160816; b=rpt0ca05wZYzCYS6HaBKzY3fM4j6JzkdULtI0FifFanQLprWwcVjEj5eHUZZM0ztMD FJpATwpXNIqbdNsqRnUHDJ+paqp5NWNzGeXyoG+aQ63/qdt7ZdH06tVSqIVqv20LBeIh aN3yRNOXw2TT/TbQ5G2dQuiBLGuTROBkoJWva+BBnWVaNXHxS8X5oZhAamFEYjyTL3Rw SnlBzf37s3CoDtEmE33Wt1bS0Dtw3U4UeqiHnx6oIA0cETbd4x9n0yI2oY30oTb7rkyV 64Y73fVZoGfU3mbUPOfE54584GMHnIfIdvF5k8NtJpT1Qp8bqKIVqqlkdn/hD5IGVfgt gGEA== 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:arc-authentication-results; bh=tUQofjQwIHm19E9WSrQWhbeSjRncQSUoHtDvIO9CX5Y=; b=ICg9POeLAapvO6BNmy71mGOJPZHFexa1eyGIUgVtB7Fbv3NOWWHYeAbcQ0BGOlt0J9 051BNdWWlUOkVMgOnY+MfahTKUs4rvqQNb8ZKQ3t7a9VnDMJF2sw/lI+xDx9DrIkfaLk B+FzEGH51eUOwpnHsED3R6ciYn4TxvD/aP5rTMchWMwNvg9JmPlg1xTdCfF4qmpFXq11 sAmChAJT3dYTg2QvvOiQDPsxMvQBijNjuSbruKopx6K7P+aGTJgqahFsNdvpFbYlDJyZ NWYcXZqyvO3cpvKwoqL3aRD8M4JrC2CJyu+UePwogdJl9TBMzPRakDMmQYCtZA1+PFAs /XBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cIsgpav1; 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 a61-v6si5050967plc.80.2018.08.08.22.05.52; Wed, 08 Aug 2018 22:05:52 -0700 (PDT) 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=cIsgpav1; 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 S1728530AbeHIH2q (ORCPT + 31 others); Thu, 9 Aug 2018 03:28:46 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:44478 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728175AbeHIH2p (ORCPT ); Thu, 9 Aug 2018 03:28:45 -0400 Received: by mail-pl0-f66.google.com with SMTP id ba4-v6so2013916plb.11 for ; Wed, 08 Aug 2018 22:05:48 -0700 (PDT) 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=tUQofjQwIHm19E9WSrQWhbeSjRncQSUoHtDvIO9CX5Y=; b=cIsgpav1KCxMzwQB2u0SVEClPtZgsjfv1yTaDv/aLCI8Ack1U3RgU+YSox2BZL/gwY AGSg/wax9jjqWh+PjU4Pi1ZTysQeSbjWPRgD59Zx58lRNfxlP16rNHvaHutORs9uoGJv /i01e6kf0YzZ1ZeXfSHrSxSKLPj2GmDX1jHAk= 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=tUQofjQwIHm19E9WSrQWhbeSjRncQSUoHtDvIO9CX5Y=; b=fZRyDggt11GwEI4bkiwHP9k1bXAsj/0GcZ45AaoWVIHkmtBBbE7ScnD/ys3yBh/3UT zHt1zo+VL4xXfOZ26BSa1kiu+8zQjHmA2jxcG+hjSW7W+mF2AaSZSQ567UpGcwCdeMqe xrhff54+iGsFnzUlAOE3ZHScOtQ63QMPBUKhxIvnCaBzHxHYQ3tc5j6Ndea7vgK6Gd/c hj/dGiFz8a/3hkkEJInMiPtkxe0FSKOPSP9cNot3Msik5h3NjvsKDH6iYy+cFzAilaLi LkZhnu4nGFe5HXHmSNgAvi89t9IeE50RCaxrLeKBeJmujz5dQlj/HbL28wBAkfQ6NYXr ic1A== X-Gm-Message-State: AOUpUlGPSLNdxsYNeJ4zHkKv+WjNtM1FuKog0Q+qQvynLC2NGKGsSkh7 K5+ExUDT53vpvXhMEeRynL9Wew== X-Received: by 2002:a17:902:6e16:: with SMTP id u22-v6mr595286plk.13.1533791148369; Wed, 08 Aug 2018 22:05:48 -0700 (PDT) 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 c1-v6sm6919419pfi.142.2018.08.08.22.05.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Aug 2018 22:05:47 -0700 (PDT) From: Firoz Khan To: linux-ia64@vger.kernel.org, Tony Luck , Fenghua Yu Cc: y2038@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, arnd@arndb.de, deepa.kernel@gmail.com, marcin.juszkiewicz@linaro.org, firoz.khan@linaro.org Subject: [PATCH 1/5] ia64: Replace NR_syscalls macro from asm/unistd.h Date: Thu, 9 Aug 2018 10:35:11 +0530 Message-Id: <1533791115-3681-2-git-send-email-firoz.khan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533791115-3681-1-git-send-email-firoz.khan@linaro.org> References: <1533791115-3681-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 __NR_syscalls macro holds the number of system call exist in IA64 architecture. This macro is currently the part of asm/unistd.h file. We have to change the value of __NR_syscalls, if we add or delete a system call. One of the patch in this patch series has a script which will generate a uapi header based on syscall.tbl file. The syscall.tbl file contains the number of system call information. So we have two option to update __NR_syscalls value. 1. Update __NR_syscalls in asm/unistd.h manually by counting the no.of system calls. No need to update __NR_syscalls untill we either add a new system call or delete an existing system call. 2. We can keep this feature it above mentioned script, that'll count the number of syscalls and keep it in a generated file. In this case we don't need to explicitly update __NR_syscalls in asm/unistd.h file. The 2nd option will be the recommended one. For that, I moved the NR_syscalls macro from asm/unistd.h to uapi/asm/unistd.h. The macro name also changed form NR_syscalls to __NR_syscalls for making the name convention same across all architecture. While __NR_syscalls isn't strictly part of the uapi, having it as part of the generated header to simplifies the implementation. Signed-off-by: Firoz Khan --- arch/ia64/include/asm/unistd.h | 4 ---- arch/ia64/include/uapi/asm/unistd.h | 2 ++ arch/ia64/kernel/entry.S | 4 ++-- arch/ia64/kernel/fsys.S | 2 +- arch/ia64/kernel/gate.S | 4 ++-- arch/ia64/kernel/ivt.S | 2 +- arch/ia64/kernel/patch.c | 2 +- arch/ia64/mm/init.c | 6 +++--- 8 files changed, 12 insertions(+), 14 deletions(-) -- 1.9.1 diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h index ffb705d..6d1b047 100644 --- a/arch/ia64/include/asm/unistd.h +++ b/arch/ia64/include/asm/unistd.h @@ -10,10 +10,6 @@ #include - - -#define NR_syscalls 326 /* length of syscall table */ - /* * The following defines stop scripts/checksyscalls.sh from complaining about * unimplemented system calls. Glibc provides for each of these by using diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h index 5fe71d4..52c6712 100644 --- a/arch/ia64/include/uapi/asm/unistd.h +++ b/arch/ia64/include/uapi/asm/unistd.h @@ -341,4 +341,6 @@ #define __NR_preadv2 1348 #define __NR_pwritev2 1349 +#define __NR_syscalls 326 /* length of syscall table */ + #endif /* _UAPI_ASM_IA64_UNISTD_H */ diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 68362b3..f40d9fd 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S @@ -501,7 +501,7 @@ GLOBAL_ENTRY(ia64_trace_syscall) adds r15=PT(R15)+16,sp // r15 = &pt_regs.r15 (syscall #) ;; ld8 r15=[r15] - mov r3=NR_syscalls - 1 + mov r3=__NR_syscalls - 1 ;; adds r15=-1024,r15 movl r16=sys_call_table @@ -1757,4 +1757,4 @@ sys_call_table: data8 sys_preadv2 data8 sys_pwritev2 - .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls + .org sys_call_table + 8*__NR_syscalls // guard against failures to increase __NR_syscalls diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index fe742ff..2d33cff 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S @@ -834,4 +834,4 @@ fsyscall_table: // fill in zeros for the remaining entries .zero: - .space fsyscall_table + 8*NR_syscalls - .zero, 0 + .space fsyscall_table + 8*__NR_syscalls - .zero, 0 diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S index 9f235cd..eeafa31 100644 --- a/arch/ia64/kernel/gate.S +++ b/arch/ia64/kernel/gate.S @@ -331,12 +331,12 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc) ;; mov r16=IA64_KR(CURRENT) // M2 (12 cyc) shladd r18=r17,3,r14 // A - mov r19=NR_syscalls-1 // A + mov r19=__NR_syscalls-1 // A ;; lfetch [r18] // M0|1 MOV_FROM_PSR(p0, r29, r8) // M2 (12 cyc) // If r17 is a NaT, p6 will be zero - cmp.geu p6,p7=r19,r17 // A (sysnr > 0 && sysnr < 1024+NR_syscalls)? + cmp.geu p6,p7=r19,r17 // A (sysnr > 0 && sysnr < 1024+__NR_syscalls)? ;; mov r21=ar.fpsr // M2 (12 cyc) tnat.nz p10,p9=r15 // I0 diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S index 1efcbe5..93ddc00 100644 --- a/arch/ia64/kernel/ivt.S +++ b/arch/ia64/kernel/ivt.S @@ -763,7 +763,7 @@ ENTRY(break_fault) adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 adds r15=-1024,r15 // A subtract 1024 from syscall number - mov r3=NR_syscalls - 1 + mov r3=__NR_syscalls - 1 ;; ld1.bias r17=[r16] // M0|1 r17 = current->thread.on_ustack flag ld4 r9=[r9] // M0|1 r9 = current_thread_info()->flags diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c index 7f21a8c..d2e7e31 100644 --- a/arch/ia64/kernel/patch.c +++ b/arch/ia64/kernel/patch.c @@ -172,7 +172,7 @@ static void __init patch_fsyscall_table (unsigned long start, unsigned long end) { - extern unsigned long fsyscall_table[NR_syscalls]; + extern unsigned long fsyscall_table[__NR_syscalls]; s32 *offp = (s32 *) start; u64 ip; diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index 3b85c3e..0096be4 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c @@ -635,9 +635,9 @@ int __init register_active_ranges(u64 start, u64 len, int nid) * (heavy-weight) handler, but mark it by setting bit 0, so the fsyscall entry * code can tell them apart. */ - for (i = 0; i < NR_syscalls; ++i) { - extern unsigned long fsyscall_table[NR_syscalls]; - extern unsigned long sys_call_table[NR_syscalls]; + for (i = 0; i < __NR_syscalls; ++i) { + extern unsigned long fsyscall_table[__NR_syscalls]; + extern unsigned long sys_call_table[__NR_syscalls]; if (!fsyscall_table[i] || nolwsys) fsyscall_table[i] = sys_call_table[i] | 1;