From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH V3 05/26] csky: System Call Date: Thu, 6 Sep 2018 16:10:49 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Guo Ren Cc: linux-arch , Linux Kernel Mailing List , Thomas Gleixner , Daniel Lezcano , Jason Cooper , c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, Thomas Petazzoni , wbx@uclibc-ng.org, Greentime Hu List-Id: linux-arch.vger.kernel.org On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > +SYSCALL_DEFINE6(mmap2, > + unsigned long, addr, > + unsigned long, len, > + unsigned long, prot, > + unsigned long, flags, > + unsigned long, fd, > + off_t, offset) > +{ > + if (unlikely(offset & (~PAGE_MASK >> 12))) > + return -EINVAL; > + return sys_mmap_pgoff(addr, len, prot, flags, fd, > + offset >> (PAGE_SHIFT - 12)); > +} Please call ksys_mmap_pgoff() instead of sys_mmap_pgoff() here. The prototype in include/asm-generic/syscalls.h uses 'unsigned long' for the last argument as well, not off_t. > +struct mmap_arg_struct { > + unsigned long addr; > + unsigned long len; > + unsigned long prot; > + unsigned long flags; > + unsigned long fd; > + unsigned long offset; > +}; > + > +SYSCALL_DEFINE1(mmap, > + struct mmap_arg_struct *, arg) Something is still wrong here, there should be no way to call sys_mmap(), since it's not in the syscall table. > +/* > + * for abiv1 the 64bits args should be even th, So we need mov the advice forward. > + */ > +SYSCALL_DEFINE4(csky_fadvise64_64, > + int, fd, > + int, advice, > + loff_t, offset, > + loff_t, len) > +{ > + return sys_fadvise64_64(fd, offset, len, advice); > +} And call ksys_fadvise64_64() here. > +#undef __SYSCALL > +#define __SYSCALL(nr, call) [nr] = (call), > + > +#define sys_fadvise64_64 sys_csky_fadvise64_64 > +void * const sys_call_table[__NR_syscalls] __page_aligned_data = { > + [0 ... __NR_syscalls - 1] = sys_ni_syscall, > +#include > +}; This looks good now. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-f193.google.com ([209.85.216.193]:34829 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728929AbeIFSqu (ORCPT ); Thu, 6 Sep 2018 14:46:50 -0400 MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Thu, 6 Sep 2018 16:10:49 +0200 Message-ID: Subject: Re: [PATCH V3 05/26] csky: System Call Content-Type: text/plain; charset="UTF-8" Sender: linux-arch-owner@vger.kernel.org List-ID: To: Guo Ren Cc: linux-arch , Linux Kernel Mailing List , Thomas Gleixner , Daniel Lezcano , Jason Cooper , c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, Thomas Petazzoni , wbx@uclibc-ng.org, Greentime Hu Message-ID: <20180906141049.BldPKziarwxDifBWbnp7n59nEpaYFRIGFzj9OdBHkfI@z> On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > +SYSCALL_DEFINE6(mmap2, > + unsigned long, addr, > + unsigned long, len, > + unsigned long, prot, > + unsigned long, flags, > + unsigned long, fd, > + off_t, offset) > +{ > + if (unlikely(offset & (~PAGE_MASK >> 12))) > + return -EINVAL; > + return sys_mmap_pgoff(addr, len, prot, flags, fd, > + offset >> (PAGE_SHIFT - 12)); > +} Please call ksys_mmap_pgoff() instead of sys_mmap_pgoff() here. The prototype in include/asm-generic/syscalls.h uses 'unsigned long' for the last argument as well, not off_t. > +struct mmap_arg_struct { > + unsigned long addr; > + unsigned long len; > + unsigned long prot; > + unsigned long flags; > + unsigned long fd; > + unsigned long offset; > +}; > + > +SYSCALL_DEFINE1(mmap, > + struct mmap_arg_struct *, arg) Something is still wrong here, there should be no way to call sys_mmap(), since it's not in the syscall table. > +/* > + * for abiv1 the 64bits args should be even th, So we need mov the advice forward. > + */ > +SYSCALL_DEFINE4(csky_fadvise64_64, > + int, fd, > + int, advice, > + loff_t, offset, > + loff_t, len) > +{ > + return sys_fadvise64_64(fd, offset, len, advice); > +} And call ksys_fadvise64_64() here. > +#undef __SYSCALL > +#define __SYSCALL(nr, call) [nr] = (call), > + > +#define sys_fadvise64_64 sys_csky_fadvise64_64 > +void * const sys_call_table[__NR_syscalls] __page_aligned_data = { > + [0 ... __NR_syscalls - 1] = sys_ni_syscall, > +#include > +}; This looks good now. Arnd