Fix DRM_CAS() on Alpha. (#16549)

main
Ivan Kokshaysky 2009-02-23 15:54:18 -05:00 committed by Adam Jackson
parent 9fc85b4084
commit 6feac49398
1 changed files with 25 additions and 23 deletions

View File

@ -325,28 +325,28 @@ typedef struct _drmSetVersion {
#elif defined(__alpha__) #elif defined(__alpha__)
#define DRM_CAS(lock, old, new, ret) \ #define DRM_CAS(lock, old, new, ret) \
do { \ do { \
int old32; \ int tmp, old32; \
int cur32; \ __asm__ __volatile__( \
__asm__ __volatile__( \ " addl $31, %5, %3\n" \
" mb\n" \ "1: ldl_l %0, %2\n" \
" zap %4, 0xF0, %0\n" \ " cmpeq %0, %3, %1\n" \
" ldl_l %1, %2\n" \ " beq %1, 2f\n" \
" zap %1, 0xF0, %1\n" \ " mov %4, %0\n" \
" cmpeq %0, %1, %1\n" \ " stl_c %0, %2\n" \
" beq %1, 1f\n" \ " beq %0, 3f\n" \
" bis %5, %5, %1\n" \ " mb\n" \
" stl_c %1, %2\n" \ "2: cmpeq %1, 0, %1\n" \
"1: xor %1, 1, %1\n" \ ".subsection 2\n" \
" stl %1, %3" \ "3: br 1b\n" \
: "=r" (old32), \ ".previous" \
"=&r" (cur32), \ : "=&r"(tmp), "=&r"(ret), \
"=m" (__drm_dummy_lock(lock)),\ "=m"(__drm_dummy_lock(lock)), \
"=m" (ret) \ "=&r"(old32) \
: "r" (old), \ : "r"(new), "r"(old) \
"r" (new)); \ : "memory"); \
} while(0) } while (0)
#elif defined(__sparc__) #elif defined(__sparc__)
@ -429,7 +429,9 @@ do { register unsigned int __old __asm("o0"); \
#define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */ #define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */
#endif #endif
#if defined(__alpha__) || defined(__powerpc__) #if defined(__alpha__)
#define DRM_CAS_RESULT(_result) long _result
#elif defined(__powerpc__)
#define DRM_CAS_RESULT(_result) int _result #define DRM_CAS_RESULT(_result) int _result
#else #else
#define DRM_CAS_RESULT(_result) char _result #define DRM_CAS_RESULT(_result) char _result