This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] s390* clone parameters.


Hi,
> And I still would like the clone() interface to change as I've already
> told you.
This patch will change the clone interface to make the order of parameters
consistent with ia32.

blue skies,
  Martin.

2003-01-28  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Reorder additional
	clone parameters to match the order used on ia32.
	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise.

diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-32/clone.S libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/clone.S	Tue Jan 28 13:04:49 2003
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/clone.S	Tue Jan 28 13:37:01 2003
@@ -25,29 +25,32 @@
 #include <bits/errno.h>
 
 /* int __clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
-               void *tls, pid_t *parent_tid, pid_t *child_tid);  */
+               pid_t *parent_tid, void *tls, pid_t *child_tid);  */
 /* sys_clone  (void *child_stack, unsigned long flags,
                pid_t *parent_tid, pid_t *child_tid, void *tls);  */
 
 	.text
 ENTRY(__clone)
-	/* Sanity check arguments & move registers */
+	st	%r6,24(%r15)		/* store %r6 to save area */
 	lr	%r0,%r5			/* move *arg out of the way */
-	ltr     %r1,%r2			/* no NULL function pointers */
-	lhi     %r2,-EINVAL
-	jz      SYSCALL_ERROR_LABEL
-	ltr     %r3,%r3			/* no NULL stack pointers */
-	jz      SYSCALL_ERROR_LABEL
-	/* set up registers, then call SVC */
-	lr      %r2,%r3
-	lr      %r3,%r4
-	lm	%r4,%r5,96(%r15)
-	svc     SYS_ify(clone)
-	ltr     %r2,%r2			/* check return code */
-	jm      SYSCALL_ERROR_LABEL
-	jz      thread_start
-	br      %r14
-
+	ltr     %r1,%r2			/* check fn and move to %r1 */
+	jz      error			/* no NULL function pointers */
+	ltr     %r2,%r3			/* check child_stack and move to %r2 */
+	jz	error			/* no NULL stack pointers */
+	lr	%r3,%r4			/* move flags to %r3 */
+	lr	%r4,%r6			/* move parent_tid to %r4 */
+	l	%r5,100(%r15)		/* load child_tid from stack */
+	l	%r6,96(%r15)		/* load tls from stack */
+	svc	SYS_ify(clone)
+	l	%r6,24(%r15)		/* restore %r6 */
+	ltr	%r2,%r2			/* check return code */
+	jm	SYSCALL_ERROR_LABEL
+	jz	thread_start
+	br	%r14
+error:
+	lhi	%r2,-EINVAL
+	j	SYSCALL_ERROR_LABEL
+	
 thread_start:
 	/* fn is in gpr 1, arg in gpr 0 */
 	lr      %r2,%r0         /* set first parameter to void *arg */
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-64/clone.S libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/clone.S	Tue Jan 28 13:04:49 2003
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/clone.S	Tue Jan 28 13:41:00 2003
@@ -26,28 +26,31 @@
 #include <bits/errno.h>
 
 /* int __clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
-               void *tls, pid_t *parent_tid, pid_t *child_tid);  */
+               pid_t *parent_tid, void *tls, pid_t *child_tid);  */
 /* sys_clone  (void *child_stack, unsigned long flags,
                pid_t *parent_tid, pid_t *child_tid, void *tls);  */
 
 	.text
 ENTRY(__clone)
-	/* Sanity check arguments & move registers */
+	stg	%r6,48(%r15)		/* store %r6 to save area */
 	lgr	%r0,%r5			/* move *arg out of the way */
-	ltgr	%r1,%r2			/* no NULL function pointers */
-	lghi	%r2,-EINVAL
-	jgz	SYSCALL_ERROR_LABEL
-	ltgr	%r3,%r3			/* no NULL stack pointers */
-	jgz	SYSCALL_ERROR_LABEL
-	/* set up registers, then call SVC */
-	lgr	%r2,%r3
-	lgr	%r3,%r4
-	lmg	%r4,%r5,160(%r15)
+	ltgr    %r1,%r2			/* check fn and move to %r1 */
+	jz      error			/* no NULL function pointers */
+	ltgr    %r2,%r3			/* check child_stack and move to %r2 */
+	jz	error			/* no NULL stack pointers */
+	lgr	%r3,%r4			/* move flags to %r3 */
+	lgr	%r4,%r6			/* move parent_tid to %r4 */
+	lg	%r5,168(%r15)		/* load child_tid from stack */
+	l	%r6,160(%r15)		/* load tls from stack */
 	svc	SYS_ify(clone)
+	lg	%r6,48(%r15)		/* restore %r6 */
 	ltgr	%r2,%r2			/* check return code */
 	jgm	SYSCALL_ERROR_LABEL
 	jz	thread_start
 	br	%r14
+error:
+	lghi	%r2,-EINVAL
+	jg	SYSCALL_ERROR_LABEL
 
 thread_start:
 	/* fn is in gpr 1, arg in gpr 0 */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]