fork.S 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include <features.h>
  2. #define ALIGN 2
  3. /* Note: .abicalls goes at top of routine, and only one of them. */
  4. #if defined(USER_ABICALLS)
  5. #define ABISETUP \
  6. .set noreorder; \
  7. .cpload t9; \
  8. .set reorder;
  9. .abicalls
  10. #else
  11. #define ABISETUP
  12. #endif
  13. #ifndef __UCLIBC_USE_UNIFIED_SYSCALL__
  14. #define SYSCALL__(name) \
  15. .text; \
  16. .align ALIGN; \
  17. .globl name; \
  18. .ent name, 0; \
  19. name: ; \
  20. ABISETUP \
  21. li v0, __NR_##name ; \
  22. syscall; \
  23. la t3, errno; \
  24. beqz a3, 1f; \
  25. negu a1, v0; \
  26. sw a1, 0(t3); \
  27. li v0, -1; \
  28. 1: ; \
  29. j ra; \
  30. .end name; \
  31. .size name,.-name;
  32. #else /* Unified syscall */
  33. #define SYSCALL__(name) \
  34. .text; \
  35. /* .align ALIGN;*/ \
  36. .globl name; \
  37. .ent name, 0; \
  38. name: ; \
  39. ABISETUP \
  40. .set push; \
  41. .set noreorder; \
  42. j __uClibc_syscall; \
  43. addiu v0, zero, __NR_##name ; \
  44. .set pop; \
  45. .end name; \
  46. .size name,.-name;
  47. #endif /* __UCLIBC_USE_UNIFIED_SYSCALL__ */
  48. #undef ALIGN
  49. #define __ASSEMBLY__
  50. #include <asm/asm.h>
  51. #include <asm/unistd.h>
  52. #include <asm/mipsregs.h>
  53. #include <asm/regdef.h>
  54. /* #include <asm/stackframe.h> */
  55. #undef ALIGN
  56. #define ALIGN 2
  57. #define _SYSCALL0(type,name) SYSCALL__(name)
  58. _SYSCALL0(pid_t, fork);