Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2103380ybh; Fri, 13 Mar 2020 12:54:50 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsYLGqIPZIU+blo2XhdUkyG11KV5YKQsDa5t5gzSDPoCvZbuxwJzCNJdRt6yXxb5CQzTYNs X-Received: by 2002:a05:6808:907:: with SMTP id w7mr8180748oih.78.1584129290039; Fri, 13 Mar 2020 12:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584129290; cv=none; d=google.com; s=arc-20160816; b=r13ZdK+Xc/iZYE6RCfkP5wUieKd6wAdd7s9komd1VIPyWMi3dRwDUCfLLWpRBqTcMv xo8PtwgAEToAGaV359cLW/vvBJA/LgxfoefILH/ZhL5L5bi9yr+er9Q5sTuS968l3z4v c3lIPEDRK/v8AQBnOQzNRqeGD2qMtbszXSm1JD0kFT7ngdS4CiLmy33oEfIbaONybJQ3 +BzwEA935+sPz+cX3gNDiVI2sjgv4uam82KZxMHtx5fcmGp9i6/tSzEfO5993NZ2YTu4 nO+nEa6YBdHDFzjUiCkU5vAzDRNP/HxMIZCRPEwTWjdbOnem7z7B14kyfM3Is2sK5YFz tMkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t6w2I6q0OvGhRNUeLfz0oSM7U+Ex2GvUMSNIUYfuFaU=; b=TNR/SyJ8St7YToq+7/Tt81RBimnda7dY1vq1N7GMbl2ql5Lgcf2ftXrx90LH+QtoJK /KvX0dZQ5hV2rRvHGUG5oinZKlt+nhxa9s5cY/hRrATGe0MXEu/pxonPCmCJ0QHbM76n ZZnkQxx2pfA9EyDkVJq0pHxFKP4E8Jftxx/b11vnxO4QUon0+flMkuBjIZm6xXPZjAVg EhpwLUkUyWY3RG/qlD3R71fBKaWFg43gA9Oi3d2TmE34mCyUHaLTA/4D3dkSPA1pucj0 21/WE19/jBp5gCqrJifmklxCM9qB/9AIRWJpOFEq+xSG0bKwxlrz9V9XgM8V/NslIQhO KWaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H74k2KZf; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p25si5202373oto.168.2020.03.13.12.54.37; Fri, 13 Mar 2020 12:54:50 -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=@gmail.com header.s=20161025 header.b=H74k2KZf; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727573AbgCMTwy (ORCPT + 99 others); Fri, 13 Mar 2020 15:52:54 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46118 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727447AbgCMTwY (ORCPT ); Fri, 13 Mar 2020 15:52:24 -0400 Received: by mail-qt1-f194.google.com with SMTP id t13so8605560qtn.13 for ; Fri, 13 Mar 2020 12:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t6w2I6q0OvGhRNUeLfz0oSM7U+Ex2GvUMSNIUYfuFaU=; b=H74k2KZfe2EXM2SgaQuOPgCIKd6Rm3J7KTdY6iUqqVUurvVSGrIKVzjYdQXcrrVJcL a7la9TUzyxZJrOZc8eLCRvTAEKaL8x95rPJPhLipvhqamyBT1YHB3ebBSP8WAp+nzuQJ Xh02BKs7FbETyT7/9ZyaHWlEPnyhWSMsu/ZSQyU5fSVh0rurxrnf621d9nkWNhlgDGHf vI3H4rdrxpVAL84R2dQq0gnecKplzHE4eVSiq1ngRcZ8wOJ7MkCmIP60REGa2mpbRN8q jWivH7nV72lqagXA7CRXBJBBhs7r/axXojqwCXlNV3Cy5Tohed3ChFwRKJQjBoDDhYJ1 4etg== 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:mime-version:content-transfer-encoding; bh=t6w2I6q0OvGhRNUeLfz0oSM7U+Ex2GvUMSNIUYfuFaU=; b=nj0RyrHlRpLUS90FmT8cYwvfPns2E17YD6O30bwkkis9heh8Izx0n1g7fvf5vrfpl8 47cT1EP4PUMPkSkRfzGM4uIP0cqapTcEnosoh7Vo9WDcLSlcvYG/EcqphiPhzDV4p0mr 313CQs0K36FpIzJBgebi0bfY79vkCcz9Beks/76vkPv5qaqrU5hUDMTDYEhgxvTcvg7R CrIvcFcqYkopLKqR+g6POM86FQBDdKIfM6Vdo1wmW5hKoXVRvICBoH07sDh0StIPJfPs EGnqk7iR84lSF+pQDNom4v8yQ5Srf9x8bgHO05g15elAAltDiEQpByRPie6jC4dWaxhA H3Zw== X-Gm-Message-State: ANhLgQ2XP9oOeM3q0P3NXChTvzxIFfnCYDeBp5CJdptQmHjc8jzscm16 ysX87gwS55NqAxqPmyX2Lc6BJzk= X-Received: by 2002:ac8:2fc1:: with SMTP id m1mr14041350qta.48.1584129143687; Fri, 13 Mar 2020 12:52:23 -0700 (PDT) Received: from localhost.localdomain (174-084-153-250.res.spectrum.com. [174.84.153.250]) by smtp.gmail.com with ESMTPSA id i28sm31475599qtc.57.2020.03.13.12.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2020 12:52:23 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Andy Lutomirski , Dominik Brodowski , Brian Gerst Subject: [PATCH v4 11/18] x86-64: Add __SYSCALL_COMMON() Date: Fri, 13 Mar 2020 15:51:37 -0400 Message-Id: <20200313195144.164260-12-brgerst@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200313195144.164260-1-brgerst@gmail.com> References: <20200313195144.164260-1-brgerst@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a __SYSCALL_COMMON() macro to the syscall table, which simplifies syscalltbl.sh. Signed-off-by: Brian Gerst --- arch/x86/entry/syscall_64.c | 1 + arch/x86/entry/syscall_x32.c | 3 +++ arch/x86/entry/syscalls/syscalltbl.sh | 22 ++-------------------- arch/x86/um/sys_call_table_64.c | 3 +++ 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c index bce4821a7e14..03645f9014d3 100644 --- a/arch/x86/entry/syscall_64.c +++ b/arch/x86/entry/syscall_64.c @@ -9,6 +9,7 @@ #include #define __SYSCALL_X32(nr, sym) +#define __SYSCALL_COMMON(nr, sym) __SYSCALL_64(nr, sym) #define __SYSCALL_64(nr, sym) extern asmlinkage long sym(const struct pt_regs *); #include diff --git a/arch/x86/entry/syscall_x32.c b/arch/x86/entry/syscall_x32.c index 21e306c5a401..57a151a3a4b4 100644 --- a/arch/x86/entry/syscall_x32.c +++ b/arch/x86/entry/syscall_x32.c @@ -11,10 +11,13 @@ #define __SYSCALL_64(nr, sym) #define __SYSCALL_X32(nr, sym) extern asmlinkage long sym(const struct pt_regs *); +#define __SYSCALL_COMMON(nr, sym) extern asmlinkage long sym(const struct pt_regs *); #include #undef __SYSCALL_X32 +#undef __SYSCALL_COMMON #define __SYSCALL_X32(nr, sym) [nr] = sym, +#define __SYSCALL_COMMON(nr, sym) [nr] = sym, asmlinkage const sys_call_ptr_t x32_sys_call_table[__NR_x32_syscall_max+1] = { /* diff --git a/arch/x86/entry/syscalls/syscalltbl.sh b/arch/x86/entry/syscalls/syscalltbl.sh index b0519ddad8d7..6106ed37b8de 100644 --- a/arch/x86/entry/syscalls/syscalltbl.sh +++ b/arch/x86/entry/syscalls/syscalltbl.sh @@ -25,7 +25,7 @@ emit() { fi # For CONFIG_UML, we need to strip the __x64_sys prefix - if [ "$abi" = "64" -a "${entry}" != "${entry#__x64_sys}" ]; then + if [ "${entry}" != "${entry#__x64_sys}" ]; then umlentry="sys${entry#__x64_sys}" fi @@ -53,24 +53,6 @@ emit() { grep '^[0-9]' "$in" | sort -n | ( while read nr abi name entry compat; do abi=`echo "$abi" | tr '[a-z]' '[A-Z]'` - if [ "$abi" = "COMMON" -o "$abi" = "64" ]; then - emit 64 "$nr" "$entry" "$compat" - if [ "$abi" = "COMMON" ]; then - # COMMON means that this syscall exists in the same form for - # 64-bit and X32. - echo "#ifdef CONFIG_X86_X32_ABI" - emit X32 "$nr" "$entry" "$compat" - echo "#endif" - fi - elif [ "$abi" = "X32" ]; then - echo "#ifdef CONFIG_X86_X32_ABI" - emit X32 "$nr" "$entry" "$compat" - echo "#endif" - elif [ "$abi" = "I386" ]; then - emit "$abi" "$nr" "$entry" "$compat" - else - echo "Unknown abi $abi" >&2 - exit 1 - fi + emit "$abi" "$nr" "$entry" "$compat" done ) > "$out" diff --git a/arch/x86/um/sys_call_table_64.c b/arch/x86/um/sys_call_table_64.c index 7d057ea53d54..2e8544dafbb0 100644 --- a/arch/x86/um/sys_call_table_64.c +++ b/arch/x86/um/sys_call_table_64.c @@ -36,6 +36,9 @@ #define stub_execveat sys_execveat #define stub_rt_sigreturn sys_rt_sigreturn +#define __SYSCALL_X32(nr, sym) +#define __SYSCALL_COMMON(nr, sym) __SYSCALL_64(nr, sym) + #define __SYSCALL_64(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; #include -- 2.24.1