* [PATCH] vfork for s390{,x} and sparc{,64}
@ 2004-03-10 15:09 Jakub Jelinek
2004-03-10 19:05 ` Ulrich Drepper
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-03-10 15:09 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Glibc hackers
Hi!
s390{,x} tested so far with LD_PRELOAD, sparc* untested, but hopefully
correct.
2004-03-10 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/s390/s390-32/pt-vfork.S: Include
tcb-offsets.h.
(__vfork): Negate PID if non-zero and set to INT_MIN if zero
before syscall, set to the old value in the parent afterwards.
* sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: New file.
* sysdeps/unix/sysv/linux/s390/s390-64/pt-vfork.S: Include
tcb-offsets.h.
(__vfork): Negate PID if non-zero and set to INT_MIN if zero
before syscall, set to the old value in the parent afterwards.
* sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: New file.
* sysdeps/s390/tcb-offsets.sym: Add PID.
* sysdeps/unix/sysv/linux/sparc/pt-vfork.S: Remove.
* sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: New file.
* sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: New file.
* sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S: New file.
* sysdeps/sparc/tcb-offsets.sym: Add PID.
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-vfork.S.jj 2003-02-05 10:30:25.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-vfork.S 2004-03-10 15:12:54.620536936 +0100
@@ -22,6 +22,7 @@
#include <bits/errno.h>
#include <kernel-features.h>
#include <bits/wordsize.h>
+#include <tcb-offsets.h>
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
@@ -29,9 +30,18 @@
and the process ID of the new process to the old process. */
ENTRY (__vfork)
+ ear %r4,%a0
+ l %r3,PID(%r4)
+ lcr %r1,%r3
+ st %r1,PID(%r4)
+
/* Do vfork system call. */
svc SYS_ify (vfork)
+ ltr %r2,%r2
+ je 1f
+ st %r3,PID(%r4)
+1:
/* Check for error. */
lhi %r4,-4095
clr %r2,%r4
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S.jj 2004-03-10 14:47:00.934896220 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S 2004-03-10 15:13:00.661454951 +0100
@@ -0,0 +1,57 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+#include <kernel-features.h>
+#include <bits/wordsize.h>
+#include <tcb-offsets.h>
+
+/* Clone the calling process, but without copying the whole address space.
+ The calling process is suspended until the new process exits or is
+ replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
+ and the process ID of the new process to the old process. */
+
+ENTRY (__vfork)
+ ear %r4,%a0
+ lhi %r1,1
+ icm %r3,15,PID(%r4)
+ sll %r1,31
+ je 1f
+ lcr %r1,%r3
+1: st %r1,PID(%r4)
+
+ /* Do vfork system call. */
+ svc SYS_ify (vfork)
+
+ ltr %r2,%r2
+ je 1f
+ st %r3,PID(%r4)
+1:
+ /* Check for error. */
+ lhi %r4,-4095
+ clr %r2,%r4
+ jnl SYSCALL_ERROR_LABEL
+
+ /* Normal return. */
+ br %r14
+PSEUDO_END(__vfork)
+
+weak_alias (__vfork, vfork)
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-vfork.S.jj 2003-02-05 10:31:40.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-vfork.S 2004-03-10 15:13:09.115940677 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
@@ -22,6 +22,7 @@
#include <bits/errno.h>
#include <kernel-features.h>
#include <bits/wordsize.h>
+#include <tcb-offsets.h>
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
@@ -29,9 +30,21 @@
and the process ID of the new process to the old process. */
ENTRY (__vfork)
+
+ ear %r4,%a0
+ sllg %r4,%r4,32
+ ear %r4,%a1
+ l %r3,PID(%r4)
+ lcr %r1,%r3
+ st %r1,PID(%r4)
+
/* Do vfork system call. */
svc SYS_ify (vfork)
+ ltgr %r2,%r2
+ je 1f
+ st %r3,PID(%r4)
+1:
/* Check for error. */
lghi %r4,-4095
clgr %r2,%r4
--- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S.jj 2004-03-10 13:52:41.566358203 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S 2004-03-10 15:13:16.118686429 +0100
@@ -0,0 +1,59 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+#include <kernel-features.h>
+#include <bits/wordsize.h>
+#include <tcb-offsets.h>
+
+/* Clone the calling process, but without copying the whole address space.
+ The calling process is suspended until the new process exits or is
+ replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
+ and the process ID of the new process to the old process. */
+
+ENTRY (__vfork)
+
+ ear %r4,%a0
+ sllg %r4,%r4,32
+ ear %r4,%a1
+ icm %r3,15,PID(%r4)
+ llilh %r1,32768
+ je 1f
+ lcr %r1,%r3
+1: st %r1,PID(%r4)
+
+ /* Do vfork system call. */
+ svc SYS_ify (vfork)
+
+ ltgr %r2,%r2
+ je 1f
+ st %r3,PID(%r4)
+1:
+ /* Check for error. */
+ lghi %r4,-4095
+ clgr %r2,%r4
+ jnl SYSCALL_ERROR_LABEL
+
+ /* Normal return. */
+ br %r14
+PSEUDO_END(__vfork)
+
+weak_alias (__vfork, vfork)
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S.jj 2004-03-10 15:10:23.816548571 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S 2004-03-10 15:25:44.565662865 +0100
@@ -0,0 +1,42 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <tcb-offsets.h>
+
+ .text
+ENTRY(__vfork)
+ ld [%g7 + PID], %o5
+ sub %g0, %o5, %o4
+ st %o4, [%g7 + PID]
+
+ LOADSYSCALL(vfork)
+ ta 0x10
+ bcs,a __syscall_error_handler
+ st %o5, [%g7 + PID]
+ SYSCALL_ERROR_HANDLER
+ sub %o1, 1, %o1
+ andcc %o0, %o1, %o0
+ bne,a 1f
+ st %o5, [%g7 + PID]
+1: retl
+ nop
+
+PSEUDO_END (__vfork)
+weak_alias (__vfork, vfork)
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S.jj 2004-03-10 15:22:46.683503437 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S 2004-03-10 15:25:30.150242109 +0100
@@ -0,0 +1,45 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <tcb-offsets.h>
+
+ .text
+ENTRY(__vfork)
+ ld [%g7 + PID], %o5
+ cmp %o5, 0
+ bne 1f
+ sub %g0, %o5, %o4
+ sethi %hi(0x80000000), %o4
+1: st %o4, [%g7 + PID]
+
+ LOADSYSCALL(vfork)
+ ta 0x10
+ bcs,a __syscall_error_handler
+ st %o5, [%g7 + PID]
+ SYSCALL_ERROR_HANDLER
+ sub %o1, 1, %o1
+ andcc %o0, %o1, %o0
+ bne,a 1f
+ st %o5, [%g7 + PID]
+1: retl
+ nop
+
+PSEUDO_END (__vfork)
+weak_alias (__vfork, vfork)
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S.jj 2004-03-10 15:28:46.271149409 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S 2004-03-10 15:29:19.749158604 +0100
@@ -0,0 +1,42 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <tcb-offsets.h>
+
+ .text
+ENTRY(__vfork)
+ ld [%g7 + PID], %o5
+ sub %g0, %o5, %o4
+ st %o4, [%g7 + PID]
+
+ LOADSYSCALL(vfork)
+ ta 0x6d
+ bcs,a,pn %xcc, __syscall_error_handler
+ st %o5, [%g7 + PID]
+ SYSCALL_ERROR_HANDLER
+ sub %o1, 1, %o1
+ andcc %o0, %o1, %o0
+ bne,a,pt %icc, 1f
+ st %o5, [%g7 + PID]
+1: retl
+ nop
+
+PSEUDO_END (__vfork)
+weak_alias (__vfork, vfork)
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S.jj 2004-03-10 15:22:46.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S 2004-03-10 15:28:38.062618287 +0100
@@ -0,0 +1,45 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#include <tcb-offsets.h>
+
+ .text
+ENTRY(__vfork)
+ ld [%g7 + PID], %o5
+ sethi %hi(0x80000000), %o3
+ cmp %o5, 0
+ sub %g0, %o5, %o4
+ move %icc, %o3, %o4
+ st %o4, [%g7 + PID]
+
+ LOADSYSCALL(vfork)
+ ta 0x6d
+ bcs,a,pn %xcc, __syscall_error_handler
+ st %o5, [%g7 + PID]
+ SYSCALL_ERROR_HANDLER
+ sub %o1, 1, %o1
+ andcc %o0, %o1, %o0
+ bne,a,pt %icc, 1f
+ st %o5, [%g7 + PID]
+1: retl
+ nop
+
+PSEUDO_END (__vfork)
+weak_alias (__vfork, vfork)
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S.jj 2003-08-31 19:36:48.000000000 +0200
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S 2004-03-10 15:23:58.726601816 +0100
@@ -1,28 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <sysdep.h>
-
-PSEUDO (__vfork, vfork, 0)
- sub %o1, 1, %o1
- retl
- and %o0, %o1, %o0
-
-PSEUDO_END (__vfork)
-weak_alias (__vfork, vfork)
--- libc/nptl/sysdeps/s390/tcb-offsets.sym.jj 2003-02-05 10:25:05.000000000 +0100
+++ libc/nptl/sysdeps/s390/tcb-offsets.sym 2004-03-10 14:22:09.788550460 +0100
@@ -2,3 +2,4 @@
#include <tls.h>
MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
+PID offsetof (struct pthread, pid)
--- libc/nptl/sysdeps/sparc/tcb-offsets.sym.jj 2003-08-31 19:27:24.000000000 +0200
+++ libc/nptl/sysdeps/sparc/tcb-offsets.sym 2004-03-10 15:12:09.136683635 +0100
@@ -2,3 +2,4 @@
#include <tls.h>
MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
+PID offsetof (struct pthread, pid)
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] vfork for s390{,x} and sparc{,64}
2004-03-10 15:09 [PATCH] vfork for s390{,x} and sparc{,64} Jakub Jelinek
@ 2004-03-10 19:05 ` Ulrich Drepper
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2004-03-10 19:05 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
Applied.
--
⧠Ulrich Drepper ⧠Red Hat, Inc. ⧠444 Castro St ⧠Mountain View, CA â
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-03-10 19:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-10 15:09 [PATCH] vfork for s390{,x} and sparc{,64} Jakub Jelinek
2004-03-10 19:05 ` 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).