vfork.S 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Copyright (C) 2011-2018 Free Software Foundation, Inc.
  2. The GNU C Library is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Lesser General Public
  4. License as published by the Free Software Foundation; either
  5. version 2.1 of the License, or (at your option) any later version.
  6. The GNU C Library is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Lesser General Public License for more details.
  10. You should have received a copy of the GNU Lesser General Public
  11. License along with the GNU C Library. If not, see
  12. <http://www.gnu.org/licenses/>. */
  13. #include <sysdep.h>
  14. #define __ASSEMBLY__ /* for kernel headers */
  15. #include <linux/sched.h>
  16. #include <asm/signal.h>
  17. /* Clone the calling process, but without copying the whole address space.
  18. The calling process is suspended until the new process exits or is
  19. replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
  20. and the process ID of the new process to the old process. */
  21. .text
  22. ENTRY (__vfork)
  23. {
  24. moveli r0, CLONE_VFORK | CLONE_VM | SIGCHLD
  25. move r1, zero
  26. }
  27. {
  28. move r2, zero
  29. move r3, zero
  30. }
  31. moveli TREG_SYSCALL_NR_NAME, __NR_clone
  32. swint1
  33. bnez r1, 0f
  34. jrp lr
  35. PSEUDO_END (__vfork)
  36. libc_hidden_def (vfork)
  37. weak_alias (__vfork, vfork)