123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #ifndef _PT_MACHINE_H
- #define _PT_MACHINE_H 1
- #include <features.h>
- #ifndef PT_EI
- # define PT_EI __extern_always_inline
- #endif
- PT_EI long int
- testandset (int *spinlock)
- {
- register unsigned long int ret;
-
- #ifdef __arch_v32
- __asm__ __volatile__("clearf p\n"
- "0:\n\t"
- "movu.b [%2],%0\n\t"
- "ax\n\t"
- "move.b %3,[%2]\n\t"
- "bcs 0b\n\t"
- "clearf p"
- : "=&r" (ret), "=m" (*spinlock)
- : "r" (spinlock), "r" ((int) 1), "m" (*spinlock)
- : "memory");
- #else
- __asm__ __volatile__("clearf\n"
- "0:\n\t"
- "movu.b [%2],%0\n\t"
- "ax\n\t"
- "move.b %3,[%2]\n\t"
- "bwf 0b\n\t"
- "clearf"
- : "=&r" (ret), "=m" (*spinlock)
- : "r" (spinlock), "r" ((int) 1), "m" (*spinlock)
- : "memory");
- #endif
- return ret;
- }
- #define CURRENT_STACK_FRAME \
- ({ char *sp; __asm__ ("move.d $sp,%0" : "=rm" (sp)); sp; })
- #endif
|