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]

Re: [PATCH] TLS support for s390*.


On Thu, Jan 30, 2003 at 05:29:52PM +0100, Martin Schwidefsky wrote:
> 
> > BTW: It seems to work just fine if stack_addr passed to clone
> > is at least 8*16 bytes below end of particular mmaped area
> > (this is on s390x). My wild guess is that the register save
> > area is needed, which means clone.S should subtract 8*16
> > resp. 8*8 (on s390-32) bytes from stack_pointer before doing
> > the syscall.
> 
> Grr, it's the new clone implementation that stores %r6 on the
> stack. It reloads it after the svc because the father has to
> return with an unmodified %r6. But the restore of %r6 may not
> be done in the child! Four letter words again. Try to move
> the "lg %r6,48(%r15)" in clone.S after the two branches just
> before the "br %r14". That should do the trick.

I have tried so far following change which works just fine.

--- libc/sysdeps/unix/sysv/linux/s390/s390-64/clone.S.jj  2003-01-29 08:37:54.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/s390/s390-64/clone.S     2003-01-30 11:19:29.000000000 -0500
@@ -1,5 +1,5 @@
 /* Wrapper around clone system call.  64 bit S/390 version.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003 Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
    This file is part of the GNU C Library.

@@ -38,6 +38,7 @@ ENTRY(__clone)
        jz      error                   /* no NULL function pointers */
        ltgr    %r2,%r3                 /* check child_stack and move to %r2 */
        jz      error                   /* no NULL stack pointers */
+       aghi    %r2,-160                /* make room on the stack for the save area */
        lgr     %r3,%r4                 /* move flags to %r3 */
        lgr     %r4,%r6                 /* move parent_tid to %r4 */
        lg      %r5,168(%r15)           /* load child_tid from stack */
@@ -55,7 +56,6 @@ error:
 thread_start:
        /* fn is in gpr 1, arg in gpr 0 */
        lgr     %r2,%r0         /* set first parameter to void *arg */
-       aghi    %r15,-160       /* make room on the stack for the save area */
        xc      0(8,%r15),0(%r15)
        basr    %r14,%r1        /* jump to fn */
 #ifdef PIC


	Jakub


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