vfork.S 564 B

12345678910111213141516171819202122232425262728293031
  1. /* vfork for Linux, LoongArch64 version.
  2. Copyright (C) 2024 uClibc-ng contributors.
  3. Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. /* vfork() is just a special case of clone(). */
  6. #include <sys/asm.h>
  7. #include <sysdep.h>
  8. #define __ASSEMBLY__
  9. #include <linux/sched.h>
  10. #include <asm/signal.h>
  11. .text
  12. LEAF (__vfork)
  13. li.w $a0, (CLONE_VFORK | CLONE_VM | SIGCHLD)
  14. move $a1, $sp
  15. li.w $a7, __NR_clone
  16. syscall 0
  17. blt $a0, $zero, 1f
  18. jr $ra
  19. 1: b __syscall_error
  20. END (__vfork)
  21. libc_hidden_def(vfork)
  22. weak_alias (__vfork, vfork)