_vfork.S 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Port of uClibc for TMS320C6000 DSP architecture
  3. * Copyright (C) 2004, 2011 Texas Instruments Incorporated
  4. * Author of TMS320C6000 port: Aurelien Jacquiot
  5. *
  6. * Use clone syscall: Mark Salter <msalter@redhat.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU Library General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  16. * for more details.
  17. *
  18. * You should have received a copy of the GNU Library General Public License
  19. * along with this program; see the file COPYING.LIB. If not, see
  20. * <http://www.gnu.org/licenses/>.
  21. */
  22. #define __ASSEMBLY__
  23. #include <asm/errno.h>
  24. #include <sys/syscall.h>
  25. #include <linux/sched.h>
  26. #include <asm/signal.h>
  27. #define CLONE_FLAGS (CLONE_VFORK | CLONE_VM | SIGCHLD)
  28. .global __vfork
  29. __vfork:
  30. MVK .S2 SYS_clone,B0
  31. || MVKL .S1 CLONE_FLAGS,A4
  32. MVKH .S1 CLONE_FLAGS,A4
  33. || MVK .L2 0,B4
  34. #ifndef _TMS320C6400_PLUS
  35. MVC .S2 CSR,B2
  36. CLR .S2 B2,0,0,B1
  37. MVC .S2 B1,CSR
  38. MVC .S2 IFR,B1
  39. SET .S2 B1,6,6,B1
  40. MVC .S2 B1,ISR
  41. MVC .S2 B2,CSR
  42. NOP
  43. #else
  44. SWE
  45. #endif
  46. MVK .S2 -4096,B4
  47. CMPGTU .L2X B4,A4,B2 ; check error
  48. [B2] BNOP .S2 B3,5
  49. NEG .S1 A4,A4
  50. STW .D2T1 A4,*B15--[2]
  51. STW .D2T2 B3,*+B15[1]
  52. CALLP .S2 __errno_location,B3
  53. LDW .D2T2 *+B15[1],B3
  54. LDW .D2T1 *++B15[2],A5
  55. NOP 3
  56. BNOP .S2 B3,3
  57. STW .D1T1 A5,*A4
  58. MVK .L1 -1,A4
  59. weak_alias(__vfork,vfork)
  60. libc_hidden_weak(vfork)