vfork.S 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Copyright (C) 2003 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <sysdep-cancel.h>
  16. #ifdef SHARED
  17. .LLGETPC0:
  18. retl
  19. add %o7, %o0, %o0
  20. #endif
  21. ENTRY(__vfork)
  22. #ifdef SHARED
  23. mov %o7, %o1
  24. sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o0
  25. call .LLGETPC0
  26. add %o0, %lo(_GLOBAL_OFFSET_TABLE_+4), %o0
  27. sethi %hi(__libc_pthread_functions), %o2
  28. mov %o1, %o7
  29. or %o2, %lo(__libc_pthread_functions), %o2
  30. ldx [%o0 + %o2], %o2
  31. ldx [%o2], %o0
  32. #else
  33. .weak pthread_create
  34. sethi %hi(pthread_create), %o0
  35. or %o0, %lo(pthread_create), %o0
  36. #endif
  37. #if defined SHARED && !defined BROKEN_SPARC_WDISP22
  38. cmp %o0, 0
  39. bne HIDDEN_JUMPTARGET(fork)
  40. #else
  41. brnz,pn %o0, 1f
  42. #endif
  43. mov __NR_vfork, %g1
  44. ta 0x6d
  45. bcs,pn %xcc, __syscall_error_handler
  46. nop
  47. sub %o1, 1, %o1
  48. retl
  49. and %o0, %o1, %o0
  50. #if !defined SHARED || defined BROKEN_SPARC_WDISP22
  51. 1: mov %o7, %g1
  52. call HIDDEN_JUMPTARGET(fork)
  53. mov %g1, %o7
  54. #endif
  55. SYSCALL_ERROR_HANDLER
  56. PSEUDO_END (__vfork)
  57. libc_hidden_def (__vfork)
  58. weak_alias (__vfork, vfork)