Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp774384imu; Thu, 3 Jan 2019 06:57:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN4z2HBjq71JPSEO17Ib47oo44dA2JZnkf5kDVPCbTqy/E3VCktxfvtSjx/jMpPwgVLnLBOF X-Received: by 2002:a63:f444:: with SMTP id p4mr17136583pgk.124.1546527445125; Thu, 03 Jan 2019 06:57:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546527445; cv=none; d=google.com; s=arc-20160816; b=yiVQ6u5TulHPlEzWqW9owI0LLgP/9QigUCPJVPjpp71FZYQCOqg2CtFBoVPeviCjWn OzZARhyKMZG15g55ormTpO/LXvxJdSXE6NzmXiVO9bcQkGNIcjlvPL84/oSMhURB7E7U NhgRg25YiBaYG9jVN+eHZmob8fx/O6YeJYD0IfZ5siMXPbFAWzQdReh7iI5IsrHCUvpf sGixftRB/O4WGW74iZ9L7WdMTXeNjUIbmXTIqtR6mmfNDfqFfQchdhnSkdxHvgWJEsqR g2JMAbd7yvpQyt94E2Ol/fUVKnxRXrtSYxjr1vlBcimm0KxvEB7IjQxMLSFHaioe/S1e 7j4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OlErxfKTv2SbJMpGLa1PyKEj4C9pXXCOHh54jBDCiZ4=; b=etF4LgC5zCs0RlYP91QiqwnU0qZYzlgg19YMitElRiR7rRy5ToBFB3I/+kVQcdHuDc syqoj++c4QGq7KwQAnpuYZsYlNgufg6+RoIPqI+iCcSeIkw5bc8fx3MGRz2FZvP9iTzP Gki8GY0Vr21kwyGXbyyvkr7vQeKctuVLeMMwPVhizojuvqlV1fYP+JA2APabS1Eh1Zo+ M/mRA/IS0qjsirZG0VNk2BPh/ffZPb9rumbCGXL74PazeJ7uulz6s0R3wj2ha54VA58D bOxtnp/Pi6HrXvqfDJWyJz/psOkLSLSqvopeLL0wGAVigLmIHWw4/iKYS37WBcIhgD0/ cG4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J4c8QWv3; 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 f1si45277682pgn.502.2019.01.03.06.57.09; Thu, 03 Jan 2019 06:57:25 -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=J4c8QWv3; 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 S1731159AbfACLfK (ORCPT + 99 others); Thu, 3 Jan 2019 06:35:10 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:35764 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729827AbfACLfJ (ORCPT ); Thu, 3 Jan 2019 06:35:09 -0500 Received: by mail-it1-f196.google.com with SMTP id p197so42306127itp.0 for ; Thu, 03 Jan 2019 03:35:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OlErxfKTv2SbJMpGLa1PyKEj4C9pXXCOHh54jBDCiZ4=; b=J4c8QWv3iz4G9g60Hx1iVunp81ed/7dBzqmFS/WbL2mZQuMfTW1f6uTzx2BSKn6/5W n8Lt7DG3dET5TslNSw5ry/CfpDuZacYBVjz+XuC/z7/FUbIaTYPJlk979oc0RJ1QRXcC c5cT9XWxvfbLVRg10qmXGXfOnVkPcsH8CyUFM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OlErxfKTv2SbJMpGLa1PyKEj4C9pXXCOHh54jBDCiZ4=; b=D7Mx4jCrl6MSbksHlRwCcWRMaFTIViaBorV9B0yWHaWAF+w8Fnmbt/wwC9BGtlAeMk FnJ2A4eNgOpySbXdJ9Jl3PPvc/08ybqhMC77npyX2avyef4wfZbXyZb4fPCK46Ut9QGO AxSnEHPoN9XO1W9VP2/I/BROmBVqCXduuxxNXCt/c/SGeLGId59LKt7GDwuL7q6mtSvM U/9ZBhX28/QptlbyyANFc2iztoEl98N9DbGDW8ZJIxAoJ9s4Nf/2xBIIaMXT/eypxn+p Q030ctPtj3/LTsRHmbv58d60qAsXOeWSS1koEqA1DlVKAvJEqWoSwQYGY2FohftrQcVA bbTQ== X-Gm-Message-State: AJcUukcBR3/S+EpziOArRtEIblDmNrSnS5/WkbAdiTiNp3PG4u79ijf2 26UalZz09MD2za2K+VcGV0hZyUdIePCFi88F3oJbaQ== X-Received: by 2002:a24:f14d:: with SMTP id q13mr28307916iti.166.1546515308589; Thu, 03 Jan 2019 03:35:08 -0800 (PST) MIME-Version: 1.0 References: <1546439331-18646-1-git-send-email-firoz.khan@linaro.org> In-Reply-To: <1546439331-18646-1-git-send-email-firoz.khan@linaro.org> From: Firoz Khan Date: Thu, 3 Jan 2019 17:04:57 +0530 Message-ID: Subject: Re: [PATCH] scripts: unify system call table generation scripts To: Paul Burton , Greg Kroah-Hartman , Philippe Ombredanne , Thomas Gleixner , Kate Stewart , Geert Uytterhoeven , Tony Luck , Helge Deller , Satheesh Rajendran , Michal Simek , Michael Ellerman , Richard Henderson , Max Filippov , "David S . Miller" Cc: y2038 Mailman List , Linux Kernel Mailing List , Linux-Arch , Arnd Bergmann , Deepa Dinamani , Marcin Juszkiewicz Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ++ adding more folks I closely worked with :) On Wed, 2 Jan 2019 at 19:59, Firoz Khan wrote: > > System call table generation support is provided for > alpha, ia64, m68k, microblaze, mips, parisc, powerpc, > sh, sparc and xtensa architectures. The implementat- > ions are almost similar across all the above archte- > ctures. > > In order to reduce the source code across all the > above architectures, create common ".sh" files and > keep it in the common directory, script/. > > This will be a generic scripts which can use for all > the above architectures. > > Signed-off-by: Firoz Khan > --- > scripts/syscallhdr.sh | 37 +++++++++++++++++++++++++++++++++++++ > scripts/syscallnr.sh | 32 ++++++++++++++++++++++++++++++++ > scripts/syscalltbl.sh | 37 +++++++++++++++++++++++++++++++++++++ > 3 files changed, 106 insertions(+) > create mode 100644 scripts/syscallhdr.sh > create mode 100644 scripts/syscallnr.sh > create mode 100644 scripts/syscalltbl.sh > > diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh > new file mode 100644 > index 0000000..d03fe3d > --- /dev/null > +++ b/scripts/syscallhdr.sh > @@ -0,0 +1,37 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +in="$1" > +out="$2" > +my_abis=`echo "($3)" | tr ',' '|'` > +prefix="$4" > +offset="$5" > + > +fileguard=_UAPI_ASM_`basename "$out" | sed \ > + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ > + -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( > + printf "#ifndef %s\n" "${fileguard}" > + printf "#define %s\n" "${fileguard}" > + printf "\n" > + > + nxt=0 > + while read nr abi name entry compat ; do > + if [ -z "$offset" ]; then > + printf "#define __NR_%s%s\t%s\n" \ > + "${prefix}" "${name}" "${nr}" > + else > + printf "#define __NR_%s%s\t(%s + %s)\n" \ > + "${prefix}" "${name}" "${offset}" "${nr}" > + fi > + nxt=$((nr+1)) > + done > + > + printf "\n" > + printf "#ifdef __KERNEL__\n" > + printf "#define __NR_syscalls\t%s\n" "${nxt}" > + printf "#endif\n" > + printf "\n" > + printf "#endif /* %s */" "${fileguard}" > + printf "\n" > +) > "$out" > diff --git a/scripts/syscallnr.sh b/scripts/syscallnr.sh > new file mode 100644 > index 0000000..8cf33fa > --- /dev/null > +++ b/scripts/syscallnr.sh > @@ -0,0 +1,32 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +in="$1" > +out="$2" > +my_abis=`echo "($3)" | tr ',' '|'` > +prefix="$4" > +offset="$5" > + > +fileguard=_UAPI_ASM_`basename "$out" | sed \ > + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ > + -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( > + printf "#ifndef %s\n" "${fileguard}" > + printf "#define %s\n" "${fileguard}" > + printf "\n" > + > + nxt=0 > + while read nr abi name entry compat ; do > + nxt=$((nr+1)) > + done > + > + if [ ! -z "$prefix" ]; then > + printf "#define __NR_%s_Linux_syscalls\t%s\n" "${prefix}" "${nxt}" > + if [ ! -z "$offset" ]; then > + printf "#define __NR_%s_Linux\t%s\n" "${prefix}" "${offset}" > + fi > + fi > + printf "\n" > + printf "#endif /* %s */" "${fileguard}" > + printf "\n" > +) > "$out" > diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh > new file mode 100644 > index 0000000..f60f762 > --- /dev/null > +++ b/scripts/syscalltbl.sh > @@ -0,0 +1,37 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +in="$1" > +out="$2" > +my_abis=`echo "($3)" | tr ',' '|'` > +my_abi="$4" > +offset="$5" > + > +emit() { > + t_nxt="$1" > + t_nr="$2" > + t_entry="$3" > + > + while [ $t_nxt -lt $t_nr ]; do > + printf "__SYSCALL(%s,sys_ni_syscall)\n" "${t_nxt}" > + t_nxt=$((t_nxt+1)) > + done > + printf "__SYSCALL(%s,%s)\n" "${t_nxt}" "${t_entry}" > +} > + > +grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( > + nxt=0 > + if [ -z "$offset" ]; then > + offset=0 > + fi > + > + while read nr abi name entry compat ; do > + if [ "$my_abi" = "c32" -o "$my_abi" = "64_o32" ] && > + [ ! -z "$compat" ]; then > + emit $((nxt+offset)) $((nr+offset)) $compat > + else > + emit $((nxt+offset)) $((nr+offset)) $entry > + fi > + nxt=$((nr+1)) > + done > +) > "$out" > -- > 1.9.1 >