From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:51320 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937442AbeFSOVa (ORCPT ); Tue, 19 Jun 2018 10:21:30 -0400 Date: Tue, 19 Jun 2018 15:21:25 +0100 From: Catalin Marinas To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, marc.zyngier@arm.com, linux@dominikbrodowski.net, hch@infradead.org, james.morse@arm.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, dave.martin@arm.com Subject: Re: [PATCHv3 08/19] arm64: convert raw syscall invocation to C Message-ID: <20180619142125.esqcbknxd2pqeotb@localhost> References: <20180618120310.39527-1-mark.rutland@arm.com> <20180618120310.39527-9-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180618120310.39527-9-mark.rutland@arm.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Jun 18, 2018 at 01:02:59PM +0100, Mark Rutland wrote: > diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c > new file mode 100644 > index 000000000000..b463b962d597 > --- /dev/null > +++ b/arch/arm64/kernel/syscall.c > @@ -0,0 +1,30 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +#include > +#include > + > +long do_ni_syscall(struct pt_regs *regs); > + > +typedef long (*syscall_fn_t)(unsigned long, unsigned long, > + unsigned long, unsigned long, > + unsigned long, unsigned long); > + > +static void __invoke_syscall(struct pt_regs *regs, syscall_fn_t syscall_fn) > +{ > + regs->regs[0] = syscall_fn(regs->regs[0], regs->regs[1], > + regs->regs[2], regs->regs[3], > + regs->regs[4], regs->regs[5]); > +} > + > +asmlinkage void invoke_syscall(struct pt_regs *regs, unsigned int scno, > + unsigned int sc_nr, > + syscall_fn_t syscall_table[]) > +{ > + if (scno < sc_nr) { > + syscall_fn_t syscall_fn; > + syscall_fn = syscall_table[array_index_nospec(scno, sc_nr)]; > + __invoke_syscall(regs, syscall_fn); > + } else { > + regs->regs[0] = do_ni_syscall(regs); > + } > +} While reviewing the subsequent patch, it crossed my mind that we no longer have any callers to do_ni_syscall() outside this file. Can we not more it here and have a similar implementation to __invoke_syscall() for consistency, i.e. set regs->regs[0]. -- Catalin