Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5896858imu; Sun, 2 Dec 2018 05:58:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/VNdg2JYLuE+u11PjluPAOiaKXUgJW3vAaE5D9+xrCibd2BvG9jff7+IAk57yVdPXkE3Pt/ X-Received: by 2002:a62:de06:: with SMTP id h6mr12732213pfg.158.1543759090715; Sun, 02 Dec 2018 05:58:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543759090; cv=none; d=google.com; s=arc-20160816; b=u7NI0hfcJHgz7MtolGLi5MwxOAcQ74EI/sNMw/CYu08eJqDdpQKZJlSTYpyalOTjjo gX5aqL0BxgvyprRdJ5UPNDlJTxzsKfuqXIGEXnrqZlpqyNX5c1PnQg0WBtqTcbkaumYO 8MPA3Rvacw4HVuRmNyFO5h0Hj6NsAjiRIwMSU5gDRVxwqQPh8Qk7XBMMC2h0b9vpzuk6 qszDbUwF1DtE7b4ryNYnUzmidqi48lWyzmXSiACoVMJWKhxbKiAr8WGY4GCIjxwudCG8 1rybn8bZkbRmuhWuALcTfuNjIxNYegI8F2/WT2npPT4Wqk3cIe2dS5h7kR8DXrfjgSzv Ax0Q== 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; bh=094R2mMO6bI0SBvNrb//X9DS1G06Z5RxhccskItvK7A=; b=c5NG/58KMmoSkhvjxdCoet+p1fjbfSpK7Egu3KgFzxAy9Gvz0SAxl7GtOsHJ+WF/T6 UjqtJ/7X9yITaA1AwCXZAu4d3UOAmLLy+2NgcCgtWQ/GqcRYDro1zBQO6KHiMezhuF43 Ff46p7/zZKtD1yDhaLeghV3MNEE36WIdb/HnZWS03V0EabFQND7C0/+0HsFA1xf8cJV4 Z1oMK2Zbyiepw7Ck52lo3oCMgxFlG++1S4Q+ymk1yMSbrM8o2r5qiqTCbhLerf715LV7 HwOUEZeH4ejAnVkcF6WuUnJeKKdThzmTQQ9llPVPKwCqjdtTte+F/jn4vZJngCcNJE8y zjvg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si10849987plo.363.2018.12.02.05.57.53; Sun, 02 Dec 2018 05:58:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725873AbeLBN5H (ORCPT + 99 others); Sun, 2 Dec 2018 08:57:07 -0500 Received: from mail-vs1-f66.google.com ([209.85.217.66]:38828 "EHLO mail-vs1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725857AbeLBN5H (ORCPT ); Sun, 2 Dec 2018 08:57:07 -0500 Received: by mail-vs1-f66.google.com with SMTP id x64so5983916vsa.5; Sun, 02 Dec 2018 05:57:05 -0800 (PST) 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=094R2mMO6bI0SBvNrb//X9DS1G06Z5RxhccskItvK7A=; b=otMPIZ0CqbG75NmphGAtwKq45J9wgWOMCaqzQrN+G4u6ahaeWoLYwnHPRxGSBHSVs0 09u3PDXHPNyWvMGmtccCSg1UJVFMU4k/d5cf1HjpYmaSJr3GhQGALyU2O34IyrSgQrIH vt28/vwgCi9QQZ2fLVE8HpCXg2EiyBJcSNID+EPc2FrK5vk8rXvC+rhwzlKe0z5Gs4Ba R6XDxcU8lrmz15pu3mdsjoG9rJgIveGtOopFeXW92nCuleY0gZ5CNumyunC5FildTKI5 8mjTWdKfZ1nPY62tVFb6bWaytQFiUqXMD0l1kzkbzSpjNeuXkRH0U3o11nUjixV26Ahf BEpw== X-Gm-Message-State: AA+aEWZ97OnQzfOUkzzDo3NeJYPMcoAEzyiTZs8l8J9GwPFNMAbvgWE9 9l2BMO8h40BaAmzWVl64AaP3V3BkKtvtuEqO3hc= X-Received: by 2002:a67:d119:: with SMTP id u25mr4999217vsi.63.1543759024424; Sun, 02 Dec 2018 05:57:04 -0800 (PST) MIME-Version: 1.0 References: <1542088829-19790-1-git-send-email-firoz.khan@linaro.org> <1542088829-19790-3-git-send-email-firoz.khan@linaro.org> In-Reply-To: <1542088829-19790-3-git-send-email-firoz.khan@linaro.org> From: Geert Uytterhoeven Date: Sun, 2 Dec 2018 14:56:52 +0100 Message-ID: Subject: Re: [PATCH v5 2/3] m68k: add system call table generation support To: firoz.khan@linaro.org Cc: linux-m68k , Greg KH , Philippe Ombredanne , Thomas Gleixner , Kate Stewart , y2038 Mailman List , Linux Kernel Mailing List , Linux-Arch , Arnd Bergmann , Deepa Dinamani , marcin.juszkiewicz@linaro.org 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 Hi Firoz, On Tue, Nov 13, 2018 at 7:01 AM Firoz Khan wrote: > The system call tables are in different format in all > architecture and it will be difficult to manually add, > modify or delete the syscall table entries in the res- > pective files. To make it easy by keeping a script and > which will generate the uapi header and syscall table > file. This change will also help to unify the implemen- > tation across all architectures. > > The system call table generation script is added in > kernel/syscalls directory which contain the scripts to > generate both uapi header file and system call table > files. The syscall.tbl will be input for the scripts. > > syscall.tbl contains the list of available system calls > along with system call number and corresponding entry > point. Add a new system call in this architecture will > be possible by adding new entry in the syscall.tbl file. > > Adding a new table entry consisting of: > - System call number. > - ABI. > - System call name. > - Entry point name. > > syscallhdr.sh and syscalltbl.sh will generate uapi header > unistd_32.h and syscall_table.h files respectively. Both > .sh files will parse the content syscall.tbl to generate > the header and table files. unistd_32.h will be included > by uapi/asm/unistd.h and syscall_table.h is included by > kernel/syscall_table.S - the real system call table. > > ARM, s390 and x86 architecuture does have similar support. > I leverage their implementation to come up with a generic > solution. > > Signed-off-by: Firoz Khan Thanks for your patch! > --- /dev/null > +++ b/arch/m68k/kernel/syscalls/syscallhdr.sh > @@ -0,0 +1,36 @@ > +#!/bin/sh > +# SPDX-License-Identifier: GPL-2.0 > + > +in="$1" > +out="$2" > +my_abis=`echo "($3)" | tr ',' '|'` > +prefix="$4" > +offset="$5" > + > +fileguard=_UAPI_ASM_M68K_`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 ; 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}" The above line is lacking a "\n", causing: ./arch/m68k/include/generated/uapi/asm/unistd_32.h:370:42: warning: no newline at end of file Changing it to: printf "#endif /* %s */\n" "${fileguard}" fixes this. Interestingly, this issue seems to be present on powerpc, parisc, sparc, sh, xtensa (and probably more, I gave up looking), too? Apart from that, it seems to work fine on m68k. > +) > "$out" Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds