public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* INTERNAL_SYSCALL and function calls in arguments
@ 2004-04-09  7:15 Thorsten Kukuk
  2004-04-09 13:45 ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Kukuk @ 2004-04-09  7:15 UTC (permalink / raw)
  To: libc-hacker


Hi,

sched_setaffinity has the following code:

INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid(), psize, p)


On AMD64, the INTERNAL_SYSCALL macro does not work if you make a
function call as argument. As result, the sched_getaffinity syscall
will always fail.

Is this a bug in the macro, or is the usage wrong at this place? As
far as I can see, this is the only place where we use such a
construct.

  Thorsten


2004-04-09  Thorsten Kukuk  <kukuk@suse.de>

	* sysdeps/unix/sysv/linux/sched_setaffinity.c: Don't pass function
	call as argument to INTERNAL_SYSCALL.

--- ./sysdeps/unix/sysv/linux/sched_setaffinity.c	29 Mar 2004 21:59:17 -0000	1.4
+++ ./sysdeps/unix/sysv/linux/sched_setaffinity.c	9 Apr 2004 07:11:15 -0000
@@ -40,8 +40,9 @@
 
       size_t psize = 128;
       void *p = alloca (psize);
+      pid_t mypid = getpid ();
 
-      while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid (),
+      while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, mypid,
 				     psize, p),
 	     INTERNAL_SYSCALL_ERROR_P (res, err)
 	     && INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-09  7:15 INTERNAL_SYSCALL and function calls in arguments Thorsten Kukuk
@ 2004-04-09 13:45 ` Andreas Schwab
  2004-04-10  7:34   ` Andreas Jaeger
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Andreas Schwab @ 2004-04-09 13:45 UTC (permalink / raw)
  To: libc-hacker

Thorsten Kukuk <kukuk@suse.de> writes:

> Hi,
>
> sched_setaffinity has the following code:
>
> INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid(), psize, p)

Here is a patch to fix the INTERNAL_SYSCALL macro for x86_64 and ia64.
The definition on arm is probably also affected, but I can't test it.

Andreas.

2004-04-09  Andreas Schwab  <schwab@suse.de>

	* sysdeps/unix/sysv/linux/ia64/sysdep.h (DO_INLINE_SYSCALL): Move
	LOAD_ARGS_##nr up front and add LOAD_REGS_##nr.
	(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
	(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
	variables.
	(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
	(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
	syscall argument registers.

	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (INTERNAL_SYSCALL): Add
	LOAD_REGS_##nr.
	(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
	(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
	variables.
	(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
	(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
	syscall argument registers.

Index: sysdeps/unix/sysv/linux/ia64/sysdep.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/ia64/sysdep.h,v
retrieving revision 1.19
diff -u -p -a -u -p -a -r1.19 sysdeps/unix/sysv/linux/ia64/sysdep.h
--- sysdeps/unix/sysv/linux/ia64/sysdep.h	10 Dec 2003 23:00:21 -0000	1.19
+++ sysdeps/unix/sysv/linux/ia64/sysdep.h	9 Apr 2004 13:38:43 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
    Based on code originally written by David Mosberger-Tang
@@ -200,12 +200,13 @@
 #ifdef IA64_USE_NEW_STUB
 
 #define DO_INLINE_SYSCALL(name, nr, args...)					\
+    LOAD_ARGS_##nr (args)							\
     register long _r8 __asm ("r8");						\
     register long _r10 __asm ("r10");						\
     register long _r15 __asm ("r15") = __NR_##name;				\
     register void *_b7 __asm ("b7") = ((tcbhead_t *) __thread_self)->private;	\
     long _retval;								\
-    LOAD_ARGS_##nr (args);							\
+    LOAD_REGS_##nr								\
     /*										\
      * Don't specify any unwind info here.  We mark ar.pfs as			\
      * clobbered.  This will force the compiler to save ar.pfs			\
@@ -221,11 +222,12 @@
 #else /* !IA64_USE_NEW_STUB */
 
 #define DO_INLINE_SYSCALL(name, nr, args...)			\
+    LOAD_ARGS_##nr (args)					\
     register long _r8 asm ("r8");				\
     register long _r10 asm ("r10");				\
     register long _r15 asm ("r15") = __NR_##name;		\
     long _retval;						\
-    LOAD_ARGS_##nr (args);					\
+    LOAD_REGS_##nr						\
     __asm __volatile (BREAK_INSN (__BREAK_SYSCALL)		\
 		      : "=r" (_r8), "=r" (_r10), "=r" (_r15)	\
 			ASM_OUTARGS_##nr			\
@@ -262,25 +264,44 @@
 #undef INTERNAL_SYSCALL_ERRNO
 #define INTERNAL_SYSCALL_ERRNO(val, err)	(val)
 
-#define LOAD_ARGS_0()   do { } while (0)
-#define LOAD_ARGS_1(out0)				\
-  register long _out0 asm ("out0") = (long) (out0);	\
+#define LOAD_ARGS_0()
+#define LOAD_REGS_0
+#define LOAD_ARGS_1(a1)					\
+  long _arg1 = (long) (a1);				\
   LOAD_ARGS_0 ()
-#define LOAD_ARGS_2(out0, out1)				\
-  register long _out1 asm ("out1") = (long) (out1);	\
-  LOAD_ARGS_1 (out0)
-#define LOAD_ARGS_3(out0, out1, out2)			\
-  register long _out2 asm ("out2") = (long) (out2);	\
-  LOAD_ARGS_2 (out0, out1)
-#define LOAD_ARGS_4(out0, out1, out2, out3)		\
-  register long _out3 asm ("out3") = (long) (out3);	\
-  LOAD_ARGS_3 (out0, out1, out2)
-#define LOAD_ARGS_5(out0, out1, out2, out3, out4)	\
-  register long _out4 asm ("out4") = (long) (out4);	\
-  LOAD_ARGS_4 (out0, out1, out2, out3)
-#define LOAD_ARGS_6(out0, out1, out2, out3, out4, out5)	\
-  register long _out5 asm ("out5") = (long) (out5);	\
-  LOAD_ARGS_5 (out0, out1, out2, out3, out4)
+#define LOAD_REGS_1					\
+  register long _out0 asm ("out0") = _arg1;		\
+  LOAD_REGS_0
+#define LOAD_ARGS_2(a1, a2)				\
+  long _arg2 = (long) (a2);				\
+  LOAD_ARGS_1 (a1)
+#define LOAD_REGS_2					\
+  register long _out1 asm ("out1") = _arg2;		\
+  LOAD_REGS_1
+#define LOAD_ARGS_3(a1, a2, a3)				\
+  long _arg3 = (long) (a3);				\
+  LOAD_ARGS_2 (a1, a2)
+#define LOAD_REGS_3					\
+  register long _out2 asm ("out2") = _arg3;		\
+  LOAD_REGS_2
+#define LOAD_ARGS_4(a1, a2, a3, a4)			\
+  long _arg4 = (long) (a4);				\
+  LOAD_ARGS_3 (a1, a2, a3)
+#define LOAD_REGS_4					\
+  register long _out3 asm ("out3") = _arg4;		\
+  LOAD_REGS_3
+#define LOAD_ARGS_5(a1, a2, a3, a4, a5)			\
+  long _arg5 = (long) (a5);				\
+  LOAD_ARGS_4 (a1, a2, a3, a4)
+#define LOAD_REGS_5					\
+  register long _out4 asm ("out4") = _arg5;		\
+  LOAD_REGS_4
+#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)		\
+  long _arg6 = (long) (a6);	    			\
+  LOAD_ARGS_5 (a1, a2, a3, a4, a5)
+#define LOAD_REGS_6					\
+  register long _out5 asm ("out5") = _arg6;		\
+  LOAD_REGS_5
 
 #define ASM_OUTARGS_0
 #define ASM_OUTARGS_1	ASM_OUTARGS_0, "=r" (_out0)
--- sysdeps/unix/sysv/linux/x86_64/sysdep.h.~1.21.~	2003-08-19 10:50:34.000000000 +0200
+++ sysdeps/unix/sysv/linux/x86_64/sysdep.h	2004-04-09 12:06:15.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,02,03 Free Software Foundation, Inc.
+/* Copyright (C) 2001,02,03,04 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -241,6 +241,7 @@
   ({									      \
     unsigned long resultvar;						      \
     LOAD_ARGS_##nr (args)						      \
+    LOAD_REGS_##nr							      \
     asm volatile (							      \
     "movq %1, %%rax\n\t"						      \
     "syscall\n\t"							      \
@@ -256,36 +257,55 @@
 #define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
 
 #define LOAD_ARGS_0()
+#define LOAD_REGS_0
 #define ASM_ARGS_0
 
 #define LOAD_ARGS_1(a1)					\
-  register long int _a1 asm ("rdi") = (long) (a1);	\
+  long int __arg1 = (long) (a1);			\
   LOAD_ARGS_0 ()
+#define LOAD_REGS_1					\
+  register long int _a1 asm ("rdi") = __arg1;		\
+  LOAD_REGS_0
 #define ASM_ARGS_1	ASM_ARGS_0, "r" (_a1)
 
 #define LOAD_ARGS_2(a1, a2)				\
-  register long int _a2 asm ("rsi") = (long) (a2);	\
+  long int __arg2 = (long) (a2);			\
   LOAD_ARGS_1 (a1)
+#define LOAD_REGS_2					\
+  register long int _a2 asm ("rsi") = __arg2;		\
+  LOAD_REGS_1
 #define ASM_ARGS_2	ASM_ARGS_1, "r" (_a2)
 
 #define LOAD_ARGS_3(a1, a2, a3)				\
-  register long int _a3 asm ("rdx") = (long) (a3);	\
+  long int __arg3 = (long) (a3);			\
   LOAD_ARGS_2 (a1, a2)
+#define LOAD_REGS_3					\
+  register long int _a3 asm ("rdx") = __arg3;		\
+  LOAD_REGS_2
 #define ASM_ARGS_3	ASM_ARGS_2, "r" (_a3)
 
 #define LOAD_ARGS_4(a1, a2, a3, a4)			\
-  register long int _a4 asm ("r10") = (long) (a4);	\
+  long int __arg4 = (long) (a4);			\
   LOAD_ARGS_3 (a1, a2, a3)
+#define LOAD_REGS_4					\
+  register long int _a4 asm ("r10") = __arg4;		\
+  LOAD_REGS_3
 #define ASM_ARGS_4	ASM_ARGS_3, "r" (_a4)
 
 #define LOAD_ARGS_5(a1, a2, a3, a4, a5)			\
-  register long int _a5 asm ("r8") = (long) (a5);	\
+  long int __arg5 = (long) (a5);			\
   LOAD_ARGS_4 (a1, a2, a3, a4)
+#define LOAD_REGS_5					\
+  register long int _a5 asm ("r8") = __arg5;		\
+  LOAD_REGS_4
 #define ASM_ARGS_5	ASM_ARGS_4, "r" (_a5)
 
 #define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)		\
-  register long int _a6 asm ("r9") = (long) (a6);	\
+  long int __arg6 = (long) (a6);			\
   LOAD_ARGS_5 (a1, a2, a3, a4, a5)
+#define LOAD_REGS_6					\
+  register long int _a6 asm ("r9") = __arg6;		\
+  LOAD_REGS_5
 #define ASM_ARGS_6	ASM_ARGS_5, "r" (_a6)
 
 #endif	/* __ASSEMBLER__ */

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-09 13:45 ` Andreas Schwab
@ 2004-04-10  7:34   ` Andreas Jaeger
  2004-04-13 12:54     ` Kaz Kojima
  2004-04-10 16:50   ` Ulrich Drepper
  2004-04-13  0:28   ` Ulrich Drepper
  2 siblings, 1 reply; 10+ messages in thread
From: Andreas Jaeger @ 2004-04-10  7:34 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

[-- Attachment #1: Type: text/plain, Size: 989 bytes --]

Andreas Schwab <schwab@suse.de> writes:

> Thorsten Kukuk <kukuk@suse.de> writes:
>
>> Hi,
>>
>> sched_setaffinity has the following code:
>>
>> INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid(), psize, p)
>
> Here is a patch to fix the INTERNAL_SYSCALL macro for x86_64 and ia64.
> The definition on arm is probably also affected, but I can't test it.

The x86-64 version is ok.  The question is just whether we want to go
this road - or fix sched_getaffinity instead.  I consider it safer to
change INTERNAL_SYSCALL.

But we should check all other platforms, a brief look shows:
- m68k, x86 are ok
- x86-64, ia64: Fixed with your patch
- arm: Might need changes
- s390, s390x: Look also broken.
- ppc,ppc64, sparc, alpha, sh, mips, hppa, : Might need changes


Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-09 13:45 ` Andreas Schwab
  2004-04-10  7:34   ` Andreas Jaeger
@ 2004-04-10 16:50   ` Ulrich Drepper
  2004-04-10 18:38     ` Andreas Schwab
  2004-04-13  0:28   ` Ulrich Drepper
  2 siblings, 1 reply; 10+ messages in thread
From: Ulrich Drepper @ 2004-04-10 16:50 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

Andreas Schwab wrote:

> Here is a patch to fix the INTERNAL_SYSCALL macro for x86_64 and ia64.
> The definition on arm is probably also affected, but I can't test it.

How does the generated code for all cases but the problematic one look
like?  If more code is generated the change is no good.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-10 16:50   ` Ulrich Drepper
@ 2004-04-10 18:38     ` Andreas Schwab
  2004-04-10 19:11       ` Ulrich Drepper
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2004-04-10 18:38 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

Ulrich Drepper <drepper@redhat.com> writes:

> Andreas Schwab wrote:
>
>> Here is a patch to fix the INTERNAL_SYSCALL macro for x86_64 and ia64.
>> The definition on arm is probably also affected, but I can't test it.
>
> How does the generated code for all cases but the problematic one look
> like?  If more code is generated the change is no good.

Since the change only introduces temporary variables which the compiler
would create internally anyway, the compiler is perfectly capable to
optimize them away, and in all cases except sched_setaffinity the
generated code is virtually identical.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-10 18:38     ` Andreas Schwab
@ 2004-04-10 19:11       ` Ulrich Drepper
  2004-04-10 22:04         ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Drepper @ 2004-04-10 19:11 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

Andreas Schwab wrote:

> Since the change only introduces temporary variables which the compiler
> would create internally anyway, the compiler is perfectly capable to
> optimize them away, and in all cases except sched_setaffinity the
> generated code is virtually identical.

I haven't asked about theoretical results.  You must assume I'm stupid
and don't know that this is possible.  What are the concrete results?

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-10 19:11       ` Ulrich Drepper
@ 2004-04-10 22:04         ` Andreas Schwab
  0 siblings, 0 replies; 10+ messages in thread
From: Andreas Schwab @ 2004-04-10 22:04 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: libc-hacker

Ulrich Drepper <drepper@redhat.com> writes:

> Andreas Schwab wrote:
>
>> Since the change only introduces temporary variables which the compiler
>> would create internally anyway, the compiler is perfectly capable to
>> optimize them away, and in all cases except sched_setaffinity the
>> generated code is virtually identical.
>
> I haven't asked about theoretical results.  You must assume I'm stupid
> and don't know that this is possible.  What are the concrete results?

As I wrote above: virtually identical.  In some cases even better.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-09 13:45 ` Andreas Schwab
  2004-04-10  7:34   ` Andreas Jaeger
  2004-04-10 16:50   ` Ulrich Drepper
@ 2004-04-13  0:28   ` Ulrich Drepper
  2 siblings, 0 replies; 10+ messages in thread
From: Ulrich Drepper @ 2004-04-13  0:28 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-hacker

I've applied the patch now.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-10  7:34   ` Andreas Jaeger
@ 2004-04-13 12:54     ` Kaz Kojima
  2004-04-16 19:07       ` Ulrich Drepper
  0 siblings, 1 reply; 10+ messages in thread
From: Kaz Kojima @ 2004-04-13 12:54 UTC (permalink / raw)
  To: libc-hacker

Hi,

Andreas Jaeger <aj@suse.de> wrote:
> But we should check all other platforms, a brief look shows:
[snip]
> - ppc,ppc64, sparc, alpha, sh, mips, hppa, : Might need changes

The appended patch is for SH.

Regards,
	kaz
--
2004-04-13  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* sysdeps/unix/sysv/linux/sh/sysdep.h (SUBSTITUTE_ARGS_1)
	(SUBSTITUTE_ARGS_2, SUBSTITUTE_ARGS_3, SUBSTITUTE_ARGS_4)
	(SUBSTITUTE_ARGS_5, SUBSTITUTE_ARGS_6, SUBSTITUTE_ARGS_7): Load
	argument values into temporary variables.

diff -u3prN ORIG/libc/sysdeps/unix/sysv/linux/sh/sysdep.h LOCAL/libc/sysdeps/unix/sysv/linux/sh/sysdep.h
--- ORIG/libc/sysdeps/unix/sysv/linux/sh/sysdep.h	Sun Nov  9 14:42:35 2003
+++ LOCAL/libc/sysdeps/unix/sysv/linux/sh/sysdep.h	Tue Apr 13 11:20:33 2004
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
+   2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
    Changed by Kaz Kojima, <kkojima@rr.iij4u.or.jp>.
@@ -244,40 +245,68 @@
 
 #define SUBSTITUTE_ARGS_0()
 #define SUBSTITUTE_ARGS_1(arg1)					\
-	register long r4 asm ("%r4") = (long)(arg1)
+	long _arg1 = (long) (arg1);				\
+	register long r4 asm ("%r4") = (long)(_arg1)
 #define SUBSTITUTE_ARGS_2(arg1, arg2)				\
-	register long r4 asm ("%r4") = (long)(arg1);		\
-	register long r5 asm ("%r5") = (long)(arg2)
+	long _arg1 = (long) (arg1);				\
+	long _arg2 = (long) (arg2);				\
+	register long r4 asm ("%r4") = (long)(_arg1);		\
+	register long r5 asm ("%r5") = (long)(_arg2)
 #define SUBSTITUTE_ARGS_3(arg1, arg2, arg3)			\
-	register long r4 asm ("%r4") = (long)(arg1);		\
-	register long r5 asm ("%r5") = (long)(arg2);		\
-	register long r6 asm ("%r6") = (long)(arg3)
+	long _arg1 = (long) (arg1);				\
+	long _arg2 = (long) (arg2);				\
+	long _arg3 = (long) (arg3);				\
+	register long r4 asm ("%r4") = (long)(_arg1);		\
+	register long r5 asm ("%r5") = (long)(_arg2);		\
+	register long r6 asm ("%r6") = (long)(_arg3)
 #define SUBSTITUTE_ARGS_4(arg1, arg2, arg3, arg4)		\
-	register long r4 asm ("%r4") = (long)(arg1);		\
-	register long r5 asm ("%r5") = (long)(arg2);		\
-	register long r6 asm ("%r6") = (long)(arg3);		\
-	register long r7 asm ("%r7") = (long)(arg4)
+	long _arg1 = (long) (arg1);				\
+	long _arg2 = (long) (arg2);				\
+	long _arg3 = (long) (arg3);				\
+	long _arg4 = (long) (arg4);				\
+	register long r4 asm ("%r4") = (long)(_arg1);		\
+	register long r5 asm ("%r5") = (long)(_arg2);		\
+	register long r6 asm ("%r6") = (long)(_arg3);		\
+	register long r7 asm ("%r7") = (long)(_arg4)
 #define SUBSTITUTE_ARGS_5(arg1, arg2, arg3, arg4, arg5) 	\
-	register long r4 asm ("%r4") = (long)(arg1);		\
-	register long r5 asm ("%r5") = (long)(arg2);		\
-	register long r6 asm ("%r6") = (long)(arg3);		\
-	register long r7 asm ("%r7") = (long)(arg4);		\
-	register long r0 asm ("%r0") = (long)(arg5)
+	long _arg1 = (long) (arg1);				\
+	long _arg2 = (long) (arg2);				\
+	long _arg3 = (long) (arg3);				\
+	long _arg4 = (long) (arg4);				\
+	long _arg5 = (long) (arg5);				\
+	register long r4 asm ("%r4") = (long)(_arg1);		\
+	register long r5 asm ("%r5") = (long)(_arg2);		\
+	register long r6 asm ("%r6") = (long)(_arg3);		\
+	register long r7 asm ("%r7") = (long)(_arg4);		\
+	register long r0 asm ("%r0") = (long)(_arg5)
 #define SUBSTITUTE_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6)		\
-	register long r4 asm ("%r4") = (long)(arg1);			\
-	register long r5 asm ("%r5") = (long)(arg2);			\
-	register long r6 asm ("%r6") = (long)(arg3);			\
-	register long r7 asm ("%r7") = (long)(arg4);			\
-	register long r0 asm ("%r0") = (long)(arg5);			\
-	register long r1 asm ("%r1") = (long)(arg6)
+	long _arg1 = (long) (arg1);					\
+	long _arg2 = (long) (arg2);					\
+	long _arg3 = (long) (arg3);					\
+	long _arg4 = (long) (arg4);					\
+	long _arg5 = (long) (arg5);					\
+	long _arg6 = (long) (arg6);					\
+	register long r4 asm ("%r4") = (long)(_arg1);			\
+	register long r5 asm ("%r5") = (long)(_arg2);			\
+	register long r6 asm ("%r6") = (long)(_arg3);			\
+	register long r7 asm ("%r7") = (long)(_arg4);			\
+	register long r0 asm ("%r0") = (long)(_arg5);			\
+	register long r1 asm ("%r1") = (long)(_arg6)
 #define SUBSTITUTE_ARGS_7(arg1, arg2, arg3, arg4, arg5, arg6, arg7)	\
-	register long r4 asm ("%r4") = (long)(arg1);			\
-	register long r5 asm ("%r5") = (long)(arg2);			\
-	register long r6 asm ("%r6") = (long)(arg3);			\
-	register long r7 asm ("%r7") = (long)(arg4);			\
-	register long r0 asm ("%r0") = (long)(arg5)			\
-	register long r1 asm ("%r1") = (long)(arg6);			\
-	register long r2 asm ("%r2") = (long)(arg7)
+	long _arg1 = (long) (arg1);					\
+	long _arg2 = (long) (arg2);					\
+	long _arg3 = (long) (arg3);					\
+	long _arg4 = (long) (arg4);					\
+	long _arg5 = (long) (arg5);					\
+	long _arg6 = (long) (arg6);					\
+	long _arg7 = (long) (arg7);					\
+	register long r4 asm ("%r4") = (long)(_arg1);			\
+	register long r5 asm ("%r5") = (long)(_arg2);			\
+	register long r6 asm ("%r6") = (long)(_arg3);			\
+	register long r7 asm ("%r7") = (long)(_arg4);			\
+	register long r0 asm ("%r0") = (long)(_arg5);			\
+	register long r1 asm ("%r1") = (long)(_arg6);			\
+	register long r2 asm ("%r2") = (long)(_arg7)
 
 #undef INLINE_SYSCALL
 #define INLINE_SYSCALL(name, nr, args...) \

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: INTERNAL_SYSCALL and function calls in arguments
  2004-04-13 12:54     ` Kaz Kojima
@ 2004-04-16 19:07       ` Ulrich Drepper
  0 siblings, 0 replies; 10+ messages in thread
From: Ulrich Drepper @ 2004-04-16 19:07 UTC (permalink / raw)
  To: Kaz Kojima; +Cc: libc-hacker

Kaz Kojima wrote:

> The appended patch is for SH.

Applied.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-04-16 19:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-09  7:15 INTERNAL_SYSCALL and function calls in arguments Thorsten Kukuk
2004-04-09 13:45 ` Andreas Schwab
2004-04-10  7:34   ` Andreas Jaeger
2004-04-13 12:54     ` Kaz Kojima
2004-04-16 19:07       ` Ulrich Drepper
2004-04-10 16:50   ` Ulrich Drepper
2004-04-10 18:38     ` Andreas Schwab
2004-04-10 19:11       ` Ulrich Drepper
2004-04-10 22:04         ` Andreas Schwab
2004-04-13  0:28   ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).