123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #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)
- {
- unsigned int scratch;
- long int ret=-2;
- __asm__ __volatile__(
- "rdctl %0, status\n\t"
- "and %0, %0, %1\n\t"
- "wrctl status, %0 #disable interrupts\n\t"
- "ldw %1, 0(%4)\n\t"
- "stw %3, 0(%4)\n\t"
- "ori %0, %0, 1\n\t"
- "wrctl status, %0 #enable interrupts\n\t"
- : "=&r"(scratch), "=r"(ret)
- : "1"(ret), "r"(1), "r"(spinlock)
- : "memory");
- return ret;
- }
- #define CURRENT_STACK_FRAME stack_pointer
- register char * stack_pointer __asm__ ("%sp");
- #endif
|