All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Alistair Francis <alistair.francis@wdc.com>,
	qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: alistair23@gmail.com, palmer@dabbelt.com
Subject: Re: [PATCH v2 2/2] linux-user/riscv: Update the syscall_nr's to the 5.5 kernel
Date: Tue, 25 Feb 2020 12:50:46 +0100	[thread overview]
Message-ID: <24431d59-b535-97d4-95d7-fe4401e10787@vivier.eu> (raw)
In-Reply-To: <85f33856ee6f32125e5c81a9561346b28b340a3e.1582586444.git.alistair.francis@wdc.com>

Le 25/02/2020 à 00:21, Alistair Francis a écrit :
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  linux-user/riscv/syscall32_nr.h | 314 ++++++++++++++++++++++++++++++++
>  linux-user/riscv/syscall64_nr.h | 303 ++++++++++++++++++++++++++++++
>  linux-user/riscv/syscall_nr.h   | 294 +-----------------------------
>  3 files changed, 619 insertions(+), 292 deletions(-)
>  create mode 100644 linux-user/riscv/syscall32_nr.h
>  create mode 100644 linux-user/riscv/syscall64_nr.h
> 
> diff --git a/linux-user/riscv/syscall32_nr.h b/linux-user/riscv/syscall32_nr.h
> new file mode 100644
> index 0000000000..c3bf5930d0
> --- /dev/null
> +++ b/linux-user/riscv/syscall32_nr.h
> @@ -0,0 +1,314 @@
> +/*
> + * Syscall numbers from asm-generic for RV32.
> + */
> +
> +#ifndef LINUX_USER_RISCV_SYSCALL32_NR_H
> +#define LINUX_USER_RISCV_SYSCALL32_NR_H
> +
> +#define TARGET_NR_io_setup 0
> +#define TARGET_NR_io_destroy 1
> +#define TARGET_NR_io_submit 2
> +#define TARGET_NR_io_cancel 3
> +#define TARGET_NR_setxattr 5
> +#define TARGET_NR_lsetxattr 6
> +#define TARGET_NR_fsetxattr 7
> +#define TARGET_NR_getxattr 8
> +#define TARGET_NR_lgetxattr 9
> +#define TARGET_NR_fgetxattr 10
> +#define TARGET_NR_listxattr 11
> +#define TARGET_NR_llistxattr 12
> +#define TARGET_NR_flistxattr 13
> +#define TARGET_NR_removexattr 14
> +#define TARGET_NR_lremovexattr 15
> +#define TARGET_NR_fremovexattr 16
> +#define TARGET_NR_getcwd 17
> +#define TARGET_NR_lookup_dcookie 18
> +#define TARGET_NR_eventfd2 19
> +#define TARGET_NR_epoll_create1 20
> +#define TARGET_NR_epoll_ctl 21
> +#define TARGET_NR_epoll_pwait 22
> +#define TARGET_NR_dup 23
> +#define TARGET_NR_dup3 24
> +#define TARGET_NR_fcntl64 25
> +#define TARGET_NR_inotify_init1 26
> +#define TARGET_NR_inotify_add_watch 27
> +#define TARGET_NR_inotify_rm_watch 28
> +#define TARGET_NR_ioctl 29
> +#define TARGET_NR_ioprio_set 30
> +#define TARGET_NR_ioprio_get 31
> +#define TARGET_NR_flock 32
> +#define TARGET_NR_mknodat 33
> +#define TARGET_NR_mkdirat 34
> +#define TARGET_NR_unlinkat 35
> +#define TARGET_NR_symlinkat 36
> +#define TARGET_NR_linkat 37
> +#define TARGET_NR_umount2 39
> +#define TARGET_NR_mount 40
> +#define TARGET_NR_pivot_root 41
> +#define TARGET_NR_nfsservctl 42
> +#define TARGET_NR_statfs 43
> +#define TARGET_NR_fstatfs 44
> +#define TARGET_NR_truncate 45
> +#define TARGET_NR_ftruncate 46

For riscv32, it's the 64bit version name to use:

#define TARGET_NR_statfs64 43
#define TARGET_NR_fstatfs64 44
#define TARGET_NR_truncate64 45
#define TARGET_NR_ftruncate64 46
(and below)

because:

include/uapi/asm-generic/unistd.h

#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
...
#else
#define __NR_fcntl64 __NR3264_fcntl
#define __NR_statfs64 __NR3264_statfs
#define __NR_fstatfs64 __NR3264_fstatfs
#define __NR_truncate64 __NR3264_truncate
#define __NR_ftruncate64 __NR3264_ftruncate
#define __NR_llseek __NR3264_lseek
#define __NR_sendfile64 __NR3264_sendfile
#if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64)
#define __NR_fstatat64 __NR3264_fstatat
#define __NR_fstat64 __NR3264_fstat
#endif
...

arch/riscv/include/uapi/asm/unistd.h
#define __ARCH_WANT_NEW_STAT

arch/riscv/include/uapi/asm/bitsperlong.h

#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)

...
> +#define TARGET_NR_getdents64 61
> +#define TARGET_NR__llseek 62

TARGET_NR_llseek

> +#define TARGET_NR_read 63
> +#define TARGET_NR_write 64
> +#define TARGET_NR_readv 65
> +#define TARGET_NR_writev 66
> +#define TARGET_NR_pread64 67
> +#define TARGET_NR_pwrite64 68
> +#define TARGET_NR_preadv 69
> +#define TARGET_NR_pwritev 70
> +#define TARGET_NR_sendfile 71

TARGET_NR_sendfile64

> +#define TARGET_NR_signalfd4 74
> +#define TARGET_NR_vmsplice 75
> +#define TARGET_NR_splice 76
> +#define TARGET_NR_tee 77
> +#define TARGET_NR_readlinkat 78
> +#define TARGET_NR_newfstatat 79
> +#define TARGET_NR_fstat 80

#define TARGET_NR_fstatat64 79
#define TARGET_NR_fstat64 80

...
> +#define TARGET_NR_sethostname 161
> +#define TARGET_NR_setdomainname 162

#define TARGET_NR_getrlimit 163
#define TARGET_NR_setrlimit 164

because

include/uapi/asm-generic/unistd.h

#ifdef __ARCH_WANT_SET_GET_RLIMIT
/* getrlimit and setrlimit are superseded with prlimit64 */
#define __NR_getrlimit 163
__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
#define __NR_setrlimit 164
__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
#endif

arch/riscv/include/uapi/asm/unistd.h

#define __ARCH_WANT_SET_GET_RLIMIT

...
> +#define TARGET_NR_arch_specific_syscall 244
> +#define TARGET_NR_riscv_flush_icache TARGET_NR_arch_specific_syscall + 15

It should be good to keep parenthesis around the declaration:

(TARGET_NR_arch_specific_syscall + 15)

...

I think you can remove following defintion as they should be translated
by the target glibc.

> +/*
> + * Alias some of the older pre 64-bit time_t syscalls to the 64-bit
> + * ones for RV32. This is based on the list used by glibc.
> + */
> +#define TARGET_NR_futex TARGET_NR_futex_time64
> +#define TARGET_NR_rt_sigtimedwait TARGET_NR_rt_sigtimedwait_time64
> +#define TARGET_NR_ppoll TARGET_NR_ppoll_time64
> +#define TARGET_NR_utimensat TARGET_NR_utimensat_time64
> +#define TARGET_NR_pselect6 TARGET_NR_pselect6_time64
> +#define TARGET_NR_recvmmsg TARGET_NR_recvmmsg_time64
> +#define TARGET_NR_semtimedop TARGET_NR_semtimedop_time64
> +#define TARGET_NR_mq_timedreceive TARGET_NR_mq_timedreceive_time64
> +#define TARGET_NR_mq_timedsend TARGET_NR_mq_timedsend_time64
> +#define TARGET_NR_clock_getres TARGET_NR_clock_getres_time64
> +#define TARGET_NR_timerfd_settime TARGET_NR_timerfd_settime64
> +#define TARGET_NR_timerfd_gettime TARGET_NR_timerfd_gettime64
> +#define TARGET_NR_sched_rr_get_interval TARGET_NR_sched_rr_get_interval_time64
> +#define TARGET_NR_clock_adjtime TARGET_NR_clock_adjtime64
> +
> +#endif
> diff --git a/linux-user/riscv/syscall64_nr.h b/linux-user/riscv/syscall64_nr.h
> new file mode 100644
> index 0000000000..b58364b570
> --- /dev/null
> +++ b/linux-user/riscv/syscall64_nr.h

syscall64_nr.h is correct.

Thanks,
Laurent



WARNING: multiple messages have this Message-ID (diff)
From: Laurent Vivier <laurent@vivier.eu>
To: Alistair Francis <alistair.francis@wdc.com>,
	qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: palmer@dabbelt.com, alistair23@gmail.com
Subject: Re: [PATCH v2 2/2] linux-user/riscv: Update the syscall_nr's to the 5.5 kernel
Date: Tue, 25 Feb 2020 12:50:46 +0100	[thread overview]
Message-ID: <24431d59-b535-97d4-95d7-fe4401e10787@vivier.eu> (raw)
In-Reply-To: <85f33856ee6f32125e5c81a9561346b28b340a3e.1582586444.git.alistair.francis@wdc.com>

Le 25/02/2020 à 00:21, Alistair Francis a écrit :
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>  linux-user/riscv/syscall32_nr.h | 314 ++++++++++++++++++++++++++++++++
>  linux-user/riscv/syscall64_nr.h | 303 ++++++++++++++++++++++++++++++
>  linux-user/riscv/syscall_nr.h   | 294 +-----------------------------
>  3 files changed, 619 insertions(+), 292 deletions(-)
>  create mode 100644 linux-user/riscv/syscall32_nr.h
>  create mode 100644 linux-user/riscv/syscall64_nr.h
> 
> diff --git a/linux-user/riscv/syscall32_nr.h b/linux-user/riscv/syscall32_nr.h
> new file mode 100644
> index 0000000000..c3bf5930d0
> --- /dev/null
> +++ b/linux-user/riscv/syscall32_nr.h
> @@ -0,0 +1,314 @@
> +/*
> + * Syscall numbers from asm-generic for RV32.
> + */
> +
> +#ifndef LINUX_USER_RISCV_SYSCALL32_NR_H
> +#define LINUX_USER_RISCV_SYSCALL32_NR_H
> +
> +#define TARGET_NR_io_setup 0
> +#define TARGET_NR_io_destroy 1
> +#define TARGET_NR_io_submit 2
> +#define TARGET_NR_io_cancel 3
> +#define TARGET_NR_setxattr 5
> +#define TARGET_NR_lsetxattr 6
> +#define TARGET_NR_fsetxattr 7
> +#define TARGET_NR_getxattr 8
> +#define TARGET_NR_lgetxattr 9
> +#define TARGET_NR_fgetxattr 10
> +#define TARGET_NR_listxattr 11
> +#define TARGET_NR_llistxattr 12
> +#define TARGET_NR_flistxattr 13
> +#define TARGET_NR_removexattr 14
> +#define TARGET_NR_lremovexattr 15
> +#define TARGET_NR_fremovexattr 16
> +#define TARGET_NR_getcwd 17
> +#define TARGET_NR_lookup_dcookie 18
> +#define TARGET_NR_eventfd2 19
> +#define TARGET_NR_epoll_create1 20
> +#define TARGET_NR_epoll_ctl 21
> +#define TARGET_NR_epoll_pwait 22
> +#define TARGET_NR_dup 23
> +#define TARGET_NR_dup3 24
> +#define TARGET_NR_fcntl64 25
> +#define TARGET_NR_inotify_init1 26
> +#define TARGET_NR_inotify_add_watch 27
> +#define TARGET_NR_inotify_rm_watch 28
> +#define TARGET_NR_ioctl 29
> +#define TARGET_NR_ioprio_set 30
> +#define TARGET_NR_ioprio_get 31
> +#define TARGET_NR_flock 32
> +#define TARGET_NR_mknodat 33
> +#define TARGET_NR_mkdirat 34
> +#define TARGET_NR_unlinkat 35
> +#define TARGET_NR_symlinkat 36
> +#define TARGET_NR_linkat 37
> +#define TARGET_NR_umount2 39
> +#define TARGET_NR_mount 40
> +#define TARGET_NR_pivot_root 41
> +#define TARGET_NR_nfsservctl 42
> +#define TARGET_NR_statfs 43
> +#define TARGET_NR_fstatfs 44
> +#define TARGET_NR_truncate 45
> +#define TARGET_NR_ftruncate 46

For riscv32, it's the 64bit version name to use:

#define TARGET_NR_statfs64 43
#define TARGET_NR_fstatfs64 44
#define TARGET_NR_truncate64 45
#define TARGET_NR_ftruncate64 46
(and below)

because:

include/uapi/asm-generic/unistd.h

#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
...
#else
#define __NR_fcntl64 __NR3264_fcntl
#define __NR_statfs64 __NR3264_statfs
#define __NR_fstatfs64 __NR3264_fstatfs
#define __NR_truncate64 __NR3264_truncate
#define __NR_ftruncate64 __NR3264_ftruncate
#define __NR_llseek __NR3264_lseek
#define __NR_sendfile64 __NR3264_sendfile
#if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64)
#define __NR_fstatat64 __NR3264_fstatat
#define __NR_fstat64 __NR3264_fstat
#endif
...

arch/riscv/include/uapi/asm/unistd.h
#define __ARCH_WANT_NEW_STAT

arch/riscv/include/uapi/asm/bitsperlong.h

#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)

...
> +#define TARGET_NR_getdents64 61
> +#define TARGET_NR__llseek 62

TARGET_NR_llseek

> +#define TARGET_NR_read 63
> +#define TARGET_NR_write 64
> +#define TARGET_NR_readv 65
> +#define TARGET_NR_writev 66
> +#define TARGET_NR_pread64 67
> +#define TARGET_NR_pwrite64 68
> +#define TARGET_NR_preadv 69
> +#define TARGET_NR_pwritev 70
> +#define TARGET_NR_sendfile 71

TARGET_NR_sendfile64

> +#define TARGET_NR_signalfd4 74
> +#define TARGET_NR_vmsplice 75
> +#define TARGET_NR_splice 76
> +#define TARGET_NR_tee 77
> +#define TARGET_NR_readlinkat 78
> +#define TARGET_NR_newfstatat 79
> +#define TARGET_NR_fstat 80

#define TARGET_NR_fstatat64 79
#define TARGET_NR_fstat64 80

...
> +#define TARGET_NR_sethostname 161
> +#define TARGET_NR_setdomainname 162

#define TARGET_NR_getrlimit 163
#define TARGET_NR_setrlimit 164

because

include/uapi/asm-generic/unistd.h

#ifdef __ARCH_WANT_SET_GET_RLIMIT
/* getrlimit and setrlimit are superseded with prlimit64 */
#define __NR_getrlimit 163
__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
#define __NR_setrlimit 164
__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
#endif

arch/riscv/include/uapi/asm/unistd.h

#define __ARCH_WANT_SET_GET_RLIMIT

...
> +#define TARGET_NR_arch_specific_syscall 244
> +#define TARGET_NR_riscv_flush_icache TARGET_NR_arch_specific_syscall + 15

It should be good to keep parenthesis around the declaration:

(TARGET_NR_arch_specific_syscall + 15)

...

I think you can remove following defintion as they should be translated
by the target glibc.

> +/*
> + * Alias some of the older pre 64-bit time_t syscalls to the 64-bit
> + * ones for RV32. This is based on the list used by glibc.
> + */
> +#define TARGET_NR_futex TARGET_NR_futex_time64
> +#define TARGET_NR_rt_sigtimedwait TARGET_NR_rt_sigtimedwait_time64
> +#define TARGET_NR_ppoll TARGET_NR_ppoll_time64
> +#define TARGET_NR_utimensat TARGET_NR_utimensat_time64
> +#define TARGET_NR_pselect6 TARGET_NR_pselect6_time64
> +#define TARGET_NR_recvmmsg TARGET_NR_recvmmsg_time64
> +#define TARGET_NR_semtimedop TARGET_NR_semtimedop_time64
> +#define TARGET_NR_mq_timedreceive TARGET_NR_mq_timedreceive_time64
> +#define TARGET_NR_mq_timedsend TARGET_NR_mq_timedsend_time64
> +#define TARGET_NR_clock_getres TARGET_NR_clock_getres_time64
> +#define TARGET_NR_timerfd_settime TARGET_NR_timerfd_settime64
> +#define TARGET_NR_timerfd_gettime TARGET_NR_timerfd_gettime64
> +#define TARGET_NR_sched_rr_get_interval TARGET_NR_sched_rr_get_interval_time64
> +#define TARGET_NR_clock_adjtime TARGET_NR_clock_adjtime64
> +
> +#endif
> diff --git a/linux-user/riscv/syscall64_nr.h b/linux-user/riscv/syscall64_nr.h
> new file mode 100644
> index 0000000000..b58364b570
> --- /dev/null
> +++ b/linux-user/riscv/syscall64_nr.h

syscall64_nr.h is correct.

Thanks,
Laurent



  reply	other threads:[~2020-02-25 11:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24 23:21 [PATCH v2 0/2] linux-user: generate syscall_nr.sh for RISC-V Alistair Francis
2020-02-24 23:21 ` Alistair Francis
2020-02-24 23:21 ` [PATCH v2 1/2] linux-user: Protect more syscalls Alistair Francis
2020-02-24 23:21   ` Alistair Francis
2020-02-25 11:59   ` Laurent Vivier
2020-02-25 11:59     ` Laurent Vivier
2020-02-26  0:43     ` Alistair Francis
2020-02-26  0:43       ` Alistair Francis
2020-02-24 23:21 ` [PATCH v2 2/2] linux-user/riscv: Update the syscall_nr's to the 5.5 kernel Alistair Francis
2020-02-24 23:21   ` Alistair Francis
2020-02-25 11:50   ` Laurent Vivier [this message]
2020-02-25 11:50     ` Laurent Vivier
2020-02-26 19:32     ` Alistair Francis
2020-02-26 19:32       ` Alistair Francis
2020-02-27  0:02       ` Laurent Vivier
2020-02-27  0:02         ` Laurent Vivier
2020-02-27  0:10         ` Alistair Francis
2020-02-27  0:10           ` Alistair Francis
2020-02-27  0:41           ` Laurent Vivier
2020-02-27  0:41             ` Laurent Vivier
2020-02-25 13:39 ` [PATCH v2 0/2] linux-user: generate syscall_nr.sh for RISC-V Laurent Vivier
2020-02-25 13:39   ` Laurent Vivier
2020-02-26 19:26   ` Alistair Francis
2020-02-26 19:26     ` Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24431d59-b535-97d4-95d7-fe4401e10787@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.