From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3075 invoked by alias); 23 Sep 2004 05:08:18 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 3018 invoked from network); 23 Sep 2004 05:08:17 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 23 Sep 2004 05:08:17 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i8N57g3j025063; Thu, 23 Sep 2004 07:07:42 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i8N57gBS025061; Thu, 23 Sep 2004 07:07:42 +0200 Date: Thu, 23 Sep 2004 05:08:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] INTERNAL_SYSCALL_NCS for alpha, s390* and sparc* Message-ID: <20040923050742.GP30497@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-09/txt/msg00082.txt.bz2 Hi! 2004-09-23 Jakub Jelinek * sysdeps/unix/alpha/sysdep.h (inline_syscall[0-6]): Change name argument to numbers from syscall names. (INLINE_SYSCALL1): Pass __NR_##name to inline_syscall##nr. (INTERNAL_SYSCALL_NCS): Renamed from... (INTERNAL_SYSCALL_1): ... this. Use INTERNAL_SYSCALL_NCS. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (INTERNAL_SYSCALL_NCS): Define. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (INTERNAL_SYSCALL_NCS): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (inline_syscall[0-6]): Change name argument to numbers from syscall names. (INLINE_SYSCALL, INTERNAL_SYSCALL): Adjust. (INTERNAL_SYSCALL_NCS): Define. --- libc/sysdeps/unix/alpha/sysdep.h 30 Jun 2004 08:43:23 -0000 1.1.1.14 +++ libc/sysdeps/unix/alpha/sysdep.h 22 Sep 2004 06:27:43 -0000 1.15 @@ -167,7 +167,7 @@ __LABEL(name) \ #define INLINE_SYSCALL1(name, nr, args...) \ ({ \ long _sc_ret, _sc_err; \ - inline_syscall##nr(name, args); \ + inline_syscall##nr(__NR_##name, args); \ if (__builtin_expect (_sc_err, 0)) \ { \ __set_errno (_sc_ret); \ @@ -180,6 +180,9 @@ __LABEL(name) \ INTERNAL_SYSCALL1(name, err_out, nr, args) #define INTERNAL_SYSCALL1(name, err_out, nr, args...) \ + INTERNAL_SYSCALL_NCS(__NR_##name, err_out, nr, args) + +#define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ ({ \ long _sc_ret, _sc_err; \ inline_syscall##nr(name, args); \ @@ -223,7 +226,7 @@ __LABEL(name) \ register long _sc_0 inline_syscall_r0_asm; \ register long _sc_19 __asm__("$19"); \ \ - _sc_0 = __NR_##name; \ + _sc_0 = name; \ __asm__ __volatile__ \ ("callsys # %0 %1 <= %2" \ : inline_syscall_r0_out_constraint (_sc_0), \ @@ -240,7 +243,7 @@ __LABEL(name) \ register long _sc_16 __asm__("$16"); \ register long _sc_19 __asm__("$19"); \ \ - _sc_0 = __NR_##name; \ + _sc_0 = name; \ _sc_16 = (long) (arg1); \ __asm__ __volatile__ \ ("callsys # %0 %1 <= %2 %3" \ @@ -259,7 +262,7 @@ __LABEL(name) \ register long _sc_17 __asm__("$17"); \ register long _sc_19 __asm__("$19"); \ \ - _sc_0 = __NR_##name; \ + _sc_0 = name; \ _sc_16 = (long) (arg1); \ _sc_17 = (long) (arg2); \ __asm__ __volatile__ \ @@ -280,7 +283,7 @@ __LABEL(name) \ register long _sc_18 __asm__("$18"); \ register long _sc_19 __asm__("$19"); \ \ - _sc_0 = __NR_##name; \ + _sc_0 = name; \ _sc_16 = (long) (arg1); \ _sc_17 = (long) (arg2); \ _sc_18 = (long) (arg3); \ @@ -303,7 +306,7 @@ __LABEL(name) \ register long _sc_18 __asm__("$18"); \ register long _sc_19 __asm__("$19"); \ \ - _sc_0 = __NR_##name; \ + _sc_0 = name; \ _sc_16 = (long) (arg1); \ _sc_17 = (long) (arg2); \ _sc_18 = (long) (arg3); \ @@ -328,7 +331,7 @@ __LABEL(name) \ register long _sc_19 __asm__("$19"); \ register long _sc_20 __asm__("$20"); \ \ - _sc_0 = __NR_##name; \ + _sc_0 = name; \ _sc_16 = (long) (arg1); \ _sc_17 = (long) (arg2); \ _sc_18 = (long) (arg3); \ @@ -355,7 +358,7 @@ __LABEL(name) \ register long _sc_20 __asm__("$20"); \ register long _sc_21 __asm__("$21"); \ \ - _sc_0 = __NR_##name; \ + _sc_0 = name; \ _sc_16 = (long) (arg1); \ _sc_17 = (long) (arg2); \ _sc_18 = (long) (arg3); \ --- libc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h 25 Aug 2003 22:47:09 -0000 1.1.1.11 +++ libc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h 22 Sep 2004 06:27:43 -0000 1.10 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,01,02,03 Free Software Foundation, Inc. +/* Copyright (C) 2000,01,02,03,04 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -207,7 +207,20 @@ asm volatile ( \ "svc 0\n\t" \ : "=d" (_ret) \ - : "d" (_nr), "i" (__NR_##name) ASMFMT_##nr \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long _nr asm("1") = (unsigned long)(no); \ + register int _ret asm("2"); \ + asm volatile ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ : "memory" ); \ _ret; }) --- libc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h 25 Mar 2004 23:26:36 -0000 1.1.1.13 +++ libc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h 22 Sep 2004 06:27:43 -0000 1.12 @@ -1,5 +1,5 @@ /* Assembler macros for 64 bit S/390. - Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). This file is part of the GNU C Library. @@ -209,7 +209,20 @@ asm volatile ( \ "svc 0\n\t" \ : "=d" (_ret) \ - : "d" (_nr), "i" (__NR_##name) ASMFMT_##nr \ + : "d" (_nr) ASMFMT_##nr \ + : "memory" ); \ + _ret; }) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(no, err, nr, args...) \ + ({ \ + DECLARGS_##nr(args) \ + register unsigned long _nr asm("1") = (unsigned long)(no); \ + register long _ret asm("2"); \ + asm volatile ( \ + "svc 0\n\t" \ + : "=d" (_ret) \ + : "d" (_nr) ASMFMT_##nr \ : "memory" ); \ _ret; }) --- libc/sysdeps/unix/sysv/linux/sparc/sysdep.h 2 Sep 2003 10:16:01 -0000 1.1.1.6 +++ libc/sysdeps/unix/sysv/linux/sparc/sysdep.h 22 Sep 2004 06:27:43 -0000 1.6 @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2000. @@ -22,13 +22,17 @@ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ - inline_syscall##nr(__SYSCALL_STRING, name, args) + inline_syscall##nr(__SYSCALL_STRING, __NR_##name, args) #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) do { } while (0) #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ + inline_syscall##nr(__INTERNAL_SYSCALL_STRING, __NR_##name, args) + +#undef INTERNAL_SYSCALL_NCS +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ inline_syscall##nr(__INTERNAL_SYSCALL_STRING, name, args) #undef INTERNAL_SYSCALL_ERROR_P @@ -41,7 +45,7 @@ #define inline_syscall0(string,name,dummy...) \ ({ \ register long __o0 __asm__ ("o0"); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1) : \ __SYSCALL_CLOBBERS); \ @@ -51,7 +55,7 @@ #define inline_syscall1(string,name,arg1) \ ({ \ register long __o0 __asm__ ("o0") = (long)(arg1); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0) : \ __SYSCALL_CLOBBERS); \ @@ -62,7 +66,7 @@ ({ \ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1) : \ __SYSCALL_CLOBBERS); \ @@ -74,7 +78,7 @@ register long __o0 __asm__ ("o0") = (long)(arg1); \ register long __o1 __asm__ ("o1") = (long)(arg2); \ register long __o2 __asm__ ("o2") = (long)(arg3); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1), \ "r" (__o2) : \ @@ -88,7 +92,7 @@ register long __o1 __asm__ ("o1") = (long)(arg2); \ register long __o2 __asm__ ("o2") = (long)(arg3); \ register long __o3 __asm__ ("o3") = (long)(arg4); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3) : \ @@ -103,7 +107,7 @@ register long __o2 __asm__ ("o2") = (long)(arg3); \ register long __o3 __asm__ ("o3") = (long)(arg4); \ register long __o4 __asm__ ("o4") = (long)(arg5); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4) : \ @@ -119,7 +123,7 @@ register long __o3 __asm__ ("o3") = (long)(arg4); \ register long __o4 __asm__ ("o4") = (long)(arg5); \ register long __o5 __asm__ ("o5") = (long)(arg6); \ - register long __g1 __asm__ ("g1") = __NR_##name; \ + register long __g1 __asm__ ("g1") = name; \ __asm __volatile (string : "=r" (__g1), "=r" (__o0) : \ "0" (__g1), "1" (__o0), "r" (__o1), \ "r" (__o2), "r" (__o3), "r" (__o4), \ Jakub