vfork.S 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (C) 2005 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If
  13. not, see <http://www.gnu.org/licenses/>.  */
  14. #include <tcb-offsets.h>
  15. #include <asm/unistd.h>
  16. #ifdef __PIC__
  17. #define __VFORK_METAG_LOAD_TP ___metag_load_tp@PLT
  18. #else
  19. #define __VFORK_METAG_LOAD_TP ___metag_load_tp
  20. #endif
  21. /* Save the PID value. */
  22. #define SAVE_PID \
  23. SETL [A0StP++], D0FrT, D1RtP; \
  24. CALLR D1RtP, __VFORK_METAG_LOAD_TP; \
  25. SUB D0Re0, D0Re0, #TLS_PRE_TCB_SIZE; \
  26. GETD D0FrT, [D0Re0 + #PID]; \
  27. NEGS D0FrT, D0FrT; \
  28. BNZ 1f; \
  29. MOVT D0FrT, #0x8000; \
  30. 1: SETD [D0Re0 + #PID], D0FrT; \
  31. GETL D0FrT, D1RtP, [--A0StP];
  32. #define RESTORE_PID \
  33. CMP D0Re0, #0; \
  34. BEQ 1f; \
  35. MSETL [A0StP++], D0Re0, D0FrT; \
  36. CALLR D1RtP, __VFORK_METAG_LOAD_TP; \
  37. SUB D0Re0, D0Re0, #TLS_PRE_TCB_SIZE; \
  38. GETD D0FrT, [D0Re0 + #PID]; \
  39. NEG D0FrT, D0FrT; \
  40. MOVT D1Re0, #0x8000; \
  41. CMP D0FrT, D1Re0; \
  42. XOREQ D0FrT, D0FrT, D0FrT; \
  43. SETD [D0Re0 + #PID], D0FrT; \
  44. GETL D0FrT, D1RtP, [--A0StP]; \
  45. GETL D0Re0, D1Re0, [--A0StP]; \
  46. 1:
  47. #include <../../../../../../../libc/sysdeps/linux/metag/vfork.S>