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);
- PT_EI long int testandset (int *spinlock)
- {
- register unsigned int ret;
- #if defined(__thumb__)
- void *pc;
- __asm__ __volatile__(
- ".align 0\n"
- "\tbx pc\n"
- "\tnop\n"
- "\t.arm\n"
- "\tswp %0, %2, [%3]\n"
- "\torr %1, pc, #1\n"
- "\tbx %1\n"
- "\t.force_thumb"
- : "=r"(ret), "=r"(pc)
- : "0"(1), "r"(spinlock));
- #else
- __asm__ __volatile__("swp %0, %1, [%2]"
- : "=r"(ret)
- : "0"(1), "r"(spinlock));
- #endif
- return ret;
- }
- #define CURRENT_STACK_FRAME stack_pointer
- register char * stack_pointer __asm__ ("sp");
- #endif
|