[PATCH] TLS support for s390*.

Martin Schwidefsky schwidefsky@de.ibm.com
Thu Jan 30 16:56:00 GMT 2003


> I have tried so far following change which works just fine.
Yes, that works too. I nevertheless would prefer the following solution:

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	Wed Jan 29 11:17:39 2003
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/clone.S	Thu Jan 30 17:51:52 2003
@@ -42,10 +42,10 @@
 	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
+	l	%r6,24(%r15)		/* restore %r6 */
+	jm	SYSCALL_ERROR_LABEL
 	br	%r14
 error:
 	lhi	%r2,-EINVAL
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	Wed Jan 29 11:17:39 2003
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/clone.S	Thu Jan 30 17:52:12 2003
@@ -43,10 +43,10 @@
 	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
+	lg	%r6,48(%r15)		/* restore %r6 */
+	jgm	SYSCALL_ERROR_LABEL
 	br	%r14
 error:
 	lghi	%r2,-EINVAL

This way %r6 only gets restored in the father process.

blue skies,
  Martin.



More information about the Libc-hacker mailing list