1  /* Syscall definitions, Linux s390 version.
       2     Copyright (C) 2019-2023 Free Software Foundation, Inc.
       3     This file is part of the GNU C Library.
       4  
       5     The GNU C Library is free software; you can redistribute it and/or
       6     modify it under the terms of the GNU Lesser General Public
       7     License as published by the Free Software Foundation; either
       8     version 2.1 of the License, or (at your option) any later version.
       9  
      10     The GNU C Library is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      13     Lesser General Public License for more details.
      14  
      15     You should have received a copy of the GNU Lesser General Public
      16     License along with the GNU C Library; if not, see
      17     <http://www.gnu.org/licenses/>.  */
      18  
      19  #ifndef __ASSEMBLY__
      20  
      21  #undef SYS_ify
      22  #define SYS_ify(syscall_name)	__NR_##syscall_name
      23  
      24  #undef INTERNAL_SYSCALL_NCS
      25  #define INTERNAL_SYSCALL_NCS(no, nr, args...)				      \
      26    ({									      \
      27      DECLARGS_##nr(args)							      \
      28      register unsigned long int _nr __asm__("1") = (unsigned long int)(no);    \
      29      register long int _ret __asm__("2");				      \
      30      __asm__ __volatile__ (						      \
      31  			  "svc    0\n\t"				      \
      32  			  : "=d" (_ret)					      \
      33  			  : "d" (_nr) ASMFMT_##nr			      \
      34  			  : "memory" );					      \
      35      _ret; })
      36  
      37  #undef INTERNAL_SYSCALL
      38  #define INTERNAL_SYSCALL(name, nr, args...)				\
      39    INTERNAL_SYSCALL_NCS(__NR_##name, nr, args)
      40  
      41  #define DECLARGS_0()
      42  #define DECLARGS_1(arg1) \
      43    register unsigned long int gpr2 __asm__ ("2") = (unsigned long int)(arg1);
      44  #define DECLARGS_2(arg1, arg2) \
      45    DECLARGS_1(arg1) \
      46    register unsigned long int gpr3 __asm__ ("3") = (unsigned long int)(arg2);
      47  #define DECLARGS_3(arg1, arg2, arg3) \
      48    DECLARGS_2(arg1, arg2) \
      49    register unsigned long int gpr4 __asm__ ("4") = (unsigned long int)(arg3);
      50  #define DECLARGS_4(arg1, arg2, arg3, arg4) \
      51    DECLARGS_3(arg1, arg2, arg3) \
      52    register unsigned long int gpr5 __asm__ ("5") = (unsigned long int)(arg4);
      53  #define DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
      54    DECLARGS_4(arg1, arg2, arg3, arg4) \
      55    register unsigned long int gpr6 __asm__ ("6") = (unsigned long int)(arg5);
      56  #define DECLARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
      57    DECLARGS_5(arg1, arg2, arg3, arg4, arg5) \
      58    register unsigned long int gpr7 __asm__ ("7") = (unsigned long int)(arg6);
      59  
      60  #define ASMFMT_0
      61  #define ASMFMT_1 , "0" (gpr2)
      62  #define ASMFMT_2 , "0" (gpr2), "d" (gpr3)
      63  #define ASMFMT_3 , "0" (gpr2), "d" (gpr3), "d" (gpr4)
      64  #define ASMFMT_4 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5)
      65  #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6)
      66  #define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7)
      67  
      68  #define VDSO_NAME  "LINUX_2.6.29"
      69  #define VDSO_HASH  123718585
      70  
      71  /* List of system calls which are supported as vsyscalls.  */
      72  #ifdef __s390x__
      73  #define HAVE_CLOCK_GETRES64_VSYSCALL	"__kernel_clock_getres"
      74  #define HAVE_CLOCK_GETTIME64_VSYSCALL	"__kernel_clock_gettime"
      75  #else
      76  #define HAVE_CLOCK_GETRES_VSYSCALL	"__kernel_clock_getres"
      77  #define HAVE_CLOCK_GETTIME_VSYSCALL	"__kernel_clock_gettime"
      78  #endif
      79  #define HAVE_GETTIMEOFDAY_VSYSCALL	"__kernel_gettimeofday"
      80  #define HAVE_GETCPU_VSYSCALL		"__kernel_getcpu"
      81  
      82  #define HAVE_CLONE3_WRAPPER		1
      83  #endif