123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #ifndef _PT_MACHINE_H
- #define _PT_MACHINE_H 1
- #include <features.h>
- #ifndef PT_EI
- # define PT_EI __extern_always_inline
- #endif
- extern long int testandset (int *spinlock);
- extern int __compare_and_swap (long int *p, long int oldval, long int newval);
- PT_EI long int
- testandset (int *spinlock)
- {
- unsigned int old = 1;
-
- __asm__ __volatile__(
- "ex %0, [%1]"
- : "+r" (old)
- : "r" (spinlock)
- : "memory");
- return old;
- }
- #define CURRENT_STACK_FRAME \
- __extension__ ({ char *__sp; __asm__ ("mov %0,sp" : "=r" (__sp)); __sp; })
- #else
- #error PT_MACHINE already defined
- #endif
|