pt-machine.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Machine-dependent pthreads configuration and inline functions.
  2. Xtensa version.
  3. Copyright (C) 2007 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
  16. Boston, MA 02110-1301, USA. */
  17. #ifndef _PT_MACHINE_H
  18. #define _PT_MACHINE_H 1
  19. #include <sys/syscall.h>
  20. #include <asm/unistd.h>
  21. #ifndef PT_EI
  22. # define PT_EI __extern_always_inline
  23. #endif
  24. /* Memory barrier. */
  25. #define MEMORY_BARRIER() __asm__ ("memw" : : : "memory")
  26. /* Spinlock implementation; required. */
  27. PT_EI long int
  28. testandset (int *spinlock)
  29. {
  30. int unused = 0;
  31. return INTERNAL_SYSCALL (xtensa, , 4, SYS_XTENSA_ATOMIC_SET,
  32. spinlock, 1, unused);
  33. }
  34. /* Get some notion of the current stack. Need not be exactly the top
  35. of the stack, just something somewhere in the current frame. */
  36. #define CURRENT_STACK_FRAME __builtin_frame_address (0)
  37. #endif /* _PT_MACHINE_H */